({
queryKey: ["/api/videos", {
limit: 20,
offset,
- search: searchQuery || undefined,
- category: selectedCategory !== "All Categories" ? selectedCategory : undefined,
- sort: sortBy
+ search: searchQuery || undefined
}],
queryFn: async ({ queryKey }) => {
const [, params] = queryKey as [string, any];
@@ -61,42 +52,27 @@ export default function Home() {
}
}, [videosResponse, offset]);
- // Reset videos when search/filter changes
+ // Reset videos when search changes
const handleSearch = (query: string) => {
setSearchQuery(query);
setOffset(0);
setAllVideos([]);
};
- const handleCategoryChange = (category: string) => {
- setSelectedCategory(category);
- setOffset(0);
- setAllVideos([]);
- };
-
- const handleSortChange = (sort: string) => {
- setSortBy(sort);
- setOffset(0);
- setAllVideos([]);
- };
-
const handleLoadMore = () => {
setOffset(prev => prev + 20);
};
- // Force refetch when filters change
+ // Force refetch when search changes
useEffect(() => {
refetch();
- }, [searchQuery, selectedCategory, sortBy, offset, refetch]);
+ }, [searchQuery, offset, refetch]);
return (
diff --git a/server/routes.ts b/server/routes.ts
index 2c7a230..ff022c8 100644
--- a/server/routes.ts
+++ b/server/routes.ts
@@ -10,10 +10,9 @@ export async function registerRoutes(app: Express): Promise {
const limit = parseInt(req.query.limit as string) || 20;
const offset = parseInt(req.query.offset as string) || 0;
const search = req.query.search as string;
- const category = req.query.category as string;
- const videos = await storage.getVideos(limit, offset, search, category);
- const total = await storage.getVideoCount(search, category);
+ const videos = await storage.getVideos(limit, offset, search);
+ const total = await storage.getVideoCount(search);
res.json({
videos,
@@ -48,17 +47,7 @@ export async function registerRoutes(app: Express): Promise {
}
});
- // Get video categories
- app.get("/api/categories", async (req, res) => {
- try {
- const videos = await storage.getVideos(1000);
- const categories = Array.from(new Set(videos.map(v => v.category).filter(Boolean)));
- res.json(categories);
- } catch (error) {
- console.error("Error fetching categories:", error);
- res.status(500).json({ message: "Failed to fetch categories" });
- }
- });
+
const httpServer = createServer(app);
return httpServer;
diff --git a/server/storage.ts b/server/storage.ts
index 664fd8d..dfb4daa 100644
--- a/server/storage.ts
+++ b/server/storage.ts
@@ -3,11 +3,11 @@ import { randomUUID } from "crypto";
import { BunnyService } from "./bunny";
export interface IStorage {
- getVideos(limit?: number, offset?: number, search?: string, category?: string): Promise