From df1fec502e60513d6af7b721e1c61f8c3fd556fb Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Thu, 23 Apr 2026 10:45:28 -0400 Subject: [PATCH] feat: add posters to search results --- .../components/SearchRequestModal.tsx | 135 +++++++++++++----- 1 file changed, 103 insertions(+), 32 deletions(-) diff --git a/frontend/src/app/dashboard/components/SearchRequestModal.tsx b/frontend/src/app/dashboard/components/SearchRequestModal.tsx index 5b8cef4..9bd5b76 100644 --- a/frontend/src/app/dashboard/components/SearchRequestModal.tsx +++ b/frontend/src/app/dashboard/components/SearchRequestModal.tsx @@ -2,6 +2,7 @@ import { useState } from "react"; import { toast } from "sonner"; +import { Search, Loader2, Film, Tv, PlusCircle, Egg, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -27,6 +28,7 @@ export function SearchRequestModal({ const [loading, setLoading] = useState(false); const search = async () => { + if (!query) return; setLoading(true); try { const res = await api.get( @@ -34,7 +36,7 @@ export function SearchRequestModal({ ); setResults(res.data?.results || res.data || []); } catch { - toast.error("Search failed"); + toast.error("Chickens lost the trail! Search failed."); } finally { setLoading(false); } @@ -48,54 +50,123 @@ export function SearchRequestModal({ title: item.title || item.name, seasons: item.seasons, }); - toast.success("Request sent"); + toast.success("Golden egg sent to the farmer!"); onOpenChange(false); } catch (e: any) { - toast.error(e?.response?.data?.error || "Request failed"); + toast.error(e?.response?.data?.error || "Request flew the coop!"); } }; return ( - - - Request content - - Search and send request. Movie cost {costs.movie}. TV cost{" "} - {costs.tv}. + + +
+ + PECK FOR FEED + + +
+ + Movie: {costs.movie} $COOP // TV: {costs.tv} $COOP
-
- setQuery(e.target.value)} - placeholder="Search movie or show" - /> - -
+ +
+
+
+ setQuery(e.target.value)} + onKeyDown={(e) => e.key === "Enter" && search()} + placeholder="Type movie or show name..." + className="rounded-full border-4 border-foreground h-14 pl-6 pr-12 font-bold text-lg focus-visible:ring-primary shadow-sm" + /> + +
+ +
+ +
{results.map((r) => (
-
-
{r.title || r.name}
-
- {r.media_type || r.mediaType} +
+ {r.posterPath ? ( + {r.title + ) : ( +
+ +
+ )} +
+ +
+
+
+ {r.title || r.name} +
+
+ + {r.mediaType === "movie" ? ( + + ) : ( + + )} + {r.mediaType || "unknown"} + + {r.releaseDate && ( + + {new Date(r.releaseDate).getFullYear()} + + )} +
+
+ +
+
+ {" "} + {r.mediaType === "movie" ? costs.movie : costs.tv} $COOP +
+
-
))} + + {results.length === 0 && !loading && query && ( +
+
🏜️
+
+ Nothing found in the yard. +
+
+ )}