feat(notices): bring the release notes back on every update

The release modal takes the 4.3.0 design: the release and its headline cards
on the left, the note and the support links on the right, at the design's own
size. The cards carry small drawings of the features instead of an icon.

The 4.0.0 entry is retired. In its place sits one entry, release-notes, that
every big release rewrites and keeps. It recurs per version with no upper
bound, so every user sees it once on each update, whatever they did with it
before, and a reload of the same version keeps it closed. An integration test
holds that promise through the real entry and the real dismiss route.

All 23 locales carry the new copy and drop the 4.0.0 strings.
This commit is contained in:
Maurice
2026-09-15 23:50:15 +02:00
parent 99783cc8da
commit 05ee3d50e4
34 changed files with 1562 additions and 1206 deletions
@@ -1,14 +1,14 @@
// FE-RN-001 to FE-RN-011
// FE-RN-001 to FE-RN-014
import { describe, it, expect, vi } from 'vitest'
import { render, screen } from '../../../tests/helpers/render'
import userEvent from '@testing-library/user-event'
import { ReleaseNoticeModal } from './ReleaseNoticeModal'
import type { SystemNoticeDTO } from '../../store/systemNoticeStore'
/** A notice shaped like the 4.0.0 registry entry, with the pieces a test needs to vary. */
/** A notice shaped like the release-notes registry entry, with the pieces a test needs to vary. */
function releaseNotice(overrides: Partial<SystemNoticeDTO> = {}): SystemNoticeDTO {
return {
id: 'release-4-0-0',
id: 'release-notes',
display: 'modal',
severity: 'info',
titleKey: 'rel.headline',
@@ -18,25 +18,27 @@ function releaseNotice(overrides: Partial<SystemNoticeDTO> = {}): SystemNoticeDT
cta: { kind: 'link', labelKey: 'rel.bmc', href: 'https://buymeacoffee.com/mauriceboe' },
secondaryCta: { kind: 'link', labelKey: 'rel.kofi', href: 'https://ko-fi.com/mauriceboe' },
release: {
version: '4.0.0',
version: '4.3.0',
eyebrowKey: 'rel.eyebrow',
tagKey: 'rel.tag',
headlineKey: 'rel.headline',
introKey: 'rel.intro',
featuresLabelKey: 'rel.features.label',
features: [
{ iconName: 'Smartphone', titleKey: 'rel.f1.title', bodyKey: 'rel.f1.body' },
{ iconName: 'BookOpen', titleKey: 'rel.f2.title', bodyKey: 'rel.f2.body', badgeKey: 'rel.f2.badge' },
{ iconName: 'Database', visual: 'places-api', titleKey: 'rel.f1.title', bodyKey: 'rel.f1.body' },
{ iconName: 'Route', visual: 'roadtrip', titleKey: 'rel.f2.title', bodyKey: 'rel.f2.body' },
{ iconName: 'MapPin', visual: 'dawarich', titleKey: 'rel.f3.title', bodyKey: 'rel.f3.body' },
],
note: {
eyebrowKey: 'rel.note.eyebrow',
titleKey: 'rel.note.title',
bodyKey: 'rel.note.body',
promiseLabelKey: 'rel.promise.label',
promiseLeadKey: 'rel.promise.lead',
promiseTextKey: 'rel.promise.text',
bodyAfterKey: 'rel.note.after',
closingKey: 'rel.note.closing',
signatureKey: 'rel.note.signature',
},
supportLeadKey: 'rel.support.lead',
supportTextKey: 'rel.support',
},
...overrides,
@@ -69,14 +71,16 @@ describe('ReleaseNoticeModal', () => {
it('FE-RN-002: shows the version as a plain figure, not a translation key', () => {
renderModal()
expect(screen.getByText('4.0.0')).toBeInTheDocument()
expect(screen.getByText('4.3.0')).toBeInTheDocument()
})
it('FE-RN-003: renders one row per feature, with the badge only where declared', () => {
it('FE-RN-003: renders one card per feature, each with its drawing', () => {
renderModal()
expect(screen.getByText('rel.f1.title')).toBeInTheDocument()
expect(screen.getByText('rel.f2.badge')).toBeInTheDocument()
expect(document.querySelectorAll('.rn-feature')).toHaveLength(2)
expect(document.querySelectorAll('.rn-feature')).toHaveLength(3)
expect(document.querySelector('.rn-vis-places')).not.toBeNull()
expect(document.querySelector('.rn-vis-road')).not.toBeNull()
expect(document.querySelector('.rn-vis-trail')).not.toBeNull()
})
it('FE-RN-004: splits the note body on the blank line into separate paragraphs', () => {
@@ -88,17 +92,17 @@ describe('ReleaseNoticeModal', () => {
expect(screen.getByText('second paragraph')).toBeInTheDocument()
})
it('FE-RN-005: omits the stats row when the release carries no stats', () => {
it('FE-RN-005: omits the foot when the release has neither a footnote nor notes', () => {
renderModal()
expect(document.querySelector('.rn-release-foot')).toBeNull()
})
it('FE-RN-006: shows the stats row and the notes link when both are present', () => {
it('FE-RN-006: shows the footnote and the notes link when both are present', () => {
const n = releaseNotice()
n.release!.stats = [{ value: '~150', labelKey: 'rel.stat.bugs' }]
n.release!.footnoteKey = 'rel.footnote'
n.release!.notes = { labelKey: 'rel.notes', href: 'https://example.test/notes' }
renderModal(n)
expect(screen.getByText('~150')).toBeInTheDocument()
expect(screen.getByText('rel.footnote')).toBeInTheDocument()
const link = screen.getByRole('link', { name: /rel\.notes/ })
expect(link).toHaveAttribute('href', 'https://example.test/notes')
expect(link).toHaveAttribute('target', '_blank')
@@ -152,9 +156,37 @@ describe('ReleaseNoticeModal', () => {
renderModal()
const dialog = screen.getByRole('dialog')
expect(dialog).toHaveAttribute('aria-modal', 'true')
expect(dialog).toHaveAttribute('aria-labelledby', 'notice-title-release-4-0-0')
expect(dialog).toHaveAttribute('aria-describedby', 'notice-body-release-4-0-0')
expect(document.getElementById('notice-title-release-4-0-0')).toHaveTextContent('rel.headline')
expect(document.getElementById('notice-body-release-4-0-0')).toHaveTextContent('rel.intro')
expect(dialog).toHaveAttribute('aria-labelledby', 'notice-title-release-notes')
expect(dialog).toHaveAttribute('aria-describedby', 'notice-body-release-notes')
expect(document.getElementById('notice-title-release-notes')).toHaveTextContent('rel.headline')
expect(document.getElementById('notice-body-release-notes')).toHaveTextContent('rel.intro')
})
it('FE-RN-012: sets the promise and the support text with a bold lead', () => {
renderModal()
expect(screen.getByText('rel.promise.lead').tagName).toBe('B')
expect(screen.getByText('rel.support.lead').tagName).toBe('B')
expect(screen.getByText('rel.promise.text')).toBeInTheDocument()
})
it('FE-RN-013: the features aside is optional', () => {
renderModal()
expect(document.querySelector('.rn-features-aside')).toBeNull()
const n = releaseNotice()
n.release!.featuresAsideKey = 'rel.features.aside'
renderModal(n)
expect(screen.getByText('rel.features.aside')).toBeInTheDocument()
})
it('FE-RN-014: a card whose drawing this client does not know falls back to its icon', () => {
const n = releaseNotice()
n.release!.features = [
{ iconName: 'Route', visual: 'from-a-newer-server', titleKey: 'rel.x.title', bodyKey: 'rel.x.body' },
{ iconName: 'NoSuchIcon', titleKey: 'rel.y.title', bodyKey: 'rel.y.body' },
]
renderModal(n)
expect(document.querySelectorAll('.rn-vis-icon')).toHaveLength(2)
expect(document.querySelectorAll('.rn-vis-icon svg')).toHaveLength(2)
})
})