mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-17 01:33:43 +08:00
refactor: Remove unused video-related props and logic from search components
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user