update
This commit is contained in:
@@ -13,7 +13,7 @@ import { getAdminSession } from "@/lib/auth/server";
|
||||
import {
|
||||
getActiveCatalog,
|
||||
getAdminGuideContent,
|
||||
getGuideByCharacterKey,
|
||||
getGuideEditorHeader,
|
||||
} from "@/lib/guides/queries";
|
||||
|
||||
const sections = [
|
||||
@@ -33,7 +33,7 @@ export default async function StructuredEditorPage({
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/admin/login");
|
||||
const { character, page } = await params;
|
||||
const guide = await getGuideByCharacterKey(character);
|
||||
const guide = await getGuideEditorHeader(character);
|
||||
if (!guide) notFound();
|
||||
const extraSections = guide.sections.filter((section) => section.kind === "extra");
|
||||
if (page === "extra") {
|
||||
|
||||
@@ -55,7 +55,7 @@ export default async function GuideOverviewPage({ params }: { params: Promise<{
|
||||
<GuideOverviewForm guide={guide} />
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{sections.map(({ slug, title, description }) => (
|
||||
<Link key={slug} href={`/admin/${guide.characterKey}/${slug}`} prefetch className="rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<Link key={slug} href={`/admin/${guide.characterKey}/${slug}`} prefetch={false} className="rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<Card className="h-full transition-colors hover:bg-muted/50">
|
||||
<CardHeader>
|
||||
{navigationIconPath(slug) ? <Image src={navigationIconPath(slug)!} alt="" width={40} height={40} className="size-10 object-contain" /> : null}
|
||||
|
||||
+9
-6
@@ -4,17 +4,20 @@ import { connection } from "next/server";
|
||||
import { StructuredDashboard } from "@/components/admin/structured-dashboard";
|
||||
import { AdminHeader } from "@/components/admin/admin-header";
|
||||
import { getAdminSession } from "@/lib/auth/server";
|
||||
import { getLatestLunarisVersion } from "@/lib/catalog/sync";
|
||||
import { getActiveCatalog, listGuideCards } from "@/lib/guides/queries";
|
||||
import {
|
||||
getCurrentCatalogVersion,
|
||||
getLatestLunarisVersion,
|
||||
} from "@/lib/catalog/sync";
|
||||
import { listGuideCards } from "@/lib/guides/queries";
|
||||
|
||||
export default async function AdminPage() {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/admin/login");
|
||||
const [guides, trash, catalog, latestCatalogVersion] = await Promise.all([
|
||||
const [guides, trash, catalogVersion, latestCatalogVersion] = await Promise.all([
|
||||
listGuideCards(),
|
||||
listGuideCards(true),
|
||||
getActiveCatalog(),
|
||||
getLatestLunarisVersion().catch(() => null),
|
||||
getCurrentCatalogVersion(),
|
||||
getLatestLunarisVersion(AbortSignal.timeout(3_000)).catch(() => null),
|
||||
]);
|
||||
return (
|
||||
<div className="min-h-svh">
|
||||
@@ -25,7 +28,7 @@ export default async function AdminPage() {
|
||||
<h1 className="font-heading text-3xl font-semibold">Guide Dashboard</h1>
|
||||
<p className="mt-2 text-muted-foreground">จัดการ Guide แบบภาพ-first และบันทึกขึ้นเว็บไซต์ทันที</p>
|
||||
</header>
|
||||
<StructuredDashboard guides={guides} trash={trash} catalogVersion={catalog?.version ?? null} latestCatalogVersion={latestCatalogVersion} />
|
||||
<StructuredDashboard guides={guides} trash={trash} catalogVersion={catalogVersion} latestCatalogVersion={latestCatalogVersion} />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user