mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
feat(notices): add the 4.0.0 release modal
The thank-you modal was one column of markdown for every notice. A release needs more room than that: what shipped, and why it took what it took. Adds a `release` block to the notice contract. A notice carrying it renders through ReleaseNoticeModal instead of the generic body — the release on the left, the note from the maintainer on the right, both halves driven entirely by translation keys so the next release only edits the registry entry. Sizing lives on one CSS variable (--rn-s), so the panel scales as a piece and the design's proportions hold at every breakpoint. The thank-you notice gets maxVersion 4.0.0: from there on the release modal carries the same thank-you and the same two support links, and installs still on 3.x keep the old one. All 23 locales.
This commit is contained in:
@@ -52,6 +52,73 @@ describe('systemNoticeDtoSchema', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts a release notice and keeps its optional pieces optional', () => {
|
||||
const base = {
|
||||
id: 'release-4-0-0',
|
||||
display: 'modal' as const,
|
||||
severity: 'info' as const,
|
||||
titleKey: 't',
|
||||
bodyKey: 'b',
|
||||
dismissible: true,
|
||||
release: {
|
||||
version: '4.0.0',
|
||||
eyebrowKey: 'e',
|
||||
tagKey: 'tag',
|
||||
headlineKey: 'h',
|
||||
introKey: 'i',
|
||||
features: [
|
||||
{ iconName: 'Smartphone', titleKey: 'f1t', bodyKey: 'f1b' },
|
||||
{ iconName: 'BookOpen', titleKey: 'f2t', bodyKey: 'f2b', badgeKey: 'beta' },
|
||||
],
|
||||
note: {
|
||||
eyebrowKey: 'ne',
|
||||
titleKey: 'nt',
|
||||
bodyKey: 'nb',
|
||||
promiseLabelKey: 'pl',
|
||||
promiseTextKey: 'pt',
|
||||
bodyAfterKey: 'nba',
|
||||
closingKey: 'nc',
|
||||
signatureKey: 'ns',
|
||||
},
|
||||
supportTextKey: 's',
|
||||
},
|
||||
};
|
||||
expect(systemNoticeDtoSchema.safeParse(base).success).toBe(true);
|
||||
|
||||
const withExtras = {
|
||||
...base,
|
||||
release: {
|
||||
...base.release,
|
||||
stats: [{ value: '~150', labelKey: 'bugs' }],
|
||||
notes: { labelKey: 'notes', href: 'https://example.test' },
|
||||
footnoteKey: 'fn',
|
||||
},
|
||||
};
|
||||
expect(systemNoticeDtoSchema.safeParse(withExtras).success).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects a release block missing the maintainer note', () => {
|
||||
expect(
|
||||
systemNoticeDtoSchema.safeParse({
|
||||
id: 'release-x',
|
||||
display: 'modal',
|
||||
severity: 'info',
|
||||
titleKey: 't',
|
||||
bodyKey: 'b',
|
||||
dismissible: true,
|
||||
release: {
|
||||
version: '4.0.0',
|
||||
eyebrowKey: 'e',
|
||||
tagKey: 'tag',
|
||||
headlineKey: 'h',
|
||||
introKey: 'i',
|
||||
features: [],
|
||||
supportTextKey: 's',
|
||||
},
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects an unknown display value and a malformed CTA', () => {
|
||||
expect(
|
||||
systemNoticeDtoSchema.safeParse({
|
||||
|
||||
@@ -42,6 +42,52 @@ const noticeCtaSchema = z.discriminatedUnion('kind', [
|
||||
}),
|
||||
]);
|
||||
|
||||
/** One "what changed" row in the release panel: icon, headline, prose, optional badge. */
|
||||
const noticeReleaseFeatureSchema = z.object({
|
||||
iconName: z.string(),
|
||||
titleKey: z.string(),
|
||||
bodyKey: z.string(),
|
||||
badgeKey: z.string().optional(),
|
||||
});
|
||||
|
||||
/** A number worth stating next to the release — the figure itself is not translated. */
|
||||
const noticeReleaseStatSchema = z.object({
|
||||
value: z.string(),
|
||||
labelKey: z.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* The release layout: a two-column modal, the release on the left and a note
|
||||
* from the maintainer on the right. A notice carrying this renders through
|
||||
* ReleaseNoticeModal instead of the generic notice body, so every string it
|
||||
* shows lives here rather than inside the component.
|
||||
*/
|
||||
const noticeReleaseSchema = z.object({
|
||||
/** Shown as the display figure ("4.0.0") — a version string, not a semver gate. */
|
||||
version: z.string(),
|
||||
eyebrowKey: z.string(),
|
||||
tagKey: z.string(),
|
||||
headlineKey: z.string(),
|
||||
introKey: z.string(),
|
||||
features: z.array(noticeReleaseFeatureSchema),
|
||||
stats: z.array(noticeReleaseStatSchema).optional(),
|
||||
notes: z.object({ labelKey: z.string(), href: z.string() }).optional(),
|
||||
footnoteKey: z.string().optional(),
|
||||
note: z.object({
|
||||
eyebrowKey: z.string(),
|
||||
titleKey: z.string(),
|
||||
/** Markdown paragraphs above the promise box. */
|
||||
bodyKey: z.string(),
|
||||
promiseLabelKey: z.string(),
|
||||
promiseTextKey: z.string(),
|
||||
/** Markdown paragraphs below the promise box. */
|
||||
bodyAfterKey: z.string(),
|
||||
closingKey: z.string(),
|
||||
signatureKey: z.string(),
|
||||
}),
|
||||
supportTextKey: z.string(),
|
||||
});
|
||||
|
||||
/** The client-facing notice (server-evaluated; conditions/versioning stripped). */
|
||||
export const systemNoticeDtoSchema = z.object({
|
||||
id: z.string(),
|
||||
@@ -57,5 +103,6 @@ export const systemNoticeDtoSchema = z.object({
|
||||
secondaryCta: noticeCtaSchema.optional(),
|
||||
desktopOnly: z.boolean().optional(),
|
||||
dismissible: z.boolean(),
|
||||
release: noticeReleaseSchema.optional(),
|
||||
});
|
||||
export type SystemNoticeDto = z.infer<typeof systemNoticeDtoSchema>;
|
||||
|
||||
Reference in New Issue
Block a user