feat: update configuration and improve download components
* Modify biome.json to exclude specific directories from scanning and add experimental scanner ignores. * Refine .vscode/settings.json for better Tailwind CSS integration and maintain locales paths. * Simplify DownloadDialog component by removing unused imports and optimizing button rendering. * Enhance DownloadItem component's accessibility and interaction handling. * Introduce Input component in AdvancedOptions for improved user input handling.
This commit is contained in:
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@@ -21,20 +21,12 @@
|
|||||||
},
|
},
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"tailwindCSS.experimental.classRegex": [
|
"tailwindCSS.experimental.classRegex": [
|
||||||
[
|
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
|
||||||
"cva\\(([^)]*)\\)",
|
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
|
||||||
"[\"'`]([^\"'`]*).*?[\"'`]"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"cn\\(([^)]*)\\)",
|
|
||||||
"(?:'|\"|`)([^']*)(?:'|\"|`)"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"i18n-ally.localesPaths": [
|
|
||||||
"src/renderer/src/locales"
|
|
||||||
],
|
],
|
||||||
|
"i18n-ally.localesPaths": ["src/renderer/src/locales"],
|
||||||
"i18n-ally.keystyle": "nested",
|
"i18n-ally.keystyle": "nested",
|
||||||
"[css]": {
|
"[css]": {
|
||||||
"editor.defaultFormatter": "biomejs.biome"
|
"editor.defaultFormatter": "biomejs.biome"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
biome.json
13
biome.json
@@ -39,7 +39,18 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.json"]
|
"includes": [
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
"**/*.js",
|
||||||
|
"**/*.jsx",
|
||||||
|
"**/*.json",
|
||||||
|
"!monkey/dist",
|
||||||
|
"!dist",
|
||||||
|
"!out",
|
||||||
|
"!build"
|
||||||
|
],
|
||||||
|
"experimentalScannerIgnores": ["monkey/dist/**", "dist/**", "out/**", "build/**"]
|
||||||
},
|
},
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { popularSites } from '@renderer/data/popularSites'
|
|||||||
|
|
||||||
import type { AppSettings, OneClickQualityPreset, PlaylistInfo } from '@shared/types'
|
import type { AppSettings, OneClickQualityPreset, PlaylistInfo } from '@shared/types'
|
||||||
import { useAtom, useSetAtom } from 'jotai'
|
import { useAtom, useSetAtom } from 'jotai'
|
||||||
import { AlertCircle, Download, FolderOpen, List, Loader2, Plus, Search, Video } from 'lucide-react'
|
import { AlertCircle, FolderOpen, List, Loader2, Plus, Video } from 'lucide-react'
|
||||||
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
@@ -1275,16 +1275,12 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
<Loader2 className="h-5 w-5 animate-spin" />
|
<Loader2 className="h-5 w-5 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
<>{t('download.oneClickDownloadNow')}</>
|
t('download.oneClickDownloadNow')
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button onClick={handleFetchVideo} disabled={loading || !url.trim()}>
|
<Button onClick={handleFetchVideo} disabled={loading || !url.trim()}>
|
||||||
{loading ? (
|
{loading ? <Loader2 className="h-5 w-5 animate-spin" /> : t('download.fetch')}
|
||||||
<Loader2 className="h-5 w-5 animate-spin" />
|
|
||||||
) : (
|
|
||||||
<>{t('download.fetch')}</>
|
|
||||||
)}
|
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
) : videoInfoCardState.activeTab === 'video' ? (
|
) : videoInfoCardState.activeTab === 'video' ? (
|
||||||
@@ -1328,7 +1324,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
|
|||||||
{playlistDownloadLoading ? (
|
{playlistDownloadLoading ? (
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
<>{t('playlist.downloadCurrentRange')}</>
|
t('playlist.downloadCurrentRange')
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
@@ -1340,7 +1336,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
|
|||||||
{playlistPreviewLoading ? (
|
{playlistPreviewLoading ? (
|
||||||
<Loader2 className="h-5 w-5 animate-spin" />
|
<Loader2 className="h-5 w-5 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
<>{t('download.fetch')}</>
|
t('download.fetch')
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -658,20 +658,20 @@ export function DownloadItem({ download, isSelected = false, onToggleSelect }: D
|
|||||||
className={`flex w-full flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 ${
|
className={`flex w-full flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 ${
|
||||||
selectionEnabled ? 'cursor-pointer' : ''
|
selectionEnabled ? 'cursor-pointer' : ''
|
||||||
}`}
|
}`}
|
||||||
onClick={selectionEnabled ? () => onToggleSelect?.(download.id) : undefined}
|
{...(selectionEnabled
|
||||||
onKeyDown={
|
? {
|
||||||
selectionEnabled
|
onClick: () => onToggleSelect?.(download.id),
|
||||||
? (e) => {
|
onKeyDown: (e: React.KeyboardEvent) => {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
onToggleSelect?.(download.id)
|
onToggleSelect?.(download.id)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
: undefined
|
role: 'button',
|
||||||
}
|
tabIndex: 0,
|
||||||
role={selectionEnabled ? 'button' : undefined}
|
'aria-label': t('history.selectItem')
|
||||||
tabIndex={selectionEnabled ? 0 : undefined}
|
}
|
||||||
aria-label={selectionEnabled ? t('history.selectItem') : undefined}
|
: {})}
|
||||||
>
|
>
|
||||||
{/* Thumbnail */}
|
{/* Thumbnail */}
|
||||||
<div className="relative z-20 shrink-0 overflow-hidden rounded-lg border border-border/60 bg-background/60 w-20 h-14 pointer-events-none">
|
<div className="relative z-20 shrink-0 overflow-hidden rounded-lg border border-border/60 bg-background/60 w-20 h-14 pointer-events-none">
|
||||||
@@ -682,7 +682,6 @@ export function DownloadItem({ download, isSelected = false, onToggleSelect }: D
|
|||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100'
|
: 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100'
|
||||||
}`}
|
}`}
|
||||||
onClick={(event) => event.stopPropagation()}
|
|
||||||
>
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={Boolean(isSelected)}
|
checked={Boolean(isSelected)}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
AccordionItem,
|
AccordionItem,
|
||||||
AccordionTrigger
|
AccordionTrigger
|
||||||
} from '@renderer/components/ui/accordion'
|
} from '@renderer/components/ui/accordion'
|
||||||
|
import { Input } from '@renderer/components/ui/input'
|
||||||
import { Label } from '@renderer/components/ui/label'
|
import { Label } from '@renderer/components/ui/label'
|
||||||
import { Switch } from '@renderer/components/ui/switch'
|
import { Switch } from '@renderer/components/ui/switch'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|||||||
Reference in New Issue
Block a user