"use client"; import { useRef } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { Input } from "@/components/ui/input"; import { Badge } from "@/components/ui/badge"; import { Flame, Clock, ChefHat, Search } from "lucide-react"; import type { RecipeResult } from "@/app/(app)/explore/page"; const DIFFICULTY_COLORS: Record = { easy: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200", medium: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200", hard: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200", }; function RecipeCard({ recipe }: { recipe: RecipeResult }) { const totalMins = (recipe.prepMins ?? 0) + (recipe.cookMins ?? 0); return (

{recipe.title}

{recipe.difficulty && ( {recipe.difficulty} )}
{totalMins > 0 && ( {totalMins}m )} {recipe.authorName && ( {recipe.authorName} )}
); } function HorizontalScroll({ children }: { children: React.ReactNode }) { return (
{children}
); } type Props = { trending: RecipeResult[]; recent: RecipeResult[]; }; export function ExplorePageContent({ trending, recent }: Props) { const router = useRouter(); const inputRef = useRef(null); const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); const q = inputRef.current?.value.trim(); if (q) router.push(`/search?q=${encodeURIComponent(q)}`); else router.push("/search"); }; return (
{/* Search bar */}

Explore

{/* Trending this week */}

Trending this week

{trending.length === 0 ? (

No trending recipes yet. Be the first to share one!

) : ( {trending.map((recipe) => (
))}
)}
{/* Recently added */}

Recently added

{recent.length === 0 ? (

No public recipes yet.

) : (
{recent.map((recipe) => ( ))}
)}
); }