feat(guides): autosave structured guide data
CI / Verify (push) Successful in 57s
CI / Build immutable images and deploy (push) Successful in 3m10s

This commit is contained in:
2026-08-29 18:13:02 +00:00 Unverified
parent c4fcf3f996
commit ac9a733370
14 changed files with 3794 additions and 68 deletions
+45
View File
@@ -0,0 +1,45 @@
import * as z from "zod";
export interface CatalogConstellation {
level: number;
name: string;
description: string;
iconKey: string | null;
}
const constellationSchema = z.object({
name: z.string(),
description: z.string(),
icon: z.string(),
});
export const characterDetailSchema = z.object({
constellations: z.record(z.string(), constellationSchema),
});
export function cleanLunarisText(value: string): string {
return value
.replace(/\{\/?LINK[^}]*\}/gu, "")
.replace(/<\/?color(?:=[^>]*)?>/gu, "")
.replace(/^"|"$/gu, "")
.trim();
}
export function constellationSnapshot(
value: z.infer<typeof characterDetailSchema>,
iconKey: (icon: string) => string,
): CatalogConstellation[] {
const result: CatalogConstellation[] = [];
for (const index of Array.from({ length: 6 }, (_, itemIndex) => itemIndex)) {
const level = index + 1;
const item = value.constellations[`const${level}`];
if (!item) continue;
result.push({
level,
name: cleanLunarisText(item.name),
description: cleanLunarisText(item.description),
iconKey: iconKey(item.icon),
});
}
return result;
}