mirror of
https://github.com/Radiquum/AniX.git
synced 2025-05-03 11:29:40 +05:00
feat: add titles to metadata
This commit is contained in:
parent
751b61668f
commit
0ee1139cf1
8 changed files with 310 additions and 269 deletions
54
app/pages/Index.jsx
Normal file
54
app/pages/Index.jsx
Normal file
|
@ -0,0 +1,54 @@
|
|||
"use client";
|
||||
import useSWR from "swr";
|
||||
import { ReleaseCourusel } from "@/app/components/ReleaseCourusel/ReleaseCourusel";
|
||||
import { Spinner } from "@/app/components/Spinner/Spinner";
|
||||
const fetcher = (...args) => fetch(...args).then((res) => res.json());
|
||||
|
||||
export function IndexPage() {
|
||||
function useFetchReleases(status) {
|
||||
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
|
||||
return [data];
|
||||
}
|
||||
|
||||
const [lastReleasesData] = useFetchReleases("last");
|
||||
const [finishedReleasesData] = useFetchReleases("finished");
|
||||
const [ongoingReleasesData] = useFetchReleases("ongoing");
|
||||
const [announceReleasesData] = useFetchReleases("announce");
|
||||
|
||||
return (
|
||||
<main className="flex flex-col pt-2 pb-16 sm:pt-4 sm:pb-0">
|
||||
{lastReleasesData ? (
|
||||
<ReleaseCourusel
|
||||
sectionTitle="Последние релизы"
|
||||
showAllLink="/home/last"
|
||||
content={lastReleasesData.content}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center justify-center min-w-full min-h-screen">
|
||||
<Spinner />
|
||||
</div>
|
||||
)}
|
||||
{finishedReleasesData && (
|
||||
<ReleaseCourusel
|
||||
sectionTitle="Завершенные релизы"
|
||||
showAllLink="/home/finished"
|
||||
content={finishedReleasesData.content}
|
||||
/>
|
||||
)}
|
||||
{ongoingReleasesData && (
|
||||
<ReleaseCourusel
|
||||
sectionTitle="В эфире"
|
||||
showAllLink="/home/ongoing"
|
||||
content={ongoingReleasesData.content}
|
||||
/>
|
||||
)}
|
||||
{announceReleasesData && (
|
||||
<ReleaseCourusel
|
||||
sectionTitle="Анонсированные релизы"
|
||||
showAllLink="/home/announce"
|
||||
content={announceReleasesData.content}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue