feat : update

This commit is contained in:
2026-09-30 19:34:28 +07:00 Unverified
parent 69a4d34b97
commit da3d7d84ac
30 changed files with 10724 additions and 883 deletions
+14 -5
View File
@@ -1,3 +1,4 @@
import Link from "next/link";
import { connection } from "next/server";
import { SiteFooter } from "@/components/public/site-footer";
@@ -5,14 +6,20 @@ import { SiteHeader } from "@/components/public/site-header";
import { StygianGuide } from "@/components/public/stygian-guide";
import { LiveRefresh } from "@/components/live-refresh";
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { getCachedActiveStygianSchedule } from "@/lib/cache/stygian";
import { Button } from "@/components/ui/button";
import { getCachedStygianSchedule, getCachedStygianSchedules } from "@/lib/cache/stygian";
import { getActiveCatalog } from "@/lib/guides/queries";
export const instant = false;
export default async function StygianPage() {
export default async function StygianPage({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {
await connection();
const [schedule, catalog] = await Promise.all([getCachedActiveStygianSchedule(), getActiveCatalog()]);
const query = await searchParams;
const schedules = await getCachedStygianSchedules();
const rawSchedule = Array.isArray(query.schedule) ? query.schedule[0] : query.schedule;
const requestedId = Number(rawSchedule);
const selectedId = schedules.some((entry) => entry.scheduleId === requestedId) ? requestedId : schedules[0]?.scheduleId;
const [schedule, catalog] = await Promise.all([selectedId ? getCachedStygianSchedule(selectedId) : null, getActiveCatalog()]);
return (
<div className="flex min-h-svh flex-col bg-background">
<LiveRefresh endpoint="/api/events/stygian" />
@@ -21,10 +28,12 @@ export default async function StygianPage() {
<header>
<p className="text-sm font-medium text-primary">Stygian Onslaught</p>
<h1 className="font-heading text-4xl font-semibold">Stygian Guide</h1>
{schedule ? <p className="mt-2 text-muted-foreground">Version {schedule.challengeName} · Schedule {schedule.scheduleId}</p> : null}
</header>
{schedules.length ? <nav className="flex flex-wrap gap-2" aria-label="Stygian versions">{schedules.map((entry) => entry.scheduleId === selectedId
? <Button key={entry.scheduleId} disabled variant="secondary" size="sm">{entry.challengeName}</Button>
: <Button key={entry.scheduleId} variant="outline" size="sm" nativeButton={false} render={<Link href={`/stygian?schedule=${entry.scheduleId}`} />}>{entry.challengeName}</Button>)}</nav> : null}
{schedule && catalog ? <StygianGuide schedule={schedule} catalog={catalog} /> : (
<Empty className="border"><EmptyHeader><EmptyTitle>Stygian Guide is not published yet</EmptyTitle><EmptyDescription>An administrator must sync and activate a schedule first.</EmptyDescription></EmptyHeader></Empty>
<Empty className="border"><EmptyHeader><EmptyTitle>No Stygian versions yet</EmptyTitle><EmptyDescription>An administrator must sync the Lunaris archive first.</EmptyDescription></EmptyHeader></Empty>
)}
</main>
<SiteFooter />