"use client"; import { useState } from "react"; import Image from "next/image"; import classNames from "classnames"; import satori from "satori"; import { roast } from "@/app/actions/roast"; import { share, ShareProps } from "@/app/actions/share"; import { Form, FormProps } from "@/components/form"; import { CopyToClipboard } from "@/components/copy"; import { Quote } from "@/components/quote"; import Logo from "@/assets/logo.svg"; export default function Home() { const [data, setData] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const [loadingShare, setLoadingShare] = useState(false); const [hfUser, setHfUser] = useState(undefined); const [quote, setQuote] = useState(undefined); const handleRoast = async (form: FormProps) => { setError(""); setData(""); setLoading(true); const res: { error?: string; data?: any; } = await roast(form); if (res.error) { setError(res.error); } else { setQuote(undefined); setHfUser(form.username); setData(res?.data); } setLoading(false); }; const handleShare = async (form: ShareProps) => { setLoadingShare(true); const res = await share({ hf_user: form.hf_user, text: form.text }); if (res?.data) { setQuote(res.data.id); } setLoadingShare(false); }; return ( <>
logo hugging face

Give some love to your favorite Hugging Face user! ❤️

{error && (

Oops!

{error}
)}
{data && ( {quote ? ( ) : ( )} )} ); }