|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { Download, Home, Settings, User, WandSparklesIcon } from "lucide-react"; |
| 4 | +import { useSearchParams } from "next/navigation"; |
| 5 | +import { GeneratedCard } from "./components/GeneratedCard"; |
| 6 | +import { Button } from "./components/ui/button"; |
| 7 | +import { UploadCard } from "./components/UploadCard"; |
| 8 | +import CustomPromptCard from "./components/CustomPromptCard"; |
| 9 | +import Link from "next/link"; |
| 10 | + |
| 11 | +const promptTitles = { |
| 12 | + "isolated-table": "Clean Product Shot", |
| 13 | + "lifestyle-scene": "Lifestyle Scene", |
| 14 | + "hero-shot": "Hero Shot", |
| 15 | +}; |
| 16 | + |
| 17 | +export function ProductImageGenerator() { |
| 18 | + const searchParams = useSearchParams(); |
| 19 | + const publicAccessToken = searchParams.get("publicAccessToken"); |
| 20 | + const generateToken = searchParams.get("triggerToken"); |
| 21 | + const fileUrl = searchParams.get("fileUrl"); |
| 22 | + const runId = searchParams.get("runId"); |
| 23 | + |
| 24 | + return ( |
| 25 | + <div className="min-h-screen bg-gray-100/20 "> |
| 26 | + <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> |
| 27 | + <div className="container mx-auto px-4"> |
| 28 | + <div className="flex h-14 items-center justify-between"> |
| 29 | + <div className="flex items-center space-x-4"> |
| 30 | + <div className="flex items-center space-x-2"> |
| 31 | + <Link href="/" className="flex items-center space-x-2"> |
| 32 | + <WandSparklesIcon className="h-5 w-5 text-purple-500" /> |
| 33 | + </Link> |
| 34 | + <h1 className="text-xl font-bold text-foreground">ImageFlow</h1> |
| 35 | + </div> |
| 36 | + </div> |
| 37 | + |
| 38 | + <nav className="flex items-center space-x-1"> |
| 39 | + <Button variant="ghost" size="sm"> |
| 40 | + <Home className="h-4 w-4 mr-1 text-gray-500" /> |
| 41 | + Home |
| 42 | + </Button> |
| 43 | + <Button variant="ghost" size="sm"> |
| 44 | + <User className="h-4 w-4 mr-1 text-gray-500" /> |
| 45 | + Account |
| 46 | + </Button> |
| 47 | + <Button variant="ghost" size="sm"> |
| 48 | + <Settings className="h-4 w-4 mr-1 text-gray-500" /> |
| 49 | + Settings |
| 50 | + </Button> |
| 51 | + </nav> |
| 52 | + </div> |
| 53 | + </div> |
| 54 | + </header> |
| 55 | + |
| 56 | + <main className="container px-4 py-16 w-full mx-auto "> |
| 57 | + <div className="max-w-7xl mx-auto w"> |
| 58 | + <div className="mb-8 flex justify-between items-end gap-8"> |
| 59 | + <div> |
| 60 | + <h2 className="text-3xl font-bold text-foreground mb-2"> |
| 61 | + Product Image Generator |
| 62 | + </h2> |
| 63 | + <p className="text-muted-foreground"> |
| 64 | + Upload a product image and generate professional marketing shots |
| 65 | + for your online store. |
| 66 | + </p> |
| 67 | + </div> |
| 68 | + <div> |
| 69 | + <Button variant={"default"} className={"cursor-pointer"}> |
| 70 | + <Download className="h-4 w-4 mr-1" /> |
| 71 | + Download images |
| 72 | + </Button> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + |
| 76 | + <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8"> |
| 77 | + <UploadCard |
| 78 | + runId={runId ?? undefined} |
| 79 | + accessToken={publicAccessToken ?? undefined} |
| 80 | + fileUrl={fileUrl ?? undefined} |
| 81 | + /> |
| 82 | + <GeneratedCard |
| 83 | + id="isolated-table" |
| 84 | + runId={runId ?? undefined} |
| 85 | + accessToken={publicAccessToken ?? undefined} |
| 86 | + promptTitle={promptTitles["isolated-table"]} |
| 87 | + /> |
| 88 | + <GeneratedCard |
| 89 | + id="lifestyle-scene" |
| 90 | + runId={runId ?? undefined} |
| 91 | + accessToken={publicAccessToken ?? undefined} |
| 92 | + promptTitle={promptTitles["lifestyle-scene"]} |
| 93 | + /> |
| 94 | + <GeneratedCard |
| 95 | + id="hero-shot" |
| 96 | + runId={runId ?? undefined} |
| 97 | + accessToken={publicAccessToken ?? undefined} |
| 98 | + promptTitle={promptTitles["hero-shot"]} |
| 99 | + /> |
| 100 | + </div> |
| 101 | + |
| 102 | + <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6"> |
| 103 | + {Array.from({ length: 4 }).map((_, index) => { |
| 104 | + return ( |
| 105 | + <CustomPromptCard |
| 106 | + id={`custom-prompt-${index}`} |
| 107 | + key={`custom-prompt-${index}`} |
| 108 | + fileUrl={fileUrl ?? undefined} |
| 109 | + generateToken={generateToken ?? undefined} |
| 110 | + /> |
| 111 | + ); |
| 112 | + })} |
| 113 | + </div> |
| 114 | + </div> |
| 115 | + </main> |
| 116 | + </div> |
| 117 | + ); |
| 118 | +} |
0 commit comments