Skip to content

fix(ui): let dashboard charts grow into the width they are given - #713

Merged
AntonTyb merged 1 commit into
feat/chart-artifact-ui-viewfrom
fix/dashboard-chart-full-width
Sep 11, 2026
Merged

AntonTyb merged 1 commit into
feat/chart-artifact-ui-viewfrom
fix/dashboard-chart-full-width

Conversation

@AntonTyb

@AntonTyb AntonTyb commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

What

Stacked on #710 (base branch feat/chart-artifact-ui-view).

On the dashboard page a chart occupies about a third of the width no matter how many charts
are on the dashboard. With three charts that happens to look right; with one or two, most of
the page is blank.

Root cause

chart_card.scss sizes the card with two rules that contradict each other:

:host {
  min-width: 320px;
  max-width: 420px;   // <-- this one
  flex: 1 1 340px;
}

flex: 1 1 340px asks the card to grow into whatever the row has spare. max-width: 420px
forbids it. The cap wins, so .dashboard-grid-container — a display: flex row at 100% width
— lays out cards that refuse to fill it.

It reads as a per-count bug but isn't: the card is always 420px. It only looks correct at
three charts because 3 × 420 + gaps ≈ the content width of a typical laptop screen. That is
also why the two- and one-chart cases are the visible symptom, and why widening the browser
does not help at any count.

The cap has been there since the component landed in #488 and no test constrained it.

Fix

Delete max-width. That is the whole change.

Nothing else is needed to fill the row: crowding is already handled at the other end by the
320px min-width plus overflow-x: auto on the grid container, which is what gives a
many-chart dashboard its horizontal scroll. The card's inner layout was already correct.

The diff is one deleted declaration plus a three-line comment noting that its absence is
deliberate.

Verification

ng test --watch=false — 561 specs pass. No specs are added; see below.

Also clean: tsc --noEmit, eslint, prettier --check, and ./.githooks/pre-commit --check
(which still exits non-zero only because mypy/terraform/tflint/trivy are absent here and the
hook counts a skipped tool as a failure).

Behaviour confirmed in a browser — screenshots below.

Notes for the reviewer

  • This PR was larger and has been shrunk to the one line, per review. Two things came out:

    • Six geometry specs asserting getBoundingClientRect() widths. They tested the browser's
      CSS engine rather than logic in these components, and the extra grid rules they were
      written against no longer exist, so they guarded nothing this PR does. Screenshot tests
      are the right tool if we want this pinned down.
    • Narrative comments in chart_card.scss and chart_artifact_view.scss explaining which
      layouts were tried and reverted. That is history of how the fix was reached, not something
      a reader of the stylesheet needs.
  • The middle commit is a revert of the first. The first attempt also changed what the card
    does with its new width: curves two-up in an auto-fit grid, summary boxes capped at 320px.
    Both made plots narrower than their container — on a 1900px card the summary row left
    1214px empty — which is the opposite of the point. Reverted in de5b2f87. Reviewing the
    branch as a whole diff rather than commit by commit will be less noisy.

  • chart_artifact_view.scss is no longer touched by this PR.

  • 3+ charts now grow too. Three charts on a 1920px screen become ~620px each instead of
    420px plus dead space. Keeping the cap for 3+ while lifting it for 1–2 would need
    sibling-count selectors (:only-child, :first-child:nth-last-child(2)) in the parent
    stylesheet fighting the child's :host on specificity — fragile, and hard to read later. Say
    the word if you would rather have that.

Screenshots

one chart:
image

two charts:
image

TAG=agy
CONV=96ac94bd-c2b9-4753-b54f-b0b6b02d801f

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the layout responsiveness of chart cards, summary boxes, and curve plots in the UI by switching to a CSS Grid layout and removing restrictive maximum widths. It also adds corresponding layout unit tests. The review feedback highlights a potential Sass compilation issue when using the lowercase min() function with mixed units, suggesting capitalizing it as Min() to ensure it compiles correctly as native CSS.

@AntonTyb
AntonTyb marked this pull request as ready for review September 1, 2026 13:30

@andrzejfudro andrzejfudro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to discussions here but overall I believe this PR should be one-line change

andrzejfudro
andrzejfudro previously approved these changes Sep 4, 2026
@AntonTyb
AntonTyb dismissed andrzejfudro’s stale review September 7, 2026 11:47

The merge-base changed after approval.

@AntonTyb
AntonTyb force-pushed the feat/chart-artifact-ui-view branch from 9ba7627 to a794a5b Compare September 7, 2026 11:47
@AntonTyb
AntonTyb force-pushed the fix/dashboard-chart-full-width branch from 541a223 to beb8c7f Compare September 7, 2026 11:48
`chart_card.scss` capped `:host` at `max-width: 420px`, which contradicts the
`flex: 1 1 340px` sitting next to it. The cap only shows up when there is room
to spare, so a dashboard with three charts looked right on a typical screen --
three 420px columns happen to fill it -- while one or two charts sat in a
420px column with the rest of the page blank.

Drop the cap. Crowding is already handled at the other end, by the 320px
`min-width` and the grid container's `overflow-x: auto`.

TAG=agy
CONV=96ac94bd-c2b9-4753-b54f-b0b6b02d801f
@AntonTyb
AntonTyb force-pushed the fix/dashboard-chart-full-width branch from beb8c7f to 99aceb8 Compare September 7, 2026 15:58
@AntonTyb
AntonTyb merged commit 1ee9953 into feat/chart-artifact-ui-view Sep 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants