fix(extra) : show text colors and catalog items
CI / Verify (push) Successful in 1m4s
CI / Build immutable images and deploy (push) Successful in 2m4s

This commit is contained in:
2026-09-05 13:09:55 +07:00 Unverified
parent a4ecdf4fff
commit 86882dc338
6 changed files with 91 additions and 7 deletions
+3 -1
View File
@@ -146,15 +146,17 @@ describe("structured guide validation", () => {
body: "First line\nSecond line",
percent: null,
};
const input = (style: { backgroundColor: string | null; highlights: Array<{ text: string; color: string }> }) => ({
const input = (style: { backgroundColor: string | null; textColor?: string | null; highlights: Array<{ text: string; color: string }> }) => ({
expectedVersion: 1,
sections: [{ title: "Extra", rows: [{ ...row, ...style }] }],
});
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [] })).success).toBe(true);
expect(extraSectionSchema.safeParse(input({ backgroundColor: "#24232C", textColor: "#FAFAFA", highlights: [] })).success).toBe(true);
expect(extraSectionSchema.safeParse(input({ backgroundColor: "#24232C", highlights: [{ text: "MASSIVE", color: "#FF0000" }] })).success).toBe(true);
expect(extraSectionSchema.safeParse({ expectedVersion: 1, sections: [{ title: "Extra", rows: [row] }] }).success).toBe(true);
expect(extraSectionSchema.safeParse(input({ backgroundColor: "red", highlights: [] })).success).toBe(false);
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, textColor: "white", highlights: [] })).success).toBe(false);
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [{ text: "MASSIVE", color: "red" }] })).success).toBe(false);
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [{ text: "MASSIVE", color: "#FF0000" }, { text: "MASSIVE", color: "#00FF00" }] })).success).toBe(false);
});
+1
View File
@@ -140,6 +140,7 @@ const extraRowSchema = z.strictObject({
body: z.string().trim().max(10_000),
percent: percent.nullable(),
backgroundColor: hexColor.nullable().default(null),
textColor: hexColor.nullable().default(null),
catalogItems: z.array(z.strictObject({
kind: z.enum(["character", "weapon", "artifact"]),
key: z.string().trim().min(1).max(64),