From d7b131d7959af82f0d6d891662667e8910f07aec Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Sat, 20 Dec 2025 19:25:45 +0800 Subject: [PATCH] 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. --- .vscode/settings.json | 16 ++++---------- biome.json | 13 +++++++++++- .../components/download/DownloadDialog.tsx | 14 +++++-------- .../src/components/download/DownloadItem.tsx | 21 +++++++++---------- .../src/components/video/AdvancedOptions.tsx | 1 + 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d2b121e..df3745a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" } -} \ No newline at end of file +} diff --git a/biome.json b/biome.json index bc68ee5..f6efc41 100644 --- a/biome.json +++ b/biome.json @@ -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, diff --git a/src/renderer/src/components/download/DownloadDialog.tsx b/src/renderer/src/components/download/DownloadDialog.tsx index 271440c..ebe7893 100644 --- a/src/renderer/src/components/download/DownloadDialog.tsx +++ b/src/renderer/src/components/download/DownloadDialog.tsx @@ -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 ? ( ) : ( - <>{t('download.oneClickDownloadNow')} + t('download.oneClickDownloadNow') )} ) : ( ) ) : videoInfoCardState.activeTab === 'video' ? ( @@ -1328,7 +1324,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa {playlistDownloadLoading ? ( ) : ( - <>{t('playlist.downloadCurrentRange')} + t('playlist.downloadCurrentRange') )} ) : ( @@ -1340,7 +1336,7 @@ export function DownloadDialog({ onOpenSupportedSites, onOpenSettings }: Downloa {playlistPreviewLoading ? ( ) : ( - <>{t('download.fetch')} + t('download.fetch') )} )} diff --git a/src/renderer/src/components/download/DownloadItem.tsx b/src/renderer/src/components/download/DownloadItem.tsx index 691e238..84c0261 100644 --- a/src/renderer/src/components/download/DownloadItem.tsx +++ b/src/renderer/src/components/download/DownloadItem.tsx @@ -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 */}
@@ -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()} >