From 0bb26ebf9ad5ba326d75770c199663b7e3c833a4 Mon Sep 17 00:00:00 2001 From: kuekhaoyang Date: Mon, 17 Nov 2025 22:59:15 +0800 Subject: [PATCH] refactor: Remove unused video-related props and logic from search components --- app/page.tsx | 5 ----- components/SearchLoadingAnimation.tsx | 24 ++++-------------------- components/player/PlayerError.tsx | 2 +- components/search/ResultsHeader.tsx | 24 ++++++------------------ components/search/SearchForm.tsx | 9 --------- 5 files changed, 11 insertions(+), 53 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index ea2a6dd..b291d79 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -126,9 +126,6 @@ function HomePage() { currentSource="" checkedSources={completedSources} totalSources={totalSources} - checkedVideos={0} - totalVideos={totalVideosFound} - searchStage="searching" /> @@ -140,8 +137,6 @@ function HomePage() { diff --git a/components/SearchLoadingAnimation.tsx b/components/SearchLoadingAnimation.tsx index 89c3653..f8fe4ea 100644 --- a/components/SearchLoadingAnimation.tsx +++ b/components/SearchLoadingAnimation.tsx @@ -6,18 +6,12 @@ interface SearchLoadingAnimationProps { currentSource?: string; checkedSources?: number; totalSources?: number; - checkedVideos?: number; - totalVideos?: number; - stage?: 'searching' | 'checking'; } export function SearchLoadingAnimation({ currentSource, checkedSources = 0, totalSources = 16, - checkedVideos = 0, - totalVideos = 0, - stage = 'searching' }: SearchLoadingAnimationProps) { const [dots, setDots] = useState(''); @@ -28,19 +22,9 @@ export function SearchLoadingAnimation({ return () => clearInterval(dotInterval); }, []); - // Calculate unified progress (0-100%) - // Stage 1: Search sources (0-60%) - // Stage 2: Check videos (60-100%) - let progress = 0; - let statusText = ''; - - if (stage === 'searching') { - progress = totalSources > 0 ? (checkedSources / totalSources) * 60 : 0; - statusText = `${checkedSources}/${totalSources} 个源`; - } else if (stage === 'checking') { - progress = 60 + (totalVideos > 0 ? (checkedVideos / totalVideos) * 40 : 0); - statusText = `${checkedVideos}/${totalVideos} 个视频`; - } + // Calculate progress (0-100%) + const progress = totalSources > 0 ? (checkedSources / totalSources) * 100 : 0; + const statusText = `${checkedSources}/${totalSources} 个源`; return (
@@ -61,7 +45,7 @@ export function SearchLoadingAnimation({ - {stage === 'searching' ? '正在搜索视频源' : '正在检测视频可用性'}{dots} + 正在搜索视频源{dots}
diff --git a/components/player/PlayerError.tsx b/components/player/PlayerError.tsx index db3f6cf..b058245 100644 --- a/components/player/PlayerError.tsx +++ b/components/player/PlayerError.tsx @@ -32,7 +32,7 @@ export function PlayerError({ error, onBack, onRetry }: PlayerErrorProps) { className="flex items-center gap-2" > - 重新检测 + 重试 diff --git a/components/search/ResultsHeader.tsx b/components/search/ResultsHeader.tsx index 4ebdae9..934af57 100644 --- a/components/search/ResultsHeader.tsx +++ b/components/search/ResultsHeader.tsx @@ -7,16 +7,12 @@ import { SourceBadges } from './SourceBadges'; interface ResultsHeaderProps { loading: boolean; resultsCount: number; - checkedVideos: number; - totalVideos: number; availableSources: Array<{ id: string; name: string; count: number }>; } export function ResultsHeader({ loading, resultsCount, - checkedVideos, - totalVideos, availableSources, }: ResultsHeaderProps) { return ( @@ -27,20 +23,12 @@ export function ResultsHeader({
{loading && ( - <> - - - - 已检测 {checkedVideos}/{totalVideos} - - - - - - 可用视频 {resultsCount}/{totalVideos} - - - + + + + 搜索中... + + )} {!loading && ( {resultsCount} 个视频 diff --git a/components/search/SearchForm.tsx b/components/search/SearchForm.tsx index 83132d1..8b14820 100644 --- a/components/search/SearchForm.tsx +++ b/components/search/SearchForm.tsx @@ -16,9 +16,6 @@ interface SearchFormProps { currentSource?: string; checkedSources?: number; totalSources?: number; - checkedVideos?: number; - totalVideos?: number; - searchStage?: 'searching' | 'checking'; } export function SearchForm({ @@ -29,9 +26,6 @@ export function SearchForm({ currentSource = '', checkedSources = 0, totalSources = 16, - checkedVideos = 0, - totalVideos = 0, - searchStage = 'searching', }: SearchFormProps) { const [query, setQuery] = useState(initialQuery); const [showHistory, setShowHistory] = useState(false); @@ -123,9 +117,6 @@ export function SearchForm({ currentSource={currentSource} checkedSources={checkedSources} totalSources={totalSources} - checkedVideos={checkedVideos} - totalVideos={totalVideos} - stage={searchStage} />
)}