Files
buzz-sheet/lib/templates/built-in.ts
T

311 lines
11 KiB
TypeScript

import type { TemplateBlueprint } from "./types";
const comparisonFields = [
{ key: "name", label: "ชื่อ", type: "text" as const },
{ key: "base", label: "ค่าพื้นฐาน", type: "number" as const, displayPrecision: 0 },
{ key: "bonus", label: "โบนัส", type: "number" as const, displayPrecision: 0 },
{ key: "cost", label: "ต้นทุน", type: "number" as const, displayPrecision: 0 },
{
key: "score",
label: "คะแนนเปรียบเทียบ",
type: "number" as const,
formula: "(base + bonus) / cost",
displayPrecision: 2,
},
];
export const builtInTemplates: readonly TemplateBlueprint[] = [
{
slug: "classic-character-guide",
name: "คู่มือตัวละครแบบคลาสสิก",
description: "โครงสร้างหลายหน้าสำหรับข้อมูล บิลด์ ทีม และคำอธิบายเชิงลึก",
category: "character-guide",
builtIn: true,
dataSources: [
{
key: "weapons",
name: "อันดับอาวุธ",
fields: comparisonFields,
},
{
key: "teams",
name: "ทีมแนะนำ",
fields: [
{ key: "team", label: "ทีม", type: "text" },
{ key: "member_1", label: "สมาชิก 1", type: "text" },
{ key: "member_2", label: "สมาชิก 2", type: "text" },
{ key: "member_3", label: "สมาชิก 3", type: "text" },
{ key: "member_4", label: "สมาชิก 4", type: "text" },
{ key: "notes", label: "หมายเหตุ", type: "text" },
],
},
],
pages: [
{
slug: "info",
title: "ข้อมูล",
blocks: [
{
type: "profile",
config: {
eyebrow: "ภาพรวมตัวละคร",
title: "ชื่อตัวละคร",
summary: "เพิ่มบทบาท จุดเด่น และแนวทางใช้งาน",
badges: [],
},
},
{
type: "section",
config: { title: "จุดเด่น", anchor: "highlights" },
},
{
type: "rich-text",
config: { content: [{ type: "paragraph", text: "เริ่มเขียนคำแนะนำที่นี่" }] },
},
],
},
{
slug: "build",
title: "บิลด์",
blocks: [
{
type: "ranking",
config: {
title: "อันดับอาวุธ",
dataSourceId: "@source:weapons",
labelField: "name",
valueField: "score",
detailField: "notes",
higherIsBetter: true,
},
},
],
},
{
slug: "teams",
title: "ทีม",
blocks: [
{
type: "team-composition",
config: {
title: "ทีมแนะนำ",
dataSourceId: "@source:teams",
teamField: "team",
memberFields: ["member_1", "member_2", "member_3", "member_4"],
notesField: "notes",
},
},
],
},
],
},
{
slug: "combo-rotation-guide",
name: "คู่มือคอมโบและโรเทชัน",
description: "ขั้นตอนคอมโบตามลำดับ พร้อมผู้ใช้สกิล เวลา และคำอธิบายเสริม",
category: "rotation",
builtIn: true,
dataSources: [],
pages: [
{
slug: "combo",
title: "คอมโบ",
blocks: [
{
type: "callout",
config: {
title: "ก่อนเริ่ม",
body: "ระบุเงื่อนไขและทรัพยากรที่ต้องเตรียม",
tone: "tip",
},
},
{
type: "rotation",
config: {
title: "ลำดับการเล่น",
steps: [
{
id: "@id:rotation-step-1",
actor: "ตัวละคร A",
action: "เริ่มต้นด้วยสกิล",
detail: "อธิบายเหตุผลและจังหวะสลับตัว",
},
],
},
},
],
},
],
},
{
slug: "combined-one-page-build",
name: "บิลด์รวมหน้าเดียว",
description: "สรุปโปรไฟล์ ค่าสำคัญ อันดับอุปกรณ์ และทีมในหน้าเดียว",
category: "one-page",
builtIn: true,
dataSources: [
{ key: "builds", name: "ตัวเลือกบิลด์", fields: comparisonFields },
],
pages: [
{
slug: "guide",
title: "คู่มือ",
blocks: [
{
type: "profile",
config: { title: "ชื่อตัวละคร", summary: "สรุปแนวทางการเล่น", badges: [] },
},
{
type: "stat-cards",
config: {
title: "เป้าหมายค่าสถานะ",
items: [
{ id: "@id:stat-1", label: "ค่าสำคัญ", value: "—" },
{ id: "@id:stat-2", label: "ค่ารอง", value: "—" },
],
},
},
{
type: "comparison-chart",
responsiveLayout: { width: "wide" },
config: {
title: "เปรียบเทียบบิลด์",
dataSourceId: "@source:builds",
categoryField: "name",
series: [{ field: "score", label: "คะแนน", color: "chart-1" }],
presentation: "horizontal-bar",
normalization: "raw",
sort: "descending",
showValues: true,
showLegend: false,
tableFallback: true,
},
},
],
},
],
},
{
slug: "multi-role-reaction-build",
name: "บิลด์หลายบทบาทและปฏิกิริยา",
description: "แยกแนวทางตามบทบาทหรือปฏิกิริยาด้วยแท็บที่อ่านง่าย",
category: "multi-role",
builtIn: true,
dataSources: [],
pages: [
{
slug: "roles",
title: "บทบาท",
blocks: [
{
type: "profile",
config: { title: "ชื่อตัวละคร", summary: "เลือกแนวทางตามทีม", badges: [] },
},
{
type: "tabs",
config: {
title: "แนวทางบิลด์",
tabs: [
{ id: "@id:role-1", label: "บทบาทหลัก", content: "อธิบายบิลด์สำหรับบทบาทหลัก" },
{ id: "@id:role-2", label: "บทบาทรอง", content: "อธิบายบิลด์สำหรับบทบาทรอง" },
],
},
},
{
type: "accordion",
config: {
title: "รายละเอียดปฏิกิริยา",
items: [
{ id: "@id:reaction-1", title: "ปฏิกิริยาที่ 1", content: "เพิ่มเงื่อนไขและข้อควรระวัง" },
],
},
},
],
},
],
},
{
slug: "categorized-team-database",
name: "ฐานข้อมูลทีมแบบหมวดหมู่",
description: "ตารางทีมที่กรองตามหมวด พร้อมรายละเอียดสมาชิกและผลรวม",
category: "teams",
builtIn: true,
dataSources: [
{
key: "team-database",
name: "ฐานข้อมูลทีม",
fields: [
{ key: "category", label: "หมวด", type: "badge" },
{ key: "team", label: "ชื่อทีม", type: "text" },
{ key: "members", label: "สมาชิก", type: "text" },
{ key: "score", label: "คะแนน", type: "number", displayPrecision: 1 },
{ key: "notes", label: "หมายเหตุ", type: "text" },
],
},
],
pages: [
{
slug: "teams",
title: "ฐานข้อมูลทีม",
blocks: [
{ type: "section", config: { title: "ค้นหาทีมที่เหมาะกับคุณ", anchor: "teams" } },
{
type: "table",
responsiveLayout: { width: "wide" },
config: {
dataSourceId: "@source:team-database",
columns: [
{ field: "category", label: "หมวด", align: "start" },
{ field: "team", label: "ทีม", align: "start" },
{ field: "members", label: "สมาชิก", align: "start" },
{ field: "score", label: "คะแนน", align: "end" },
],
},
},
],
},
],
},
{
slug: "calculation-comparison-guide",
name: "คู่มือเปรียบเทียบด้วยการคำนวณ",
description: "ข้อมูลดิบ สูตรเลขคณิตแบบจำกัด กราฟ และตารางสำรองที่เข้าถึงได้",
category: "calculation",
builtIn: true,
dataSources: [
{ key: "comparison", name: "ข้อมูลเปรียบเทียบ", fields: comparisonFields },
],
pages: [
{
slug: "comparison",
title: "เปรียบเทียบ",
blocks: [
{
type: "callout",
config: { body: "ผลลัพธ์คำนวณจากค่าที่ผู้เขียนกำหนด", tone: "info" },
},
{
type: "comparison-chart",
responsiveLayout: { width: "wide" },
config: {
title: "ผลการเปรียบเทียบ",
dataSourceId: "@source:comparison",
categoryField: "name",
series: [
{ field: "base", label: "ค่าพื้นฐาน", color: "chart-2" },
{ field: "score", label: "คะแนน", color: "chart-1" },
],
presentation: "grouped-bar",
normalization: "raw",
sort: "descending",
showValues: true,
showLegend: true,
tableFallback: true,
},
},
],
},
],
},
] as const;