fp/services/next/app/page.tsx

77 lines
2.2 KiB
TypeScript

import FundingGoal from "@/app/components/funding-goal";
import VodCard from "@/app/components/vod-card";
import { getVodTitle } from "@/app/components/vod-page";
import { getVods } from '@/app/lib/vods';
import { IVod } from "@/app/lib/vods";
import { IVtuber } from '@futureporn/types';
import { getVtubers } from "./lib/vtubers";
import VTuberCard from "./components/vtuber-card";
import Link from 'next/link';
import { notFound } from "next/navigation";
import { ErrorCard } from "./components/error-card";
export default async function Page() {
const { vods, count } = await getVods(1, 9, true);
const vtubers = await getVtubers();
return (
<>
<div className="main">
<section className="section">
<div className="container">
<h1 className="title">
The Galaxy&apos;s Best VTuber Hentai Site
</h1>
<h2 className="subtitle">For adults only (NSFW)</h2>
</div>
</section>
<FundingGoal />
<div className="section">
<h2 className="is-2 title">Latest VODs</h2>
<div className="columns is-multiline is-mobile">
{!vods && <div className="section"><p>Error: Failed to fetch VODs from the database</p></div> }
{vods && vods.map((vod: IVod) => (
<VodCard
key={vod.id}
id={vod.id}
title={getVodTitle(vod)}
date={vod.date}
muxAsset={vod.mux_asset?.asset_id}
vtuber={vod?.vtuber}
thumbnail={vod?.thumbnail?.cdn_url}
/>
))}
</div>
<Link className='button' href={`/latest-vods/1`}>See all Latest Vods</Link>
</div>
<div className="section">
<h2 className="is-2 title">VTubers</h2>
<nav className="columns is-multiline">
{!vtubers
? <ErrorCard message="Failed to fetch vtubers. Please try again."></ErrorCard>
: vtubers.map((vtuber: IVtuber) =>
<VTuberCard key={vtuber.id} {...vtuber} />
)
}
</nav>
</div>
</div>
</>
);
}