import type { ReactNode } from "react"; import Link from "next/link"; import { ArrowLeftIcon } from "lucide-react"; import Image from "@/components/ui/resilient-image"; import { Button } from "@/components/ui/button"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { SiteHeader } from "@/components/public/site-header"; import { SiteFooter } from "@/components/public/site-footer"; import { ScrollableNav } from "@/components/public/scrollable-nav"; import { LiveRefresh } from "@/components/live-refresh"; import type { PublicGuideSummary } from "@/lib/guides/queries"; import { commentNavigationSection } from "@/lib/comments/navigation"; import { navigationIconPath } from "@/lib/navigation"; import { cn } from "@/lib/utils"; export function publicSectionTitle(slug: string, fallback: string): string { if (slug === "weapon") return "Weapons"; if (slug === "artifact") return "Artifacts"; if (slug === "constellations") return "Constellations"; if (slug === "team") return "Team calc"; if (slug === "comment") return "Comment"; return fallback; } export function GuidePageShell({ guide, sections: guideSections, section, preview = false, children, }: { guide: Pick; sections: Pick[]; section?: string; preview?: boolean; children: ReactNode; }) { const sections = preview ? guideSections : [...guideSections, commentNavigationSection(guide.id)]; const baseHref = preview ? `/admin/${guide.characterKey}/preview` : `/${guide.slug}`; const currentPageTitle = section ? publicSectionTitle(section, sections.find((item) => item.slug === section)?.title ?? section) : "Overview"; return (
{preview ? (
Preview หน้านี้แสดงข้อมูลที่บันทึกล่าสุดและเปิดดูได้เฉพาะผู้ดูแล
) : null}
{guide.name}

{guide.name}

{currentPageTitle}

Overview {sections.map((item) => ( {navigationIconPath(item.slug) ? ( ) : null} {publicSectionTitle(item.slug, item.title)} ))}
{children}
); }