import Image from "next/image"; import Link from "next/link"; import { ArrowUpRightIcon, ChevronLeftIcon } from "lucide-react"; import type { ReactNode } from "react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { SiteFooter } from "@/components/public/site-footer"; import { SiteHeader } from "@/components/public/site-header"; import { ScrollableNav } from "@/components/public/scrollable-nav"; import { TeamArtifactIcon, TeamSearch } from "@/components/public/team-search"; import { GuideImageExport } from "@/components/public/guide-image-export"; import { WeaponImageExport } from "@/components/public/weapon-image-export"; import { ArtifactImageExport } from "@/components/public/artifact-image-export"; import { GuideExportBranding } from "@/components/public/guide-export-branding"; import { ConstellationImage } from "@/components/public/constellation-image"; import { ConditionSwitcher } from "@/components/public/condition-switcher"; import { MaterialPoster } from "@/components/public/material-poster"; import { RichTextContent } from "@/components/rich-text-content"; import { LiveRefresh } from "@/components/live-refresh"; import { rarityGradientClass, rarityTextClass } from "@/lib/catalog/rarity"; import { elementIconFilter } from "@/lib/catalog/element"; import type { PublicGuide } from "@/lib/guides/queries"; import { artifactTierCount } from "@/lib/guides/artifacts"; import { navigationIconPath } from "@/lib/navigation"; import { normalizeTargetStat, recommendedStatElement, recommendedStatIconName, statPriorityColorClass, targetStatIconName, } from "@/lib/guides/stats"; import { normalizeTalentPriorities, talentRelationSymbol, talentTypeLabel, } from "@/lib/guides/talents"; import { parseYouTubeUrl } from "@/lib/guides/youtube"; import { normalizeExtraRichText } from "@/lib/rich-text"; import { cn } from "@/lib/utils"; function hasSection(guide: PublicGuide, slug: string): boolean { if (slug === "weapon") return guide.weapons.length > 0; if (slug === "artifact") return ( guide.artifactGroups.some((group) => group.rows.length > 0) || Boolean( guide.artifactProfile && (guide.artifactProfile.sands.length || guide.artifactProfile.goblet.length || guide.artifactProfile.circlet.length || guide.artifactProfile.substats.length || guide.artifactProfile.targetConditions.some((group) => group.rows.length) || guide.artifactProfile.talents.length), ) ); if (slug === "constellations") return guide.constellationGroups.some((group) => group.rows.length > 0); if (slug === "team") return guide.teams.length > 0; return guide.extras.some( (extra) => extra.slug === slug && extra.rows.length > 0, ); } export function publicSections(guide: PublicGuide) { return guide.sections.filter((section) => hasSection(guide, section.slug)); } function publicSectionTitle(slug: string, fallback: string): string { if (slug === "weapon") return "อาวุธ"; if (slug === "artifact") return "อาร์ติแฟกต์และค่าสถานะ"; if (slug === "constellations") return "กลุ่มดาว"; if (slug === "team") return "คำนวณทีม"; return fallback; } export function StructuredGuideShell({ guide, section, }: { guide: PublicGuide; section?: string; }) { const sections = publicSections(guide); const currentPageTitle = section ? (sections.find((item) => item.slug === section)?.title ?? section) : "Overview"; return (
{guide.name}

{guide.name}

{currentPageTitle}

Overview {sections.map((item) => ( {navigationIconPath(item.slug) ? ( ) : null} {item.title} ))}
{section ? ( ) : ( )}
); } function GuideOverview({ guide, sections, }: { guide: PublicGuide; sections: ReturnType; }) { const youtubeVideos = guide.youtubeUrls.flatMap((url) => { const video = parseYouTubeUrl(url); return video ? [video] : []; }); return (

ภาพรวมแนวทาง

{guide.name}

{guide.overview}

{`ไกด์
{guide.posterArtUrl || youtubeVideos.length ? ( <> {guide.posterArtUrl ? (
) : null} {youtubeVideos.length ? (
{youtubeVideos.map((youtubeVideo, index) => (