Smoking habit tracker

fix(dashboard): recent cigarettes table columns shift with date length #2

Open io-industries.dev
Open opened by io-industries.dev

fix(dashboard): recent cigarettes table columns shift with date length #

Area: Dashboard · Recent section · pages/dashboard.vue Type: bug (visual) Priority: p2

Summary #

Text in the Recent table on the dashboard shifts horizontally when the date string gets longer. Columns should have fixed widths so position is stable regardless of text length.

Current behavior #

pages/dashboard.vue Recent section (~v-for="cig in cigs"):

<div class="data-row">
  <span class="data-row-label">{{ formatTimestamp(cig.timestamp) }}</span>
  <span v-if="cigTypeName(cig)" class="tag">{{ cigTypeName(cig) }}</span>
  <span class="data-row-value accent">■</span>
</div>
  • .data-row { display:flex; justify-content:space-between; align-items:center } (assets/css/marathon-components.css:33)
  • formatTimestamp is new Date(ts*1000).toLocaleString() — variable length per locale, per date (e.g. 9/13/2025, 2:32:01 PM vs 13.09.2025, 14:32:01)
  • Longer strings push tag and ■ sideways → visible jank, especially when switching locales or when dates cross single/double-digit days.

Expected behavior #

Use fixed columns so tag and indicator never move:

  • Replace flex space-between for this table with a grid, e.g.:
    grid-template-columns: 10rem 1fr auto
    /* or tailwind: grid grid-cols-[160px_1fr_24px] */
    
  • Date column: fixed ~160px, left-aligned, truncate + whitespace-nowrap + title for full value on hover.
  • Brand tag: middle column, min-width:0, truncate if needed.
  • Indicator ■: fixed 24px, right-aligned.
  • Keep .data-row + top border treatment for other sections, or introduce .data-row-grid variant.
  • Remains responsive (<640px) — may collapse to grid-cols-[1fr_auto] with date full-width on mobile if needed.

Files to touch #

  • pages/dashboard.vue — Recent section template
  • assets/css/marathon-components.css — .data-row or new .data-row-grid

Acceptance criteria #

How to test #

  1. Log 5 cigs, open dashboard, observe Recent rows.
  2. Switch navigator.language or temporarily return a long date string → verify columns stay pinned.
  3. Resize to 320px and 1280px → no wrapping/shift.
Sign up or Sign in to add to the discussion.