Fix learn 404, coin animation, full regions, and AI key errors.

Use numeric /learn/{num} routes, register Tailwind coin animations with方孔铜钱 UI, expand to 34 provinces, and surface missing OPENAI_API_KEY clearly.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-10 21:32:20 +08:00
parent 96b659fbe5
commit a487b17165
15 changed files with 931 additions and 159 deletions
+15
View File
@@ -21,6 +21,21 @@ export async function listGuaMarks(
.sort();
}
/** 序号 slug,如 "35" */
export function guaNumFromMark(guaMark: string): string {
return guaMark.split(".")[0];
}
/** 由序号解析目录名,如 "35" → "35.火地晋" */
export async function markFromNum(
num: string,
variant: LearnVariant = "traditional",
): Promise<string | null> {
const padded = num.padStart(2, "0").slice(-2);
const marks = await listGuaMarks(variant);
return marks.find((m) => m.startsWith(`${padded}.`)) ?? null;
}
export async function readGuaMarkdown(guaMark: string): Promise<string> {
const filePath = path.join(DOCS_ROOT, guaMark, "index.md");
return fs.readFile(filePath, "utf-8");