diff --git a/web/src/components/SearchAndFilter.tsx b/web/src/components/SearchAndFilter.tsx new file mode 100644 index 0000000..9f80e16 --- /dev/null +++ b/web/src/components/SearchAndFilter.tsx @@ -0,0 +1,129 @@ +import React from 'react'; +import { Input } from './ui/input'; +import { Select } from './ui/select'; +import { Button } from './ui/button'; +import { Badge } from './ui/badge'; +import type { VideoData } from '../types/video'; +import { getUniqueValues } from '../utils/search'; + +interface SearchAndFilterProps { + data: VideoData[]; + searchTerm: string; + onSearchChange: (term: string) => void; + filters: { + classification: string; + language: string; + playlist_name: string; + }; + onFilterChange: (filters: any) => void; + totalResults: number; + filteredResults: number; +} + +export function SearchAndFilter({ + data, + searchTerm, + onSearchChange, + filters, + onFilterChange, + totalResults, + filteredResults +}: SearchAndFilterProps) { + const classifications = getUniqueValues(data, 'classification'); + const languages = getUniqueValues(data, 'language'); + const playlists = getUniqueValues(data, 'playlist_name'); + + const clearFilters = () => { + onSearchChange(''); + onFilterChange({ + classification: 'all', + language: 'all', + playlist_name: 'all' + }); + }; + + const activeFiltersCount = Object.values(filters).filter(value => value !== 'all').length + (searchTerm ? 1 : 0); + + return ( +
+ {filteredResults} of {totalResults} videos
+ {activeFiltersCount > 0 && (
+
Loading video data...
++ {error} +
+To fix this:
+video_classifications.csv exists in your project root+ AI-powered video classification and management platform. Search, filter, and organize your YouTube video collection with intelligent categorization. +
++ Try adjusting your search terms or filters +
++ Your CSV file appears to be empty +
++ Powered by AI classification • {data.length} videos indexed +
+ +