fix(timeline): drop zero-count segments from the zeitstrahl meta line
A timeline with content in only one category rendered a misleading "0 Briefe" / "0 Ereignisse" segment. Only push a count segment when its count is greater than zero; the grouping label and (when present) the range are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,13 @@ const metaLine = $derived.by(() => {
|
||||
if (meta.firstYear !== null && meta.lastYear !== null) {
|
||||
segments.push(`${meta.firstYear}–${meta.lastYear}`);
|
||||
}
|
||||
segments.push(m.timeline_letters_count({ count: meta.letterCount }));
|
||||
segments.push(m.timeline_events_count({ count: meta.eventCount }));
|
||||
// A zero-count segment ("0 Briefe") reads as a data error — drop it.
|
||||
if (meta.letterCount > 0) {
|
||||
segments.push(m.timeline_letters_count({ count: meta.letterCount }));
|
||||
}
|
||||
if (meta.eventCount > 0) {
|
||||
segments.push(m.timeline_events_count({ count: meta.eventCount }));
|
||||
}
|
||||
segments.push(m.timeline_grouping_date());
|
||||
return segments.join(' · ');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user