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:
Nexmoe
2025-12-20 19:25:45 +08:00
parent 74dbb223ce
commit d7b131d795
5 changed files with 32 additions and 33 deletions

16
.vscode/settings.json vendored
View File

@@ -21,20 +21,12 @@
},
"typescript.tsdk": "node_modules/typescript/lib",
"tailwindCSS.experimental.classRegex": [
[
"cva\\(([^)]*)\\)",
"[\"'`]([^\"'`]*).*?[\"'`]"
],
[
"cn\\(([^)]*)\\)",
"(?:'|\"|`)([^']*)(?:'|\"|`)"
]
],
"i18n-ally.localesPaths": [
"src/renderer/src/locales"
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
"i18n-ally.localesPaths": ["src/renderer/src/locales"],
"i18n-ally.keystyle": "nested",
"[css]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
}

View File

@@ -39,7 +39,18 @@
},
"files": {
"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": {
"enabled": true,

View File

@@ -23,7 +23,7 @@ import { popularSites } from '@renderer/data/popularSites'
import type { AppSettings, OneClickQualityPreset, PlaylistInfo } from '@shared/types'
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 { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
@@ -1275,16 +1275,12 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
{loading ? (
<Loader2 className="h-5 w-5 animate-spin" />
) : (
<>{t('download.oneClickDownloadNow')}</>
t('download.oneClickDownloadNow')
)}
</Button>
) : (
<Button onClick={handleFetchVideo} disabled={loading || !url.trim()}>
{loading ? (
<Loader2 className="h-5 w-5 animate-spin" />
) : (
<>{t('download.fetch')}</>
)}
{loading ? <Loader2 className="h-5 w-5 animate-spin" /> : t('download.fetch')}
</Button>
)
) : videoInfoCardState.activeTab === 'video' ? (
@@ -1328,7 +1324,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
{playlistDownloadLoading ? (
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
) : (
<>{t('playlist.downloadCurrentRange')}</>
t('playlist.downloadCurrentRange')
)}
</Button>
) : (
@@ -1340,7 +1336,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa
{playlistPreviewLoading ? (
<Loader2 className="h-5 w-5 animate-spin" />
) : (
<>{t('download.fetch')}</>
t('download.fetch')
)}
</Button>
)}

View File

@@ -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 ${
selectionEnabled ? 'cursor-pointer' : ''
}`}
onClick={selectionEnabled ? () => onToggleSelect?.(download.id) : undefined}
onKeyDown={
selectionEnabled
? (e) => {
{...(selectionEnabled
? {
onClick: () => onToggleSelect?.(download.id),
onKeyDown: (e: React.KeyboardEvent) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
onToggleSelect?.(download.id)
}
}
: undefined
}
role={selectionEnabled ? 'button' : undefined}
tabIndex={selectionEnabled ? 0 : undefined}
aria-label={selectionEnabled ? t('history.selectItem') : undefined}
},
role: 'button',
tabIndex: 0,
'aria-label': t('history.selectItem')
}
: {})}
>
{/* 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">
@@ -682,7 +682,6 @@ export function DownloadItem({ download, isSelected = false, onToggleSelect }: D
? 'opacity-100'
: 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100'
}`}
onClick={(event) => event.stopPropagation()}
>
<Checkbox
checked={Boolean(isSelected)}

View File

@@ -4,6 +4,7 @@ import {
AccordionItem,
AccordionTrigger
} from '@renderer/components/ui/accordion'
import { Input } from '@renderer/components/ui/input'
import { Label } from '@renderer/components/ui/label'
import { Switch } from '@renderer/components/ui/switch'
import { useTranslation } from 'react-i18next'