Spaces:
Running
Running
File size: 1,298 Bytes
bab2147 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import { redirect } from "next/navigation";
import Image from "next/image";
import { getRoast } from "@/app/actions/roast";
import { Quote } from "@/components/quote";
import Logo from "@/assets/logo.svg";
import Link from "next/link";
async function get(id: string) {
const roast = await getRoast({ id });
return roast;
}
export default async function Roast({
params: { roastId },
}: {
params: { roastId: string };
}) {
const quote = await get(roastId);
if (!quote?.data) {
redirect("/");
}
return (
<div>
<header className="flex items-start max-lg:gap-1 lg:items-center justify-between max-lg:flex-col border-b border-zinc-200 pb-5">
<Image
src={Logo}
alt="logo hugging face"
width={100}
height={100}
className="object-contain w-36 lg:w-44"
/>
<div>
<p className="text-sm text-zinc-500">
Roast your favorite Hugging Face user! 👹
</p>
</div>
</header>
<Quote data={quote.data?.text}>
<Link
href="/"
className="bg-black rounded-full inline-block px-4 py-2.5 text-sm font-medium text-white hover:bg-zinc-800 mt-5"
>
Roast another user! 🧨
</Link>
</Quote>
</div>
);
}
|