Files
familienarchiv/frontend/src/lib/timeline/eventCardConfig.ts
Marcel 4a6fd770d7
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 5m18s
CI / OCR Service Tests (pull_request) Successful in 25s
CI / Backend Unit Tests (pull_request) Successful in 5m17s
CI / fail2ban Regex (pull_request) Successful in 47s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m8s
SDD Gate / RTM Check (pull_request) Successful in 15s
SDD Gate / Contract Validate (pull_request) Successful in 23s
SDD Gate / Constitution Impact (pull_request) Successful in 18s
fix(i18n): translate timeline sr-only labels in en/es locales
timeline_layer_* and timeline_derived_* shipped German values in the
English and Spanish catalogs, so EN/ES screen-reader users heard German
for the world/family layer and birth/death/marriage cues. Translate them;
de.json stays canonical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 20:34:54 +02:00

39 lines
1.5 KiB
TypeScript

import * as m from '$lib/paraglide/messages.js';
import type { components } from '$lib/generated/api';
type TimelineEntryDTO = components['schemas']['TimelineEntryDTO'];
/** Styling discriminant for an axis pill/band. */
export type TimelineAccent = 'derived' | 'curated' | 'historical';
export interface AccentConfig {
/** Visible Unicode glyph — render `aria-hidden`, paired with an sr-only label. */
glyph: string;
/** Localized layer/life-event label — used as the sr-only / aria text only. */
label: string;
accent: TimelineAccent;
}
/**
* Maps a timeline EVENT entry to its glyph, redundant non-color label, and accent
* (REQ-007/008/018). Derived life-events use the * / † / ⚭ glyphs that match
* `personLifeDates.ts`; HISTORICAL events get the muted world band; everything
* else (curated PERSONAL) gets the mint family pill.
*/
export function getAccentConfig(entry: TimelineEntryDTO): AccentConfig {
if (entry.derived) {
switch (entry.derivedType) {
case 'BIRTH':
return { glyph: '*', label: m.timeline_derived_birth(), accent: 'derived' };
case 'DEATH':
return { glyph: '†', label: m.timeline_derived_death(), accent: 'derived' };
case 'MARRIAGE':
return { glyph: '⚭', label: m.timeline_derived_marriage(), accent: 'derived' };
}
}
if (entry.type === 'HISTORICAL') {
return { glyph: '◍', label: m.timeline_layer_world(), accent: 'historical' };
}
return { glyph: '★', label: m.timeline_layer_family(), accent: 'curated' };
}