Skip to content

fix: give Provider and Profile cards a consistent height - #165

Merged
yujiezhang-ops merged 1 commit into
mainfrom
fix/card-height-consistency
Aug 12, 2026
Merged

fix: give Provider and Profile cards a consistent height#165
yujiezhang-ops merged 1 commit into
mainfrom
fix/card-height-consistency

Conversation

@yujiezhang-ops

Copy link
Copy Markdown
Collaborator

Closes #164.

What was wrong

Cards in the same grid row had visibly different bottom edges. Measured at 1280px before the change:

第 1 行:  DeepSeek 124px  |  Moonshot 104px   <- same row, 20px apart
第 2 行:  Novita   124px  |  PPIO     124px

Two independent variables fed the height, and the worst realistic combination was 129px vs 185px — a 1.43× spread.

Why not align-items: stretch

Switching the grid to stretch does equalize the row, and I verified that ([124, 104, 124, 124][124, 124, 124, 124]). I did not take it, for two reasons:

  • It only moves the whitespace inside the shorter card. The mismatch becomes a blank strip rather than a ragged edge.
  • It makes the tallest card set the row. One Provider with eight bound Agents would drag its whole row to 185px, and the empty cards next to it would show a large void — worse than the original problem.

The two variables are removed instead, so the heights match without the grid having to force them. The existing align-items: start and the comment defending it stay as they are, and remain correct.

Change 1 — the Anthropic row always occupies its slot (worth 20px)

It previously rendered only when anthropic_base_url was set, so an OpenAI-only Provider was one row shorter. It now shows 不支持 / Unsupported in the tertiary colour.

This has a second benefit beyond layout: the user could previously only infer "this Provider does not serve Anthropic" from a missing row. Now it says so.

Moonshot:  OpenAI 兼容      https://api.moonshot.cn
           Anthropic 兼容   不支持

Change 2 — Agent chips cap at three, then "+N" (worth 36px, and unbounded)

.card-users wraps with no row limit, so height scaled with the number of bindings — with eight configurable Agents that is a real case, not a hypothetical. Chips now cap at three with the rest collapsed:

8 bound Agents  ->  3 chips + "+5"

Three matches requiredByHint in internal/app/runtime.go:246, which already renders "A, B, C +2" for the same kind of list. Reusing the existing convention seemed better than picking a second one. The hidden names stay recoverable from the chip's title.

Both pages, one component

#164 noted that .profile-list shares the grid rule with .provider-list. Both pages also had the same chip markup, so the chips move into a shared CardUsers component rather than being fixed twice — otherwise the next change to the cap reaches one page and not the other. The Profile card gets the cap for free.

Verification

Measured in the running app, not inferred from CSS:

viewport columns card heights rows with mismatched heights
700px 1 144 / 144 / 144 / 144 0
1280px 2 124 / 124 / 124 / 124 0
1900px 3 144 / 144 / 144 / 144 0

No card overflows horizontally and the page has no horizontal scroll at 700px. Checked in both locales, since the absent-endpoint label is translated — English renders Unsupported and heights stay equal at 144px.

go test ./... 14 packages pass. Frontend: 346 tests across 44 files (4 new), tsc --noEmit clean, build clean, and all 6 Wails E2E specs pass.

The new CardUsers test asserts the chip count, not just the presence of the "+N" label — the cap is a layout constraint, and only counting the rendered chips catches a regression that keeps the label while uncapping the list.

🤖 Generated with Claude Code

Cards in the same grid row had visibly different bottom edges. Measured at
1280px before this change, DeepSeek and Moonshot sat side by side at 124px and
104px. Two independent variables fed that, and both are removed rather than
papered over with align-items: stretch -- stretch only moves the whitespace
inside the shorter card, and one card with eight bindings would have dragged its
whole row to 185px.

The Anthropic endpoint row now always occupies its slot, showing "Unsupported"
when the endpoint is absent instead of not rendering. That was worth 20px, and
stating the absence also answers a question the missing row previously left the
user to infer from a gap.

Agent chips cap at three and collapse into "+N", which was worth 36px with eight
bound Agents and grew without bound: .card-users wraps and had no row limit, so
height scaled with bindings. Three matches requiredByHint in
internal/app/runtime.go, which already renders "A, B, C +2" for the same kind of
list. The hidden names stay recoverable from the chip's title.

The chips move into a shared CardUsers component because both pages had the same
markup and both grids use the same rule, so a change to one had to reach the
other or the pages would drift. The Profile card gets the cap for free.

Verified at 700/1280/1900px: one, two and three columns, every card equal
height, no row with mismatched heights, no card or page overflow. Checked in
both locales, since the absent-endpoint label is translated.
@yujiezhang-ops
yujiezhang-ops requested a review from a team August 12, 2026 03:42
@yujiezhang-ops
yujiezhang-ops merged commit 6608423 into main Aug 12, 2026
4 checks passed
@yujiezhang-ops
yujiezhang-ops deleted the fix/card-height-consistency branch August 12, 2026 03:46
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.

[Bug]: 模型服务卡片高度随内容自适应,同一行卡片底边不齐

1 participant