fp/services/next/app/page.tsx

94 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-01-20 16:16:14 +00:00
2024-07-10 22:11:18 +00:00
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";
2024-07-15 16:07:04 +00:00
import { IVtuber } from '@futureporn/types';
2024-07-10 22:11:18 +00:00
import { getVtubers } from "./lib/vtubers";
2024-01-20 16:16:14 +00:00
import VTuberCard from "./components/vtuber-card";
import Link from 'next/link';
import { notFound } from "next/navigation";
2024-11-05 19:48:21 +00:00
// import { getLogtoContext, signIn, signOut } from '@logto/next/server-actions';
// import SignIn from './sign-in';
// import SignOut from './sign-out';
// import { logtoConfig } from './logto';
2024-01-20 16:16:14 +00:00
export default async function Page() {
2024-11-05 19:48:21 +00:00
// const { isAuthenticated, claims } = await getLogtoContext(logtoConfig);
2024-01-20 16:16:14 +00:00
const vods = await getVods(1, 9, true);
2024-07-10 22:11:18 +00:00
// console.log('vods as follows')
// console.log(JSON.stringify(vods, null, 2))
2024-07-04 21:20:29 +00:00
2024-01-20 16:16:14 +00:00
const vtubers = await getVtubers();
2024-11-05 19:48:21 +00:00
// if (!vtubers) notFound();
2024-07-10 22:11:18 +00:00
// console.log(`vtubers as follows`)
// console.log(JSON.stringify(vtubers, null, 2))
2024-07-04 21:20:29 +00:00
2024-01-20 16:16:14 +00:00
// return (
// <pre>
// <code>
2024-11-05 19:48:21 +00:00
// {JSON.stringify(vods, null, 2)}
2024-01-20 16:16:14 +00:00
// </code>
// </pre>
// )
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>
2024-03-29 07:28:02 +00:00
<FundingGoal />
2024-01-20 16:16:14 +00:00
2024-11-05 19:48:21 +00:00
<Link href={'/auth'}>Login</Link>
2024-03-29 07:28:02 +00:00
<div className="section">
2024-01-20 16:16:14 +00:00
<h2 className="is-2 title">Latest VODs</h2>
<div className="columns is-multiline is-mobile">
2024-11-05 19:48:21 +00:00
{!vods?.data && <div className="section"><p>Error: Failed to fetch VODs from the database</p></div> }
{vods && vods.map((vod: IVod) => (
2024-01-20 16:16:14 +00:00
<VodCard
key={vod.id}
id={vod.id}
title={getVodTitle(vod)}
2024-11-05 19:48:21 +00:00
date={vod.date}
muxAsset={vod.mux_asset?.asset_id}
vtuber={vod?.vtuber}
thumbnail={vod.thumbnail}
2024-01-20 16:16:14 +00:00
/>
))}
</div>
<Link className='button' href={`/latest-vods/1`}>See all Latest Vods</Link>
2024-03-29 07:28:02 +00:00
</div>
<div className="section">
2024-01-20 16:16:14 +00:00
<h2 className="is-2 title">VTubers</h2>
2024-03-29 07:28:02 +00:00
<nav className="columns is-multiline">
2024-01-20 16:16:14 +00:00
{vtubers.data.map((vtuber: IVtuber) =>
<VTuberCard key={vtuber.id} {...vtuber} />
)}
2024-03-29 07:28:02 +00:00
</nav>
</div>
2024-01-20 16:16:14 +00:00
</div>
</>
);
}