refactor: Remove unused video-related props and logic from search components

This commit is contained in:
kuekhaoyang
2025-11-17 22:59:15 +08:00
parent d3b3b281bd
commit 0bb26ebf9a
5 changed files with 11 additions and 53 deletions
-5
View File
@@ -126,9 +126,6 @@ function HomePage() {
currentSource=""
checkedSources={completedSources}
totalSources={totalSources}
checkedVideos={0}
totalVideos={totalVideosFound}
searchStage="searching"
/>
</div>
@@ -140,8 +137,6 @@ function HomePage() {
<ResultsHeader
loading={loading}
resultsCount={results.length}
checkedVideos={0}
totalVideos={totalVideosFound}
availableSources={availableSources}
/>
+4 -20
View File
@@ -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 (
<div className="w-full space-y-3 animate-fade-in">
@@ -61,7 +45,7 @@ export function SearchLoadingAnimation({
</svg>
<span className="text-sm font-medium text-[var(--text-color-secondary)]">
{stage === 'searching' ? '正在搜索视频源' : '正在检测视频可用性'}{dots}
{dots}
</span>
</div>
+1 -1
View File
@@ -32,7 +32,7 @@ export function PlayerError({ error, onBack, onRetry }: PlayerErrorProps) {
className="flex items-center gap-2"
>
<Icons.RefreshCw size={20} />
<span></span>
<span></span>
</Button>
</div>
</Card>
+6 -18
View File
@@ -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({
</h3>
<div className="flex items-center gap-3">
{loading && (
<>
<Badge variant="secondary" className="text-sm">
<span className="flex items-center gap-2">
<Icons.Search size={14} />
{checkedVideos}/{totalVideos}
</span>
</Badge>
<Badge variant="primary" className="text-sm">
<span className="flex items-center gap-2">
<Icons.Check size={14} />
{resultsCount}/{totalVideos}
</span>
</Badge>
</>
<Badge variant="secondary" className="text-sm">
<span className="flex items-center gap-2">
<Icons.Search size={14} />
...
</span>
</Badge>
)}
{!loading && (
<Badge variant="primary">{resultsCount} </Badge>
-9
View File
@@ -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}
/>
</div>
)}