feat(guides): add structured image-first editor
CI / Verify (push) Successful in 1m0s
CI / Build immutable images and deploy (push) Failing after 2m38s

This commit is contained in:
2026-08-29 13:30:52 +00:00 Unverified
parent b8e3b99033
commit dc5c667b4e
36 changed files with 5611 additions and 381 deletions
+11 -16
View File
@@ -1,28 +1,23 @@
import type { Metadata } from "next";
import { notFound, permanentRedirect } from "next/navigation";
import { notFound } from "next/navigation";
import { connection } from "next/server";
import { GuideShell } from "@/components/public/guide-shell";
import { loadPublicPage } from "@/lib/content/loaders";
import { publicSections, StructuredGuideShell } from "@/components/public/structured-guide";
import { getPublicGuide } from "@/lib/guides/queries";
type RouteParams = Promise<{ character: string; page: string }>;
type Params = Promise<{ character: string; page: string }>;
export async function generateMetadata({ params }: { params: RouteParams }): Promise<Metadata> {
export async function generateMetadata({ params }: { params: Params }): Promise<Metadata> {
await connection();
const { character, page } = await params;
const result = await loadPublicPage(character, page);
if (result.type !== "page") return { title: "ไม่พบคู่มือ" };
return {
title: `${result.snapshot.page.title} — ${result.snapshot.character.nameTh}`,
description: result.snapshot.character.description ?? undefined,
};
const guide = await getPublicGuide(character);
return guide ? { title: `${page} — ${guide.name} Build Guide`, description: guide.overview } : { title: "ไม่พบ Guide" };
}
export default async function GuidePage({ params }: { params: RouteParams }) {
export default async function GuideSectionPage({ params }: { params: Params }) {
await connection();
const { character, page } = await params;
const result = await loadPublicPage(character, page);
if (result.type === "redirect") permanentRedirect(result.location);
if (result.type === "not-found") notFound();
return <GuideShell snapshot={result.snapshot} />;
const guide = await getPublicGuide(character);
if (!guide || !publicSections(guide).some((section) => section.slug === page)) notFound();
return <StructuredGuideShell guide={guide} section={page} />;
}
+16 -11
View File
@@ -1,16 +1,21 @@
import { notFound, permanentRedirect } from "next/navigation";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { connection } from "next/server";
import { loadPublicPage } from "@/lib/content/loaders";
import { StructuredGuideShell } from "@/components/public/structured-guide";
import { getPublicGuide } from "@/lib/guides/queries";
export default async function CharacterPage({
params,
}: {
params: Promise<{ character: string }>;
}) {
type Params = Promise<{ character: string }>;
export async function generateMetadata({ params }: { params: Params }): Promise<Metadata> {
await connection();
const { character } = await params;
const result = await loadPublicPage(character);
if (result.type === "redirect") permanentRedirect(result.location);
notFound();
const guide = await getPublicGuide((await params).character);
return guide ? { title: `${guide.name} Build Guide`, description: guide.overview } : { title: "ไม่พบ Guide" };
}
export default async function GuideOverviewPage({ params }: { params: Params }) {
await connection();
const guide = await getPublicGuide((await params).character);
if (!guide) notFound();
return <StructuredGuideShell guide={guide} />;
}