Restored to '4297267681097f3ff53d34610ef0e8e98baf8e0e'
Replit-Restored-To: 4297267681
This commit is contained in:
@@ -20,42 +20,17 @@ export default function FolxStadlPage() {
|
||||
const itemsPerPage = 10;
|
||||
|
||||
const { data, isLoading } = useQuery<{videos: Video[], total: number}>({
|
||||
queryKey: ['/api/videos', { limit: 200 }],
|
||||
queryFn: async ({ queryKey }) => {
|
||||
const [, params] = queryKey as [string, any];
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
searchParams.append(key, String(value));
|
||||
}
|
||||
});
|
||||
|
||||
const response = await fetch(`/api/videos?${searchParams}`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch videos');
|
||||
}
|
||||
return response.json();
|
||||
},
|
||||
queryKey: ['/api/videos?limit=200'],
|
||||
select: (response) => response || { videos: [], total: 0 }
|
||||
});
|
||||
|
||||
const videos = data?.videos || [];
|
||||
|
||||
// Filter all FOLX STADL videos (including all seasons and formats)
|
||||
let folxStadlVideos = videos.filter(video =>
|
||||
const folxStadlVideos = videos.filter(video =>
|
||||
video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL")
|
||||
);
|
||||
|
||||
// Apply search filter if search query exists
|
||||
if (searchQuery && searchQuery.length >= 2) {
|
||||
const searchLower = searchQuery.toLowerCase();
|
||||
folxStadlVideos = folxStadlVideos.filter(video =>
|
||||
video.title.toLowerCase().includes(searchLower) ||
|
||||
video.description?.toLowerCase().includes(searchLower)
|
||||
);
|
||||
}
|
||||
|
||||
// Pagination logic
|
||||
const totalPages = Math.ceil(folxStadlVideos.length / itemsPerPage);
|
||||
const startIndex = (currentPage - 1) * itemsPerPage;
|
||||
@@ -116,9 +91,7 @@ export default function FolxStadlPage() {
|
||||
value={searchQuery}
|
||||
onChange={(e) => {
|
||||
setSearchQuery(e.target.value);
|
||||
if (e.target.value) {
|
||||
setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
}
|
||||
if (e.target.value) setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
}}
|
||||
className="bg-white border border-gray-300 rounded-lg px-4 py-2 pl-10 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-64"
|
||||
/>
|
||||
@@ -170,12 +143,7 @@ export default function FolxStadlPage() {
|
||||
type="search"
|
||||
placeholder="Search..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => {
|
||||
setSearchQuery(e.target.value);
|
||||
if (e.target.value) {
|
||||
setLocation(`/?search=${encodeURIComponent(e.target.value)}`);
|
||||
}
|
||||
}}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="bg-white border border-gray-300 rounded-lg px-3 py-2 pl-9 text-sm text-gray-900 placeholder-gray-500 focus:outline-none focus:border-bunny-blue transition-colors w-full"
|
||||
/>
|
||||
<Search className="absolute left-2.5 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
||||
|
||||
Reference in New Issue
Block a user