Restore /zeitstrahl Datum-mode visual fidelity to the Concept-A spec (#833) #836

Merged
marcel merged 23 commits from feat/issue-833-zeitstrahl-fidelity into main 2026-06-14 14:12:42 +02:00
Showing only changes of commit 0bd6790b1f - Show all commits

View File

@@ -21,11 +21,18 @@ export interface TimelineMeta {
*/
export function timelineMeta(timeline: TimelineDTO): TimelineMeta {
const years = timeline.years;
const allEntries = [...years.flatMap((y) => y.entries), ...timeline.undated];
let letterCount = 0;
let eventCount = 0;
const tally = (e: TimelineDTO['undated'][number]) => {
if (e.kind === 'LETTER') letterCount += 1;
else if (e.kind === 'EVENT') eventCount += 1;
};
for (const y of years) for (const e of y.entries) tally(e);
for (const e of timeline.undated) tally(e);
return {
firstYear: years.length ? years[0].year : null,
lastYear: years.length ? years[years.length - 1].year : null,
letterCount: allEntries.filter((e) => e.kind === 'LETTER').length,
eventCount: allEntries.filter((e) => e.kind === 'EVENT').length
letterCount,
eventCount
};
}