File size: 2,129 Bytes
bab2147
 
 
 
 
 
 
aaa3467
bab2147
 
 
 
 
 
aaa3467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bab2147
 
 
 
 
 
 
 
 
 
 
 
3c7c2dc
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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";
import { Metadata, ResolvingMetadata } from "next";

async function get(id: string) {
  const roast = await getRoast({ id });
  return roast;
}

export async function generateMetadata(
  { params }: { params: { roastId: string } },
  parent: ResolvingMetadata
): Promise<Metadata> {
  return {
    title: "Hugger Roaster",
    description: "A Hugger has been roasted! 🔥 Check it out",
    metadataBase: new URL("https://enzostvs-hugger-roaster.hf.space"),
    openGraph: {
      title: "Hugger Roaster",
      description: "A Hugger has been roasted! 🔥 Check it out",
      type: "website",
      images:
        "https://enzostvs-hugger-roaster.hf.space/api/og/" + params.roastId,
    },
    twitter: {
      title: "Hugger Roaster",
      description: "A Hugger has been roasted! 🔥 Check it out",
      card: "summary_large_image",
      images:
        "https://enzostvs-hugger-roaster.hf.space/api/og/" + params.roastId,
    },
  };
}

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 mb-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>
  );
}