diff --git a/frontend/src/lib/timeline/LetterCard.svelte b/frontend/src/lib/timeline/LetterCard.svelte index 593156fc..84a76bfb 100644 --- a/frontend/src/lib/timeline/LetterCard.svelte +++ b/frontend/src/lib/timeline/LetterCard.svelte @@ -12,9 +12,19 @@ type TimelineEntryDTO = components['schemas']['TimelineEntryDTO']; * precision-aware date chip, linking to the document. Names/titles are * OCR/import-derived — rendered via default `{...}` escaping with * `whitespace-pre-line` for line breaks (REQ-021); never the raw-HTML directive. + * + * In Ereignis mode the card sits inside an event cluster and renders as the + * `.lcard.ev` variant (#827, REQ-014). In Thema mode the per-letter tag chip is + * suppressed inside its own root-tag bucket, where the bucket header already + * carries the topic (`suppressTagChip`, REQ-017). */ -let { entry }: { entry: TimelineEntryDTO } = $props(); +let { + entry, + variant = 'plain', + suppressTagChip = false +}: { entry: TimelineEntryDTO; variant?: 'plain' | 'event'; suppressTagChip?: boolean } = $props(); +const isEventVariant = $derived(variant === 'event'); const dateLabel = $derived(timelineDateLabel(entry.eventDate, entry.precision, entry.eventDateEnd)); const sender = $derived(entry.senderName === '' ? m.timeline_unknown_person() : entry.senderName); const receiver = $derived( @@ -28,7 +38,8 @@ const receiver = $derived( {#if entry.title} + (#835 §3); absent when the letter has no tag (REQ-005), and suppressed in + Thema mode inside its own root-tag bucket where the header conveys it (REQ-017). --> {/if} diff --git a/frontend/src/lib/timeline/LetterCard.svelte.spec.ts b/frontend/src/lib/timeline/LetterCard.svelte.spec.ts index b60c0f5f..df36bffc 100644 --- a/frontend/src/lib/timeline/LetterCard.svelte.spec.ts +++ b/frontend/src/lib/timeline/LetterCard.svelte.spec.ts @@ -127,3 +127,28 @@ describe('LetterCard', () => { expect(chip?.textContent).toContain('Familie'); }); }); + +describe('LetterCard — grouping variants (#827, REQ-014/017)', () => { + it('carries the .lcard.ev class in the event variant (REQ-014)', () => { + render(LetterCard, { entry: makeEntry(), variant: 'event' }); + expect(document.querySelector('a.lcard.ev')).not.toBeNull(); + }); + + it('is a plain card with no .ev marker by default (REQ-014)', () => { + render(LetterCard, { entry: makeEntry() }); + expect(document.querySelector('a.ev')).toBeNull(); + }); + + it('suppresses the per-letter tag chip when asked, even with a root tag (REQ-017)', () => { + render(LetterCard, { + entry: makeEntry({ rootTagName: 'Krieg', rootTagColor: 'sienna' }), + suppressTagChip: true + }); + expect(document.querySelector('[data-testid="tag-chip"]')).toBeNull(); + }); + + it('still shows the per-letter tag chip when not suppressed — Datum/Ereignis (REQ-017)', () => { + render(LetterCard, { entry: makeEntry({ rootTagName: 'Krieg', rootTagColor: 'sienna' }) }); + expect(document.querySelector('[data-testid="tag-chip"]')).not.toBeNull(); + }); +});