From 2bd894ad9a9d525998dd576ecdc3e25c080c1fc2 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Sat, 10 Jan 2026 12:15:10 -0700 Subject: [PATCH] (FEAT): Added the view all button for Connor! --- web/src/components/inputs/RecipeSearchBar.tsx | 15 +++------------ web/src/pages/Home.tsx | 7 ++++++- web/src/types/filters.ts | 4 ---- web/src/types/index.ts | 0 web/src/types/routes.ts | 2 ++ 5 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 web/src/types/filters.ts delete mode 100644 web/src/types/index.ts diff --git a/web/src/components/inputs/RecipeSearchBar.tsx b/web/src/components/inputs/RecipeSearchBar.tsx index 8a7e914..1618bbd 100644 --- a/web/src/components/inputs/RecipeSearchBar.tsx +++ b/web/src/components/inputs/RecipeSearchBar.tsx @@ -7,10 +7,9 @@ import { isApiError } from "../../types/api/error"; import type { Recipe } from "../../types/recipe"; import { useNavigate } from "react-router-dom"; import { FilterContext } from "../../context/FilterContext"; +import ROUTE_CONSTANTS from "../../types/routes"; interface RecipeSearchBarProps { - // filters: SearchFilters; - // setFilters: React.Dispatch>; redirect: boolean; searchOnLoad: boolean; favorites: boolean; @@ -30,7 +29,7 @@ export default function RecipeSearchBar({ redirect, searchOnLoad, favorites, set // SERVER FUNCTIONS const fetchSearchResults = async () => { if (redirect) { - await navigate("/v2/web/search"); + await navigate(ROUTE_CONSTANTS.Search); return; } @@ -39,7 +38,7 @@ export default function RecipeSearchBar({ redirect, searchOnLoad, favorites, set if (setLoading) setLoading(true); try { - const result = await SearchRecipes(filters); + const result = await SearchRecipes({ ...filters, Favorites: favorites }); if (isApiError(result)) { console.error(result.message); return; @@ -76,14 +75,6 @@ export default function RecipeSearchBar({ redirect, searchOnLoad, favorites, set void fetchSearchResults(); }, [searchOnLoad]); - useEffect(() => { - setFilters({ - ...filters, - Favorites: favorites - }); - }, [favorites]); - - return (
void searchHandler(e)}>
diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index e298408..16ccb98 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -88,7 +88,12 @@ export default function Home() {
-
+

+ Not sure what you want? {" "} + + View all recipes here + +

{/* Highlight Section */} diff --git a/web/src/types/filters.ts b/web/src/types/filters.ts deleted file mode 100644 index e70248e..0000000 --- a/web/src/types/filters.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface SearchFilters { - - -} diff --git a/web/src/types/index.ts b/web/src/types/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/web/src/types/routes.ts b/web/src/types/routes.ts index a2e194e..bea2f70 100644 --- a/web/src/types/routes.ts +++ b/web/src/types/routes.ts @@ -8,6 +8,7 @@ const ROUTE_CONSTANTS: { ShoppingList: string; Login: string; History: string; + Search: string; Recipe: (id: number) => string; } = { Home: `${VERSION_FLAG}/web/home`, @@ -17,6 +18,7 @@ const ROUTE_CONSTANTS: { ShoppingList: `${VERSION_FLAG}/web/list`, Login: `${VERSION_FLAG}/web/login`, History: `${VERSION_FLAG}/web/history`, + Search: `${VERSION_FLAG}/web/search`, Recipe: (id: number) => `${VERSION_FLAG}/web/recipe/${id}`, };