From 4fe7171bbf3ed2c5544bffbd573ec12162a7e244 Mon Sep 17 00:00:00 2001 From: Sivert Date: Mon, 5 Oct 2026 18:32:16 +0200 Subject: [PATCH] Keep a card's short banner choice (GRYT-1665) Card styles can carry bannerSize: "short" now, and the server kept only the fields it knew, so the choice would have been dropped on save. Tall is the default and is left out, like every other default. Co-Authored-By: Claude Opus 5.5 --- src/utils/memberCard.test.ts | 8 ++++++++ src/utils/memberCard.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/utils/memberCard.test.ts b/src/utils/memberCard.test.ts index 56c1db83..8d7dbe86 100644 --- a/src/utils/memberCard.test.ts +++ b/src/utils/memberCard.test.ts @@ -184,6 +184,14 @@ describe("the banner's fade", () => { }); }); +describe("the banner's height", () => { + it("keeps the short banner and leaves out the tall one", () => { + assert.deepEqual(normaliseCardStyle({ bannerSize: "short" }), { bannerSize: "short" }); + assert.equal(normaliseCardStyle({ bannerSize: "tall" }), null); + assert.equal(normaliseCardStyle({ bannerSize: true }), null); + }); +}); + describe("the plain card as a choice", () => { it("is kept when it is the whole style, so it isn't read as no card", () => { assert.deepEqual(normaliseCardStyle({ plain: true }), { plain: true }); diff --git a/src/utils/memberCard.ts b/src/utils/memberCard.ts index 29031b0f..f73914c0 100644 --- a/src/utils/memberCard.ts +++ b/src/utils/memberCard.ts @@ -47,6 +47,8 @@ export interface CardStyle { pLayer?: "front"; /** The card's outline in pixels. Leaves out its default (1). */ edge?: number; + /** "short" draws the banner at its low height. Absent is tall; the stored banner box doesn't change. */ + bannerSize?: "short"; /** The plain card as a choice. With no style at all, apps draw one worked out from the member's name. */ plain?: true; } @@ -124,6 +126,7 @@ export function normaliseCardStyle(value: unknown): CardStyle | null { if (raw.pLayer === "front") out.pLayer = "front"; const edge = readInt(raw.edge, 0, 6); if (edge !== undefined && edge !== 1) out.edge = edge; + if (raw.bannerSize === "short") out.bannerSize = "short"; // Only when nothing else is set: with a colour or a pattern the card isn't plain. if (raw.plain === true && Object.keys(out).length === 0) out.plain = true;