fix(diagrams): weekday patterns bars not aligned #
Area: Data & Diagrams · Weekday Patterns · pages/diagrams.vue
Type: bug (visual)
Priority: p2
Summary #
Bars and counts in Weekday Patterns on /diagrams are not aligned — label width (Mon vs Wednesday / i18n) pushes the bar start position, so rows look ragged.
Current behavior #
pages/diagrams.vue:114-126:
<div v-for="day in weekdayPatterns" class="data-row">
<span class="data-row-label">{{ day.label }}</span>
<div class="flex items-center gap-2 flex-1 mx-4" role="img" :aria-label="…">
<div class="chart-bar h-3" :style="{ width: Math.max(4,(day.count/maxCigsPerDay)*100)+'%' }"></div>
</div>
<span class="data-row-value">{{ day.count }}</span>
</div>
.data-row { display:flex; justify-content:space-between }+flex-1 mx-4on the bar container.data-row-labelhas no fixed width →mx-4offset is relative to label end, so bar left edges don't line up when labels differ in length (i18n:MovsWednesday,Montag, etc.).- Count column also
space-between→ counts don't line up vertically. weekdayPatternsis last 7 days fromheatData.counts.slice(-7)mapped to locale labels (diagrams.weekday_*), so order/labels vary.
Expected behavior #
Use a fixed grid so label / bar / count each have pinned columns:
<div class="grid grid-cols-[5rem_1fr_2.5rem] items-center gap-2 py-2 border-t border-base-300 first:border-t-0">
<span class="data-row-label text-left truncate">{{ day.label }}</span>
<div class="flex items-center" role="img" :aria-label="…">
<div class="chart-bar h-3" :style="{ width: … }"></div>
</div>
<span class="data-row-value text-right">{{ day.count }}</span>
</div>
Alternatives: grid-cols-[80px_1fr_40px] or grid-cols-[6rem_1fr_3rem] — pick one that fits longest i18n label at 0.8125rem.
- Bar
h-3,bg-primary, widthMath.max(4, (day.count/maxCigsPerDay)*100)+'%'stays. - Keep
role="img"+aria-labelandaria-hiddenon count. - Works at all widths, no shift between locales.
Files to touch #
pages/diagrams.vue:114-126— Weekday Patterns templateassets/css/marathon-components.css— consider a.data-row-gridhelper if reused elsewhere
Acceptance criteria #
How to test #
- Open
/diagrams→ inspect Weekday Patterns → togglei18nlocale (or temporarily hardcode long label likeWednesday) → bars must not move. - Measure: left edge of each
.chart-barparent should be identicalx. - Resize 320→1280 → alignment holds.