-
Notifications
You must be signed in to change notification settings - Fork 228
fix(#516): handle incomplete card grid rows gracefully on dashboard #522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,8 @@ | |
| } | ||
|
|
||
| .stat-card { | ||
| flex: 1; | ||
| flex: 1 1 200px; /* grow/shrink but never below 200 px */ | ||
| max-width: calc(33.333% - 14px); /* max 1/3 width so lone card stays bounded */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Prompt to fix with AI
|
||
| min-width: 200px; | ||
| background: rgba(255, 0, 0, 0.1); | ||
| border-radius: 10px; | ||
|
|
@@ -79,7 +80,8 @@ | |
| } | ||
|
|
||
| .dashboard-action { | ||
| flex: 1; | ||
| flex: 1 1 250px; /* grow/shrink but never below 250 px */ | ||
| max-width: calc(33.333% - 14px); /* prevent a lone card stretching to full width */ | ||
| min-width: 250px; | ||
| background: var(--glass-bg); | ||
| border-radius: 15px; | ||
|
|
@@ -141,15 +143,27 @@ | |
|
|
||
| .recent-achievements { | ||
| display: grid; | ||
| grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); | ||
| /* auto-fit collapses empty phantom columns so the last card | ||
| does not stretch across the full row when the row is incomplete. | ||
| auto-fill would leave invisible tracks that force the card to | ||
| fill 100% width. */ | ||
| grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); | ||
| /* hard cap so a single surviving card never grows past one column width */ | ||
| max-width: 100%; | ||
| gap: 20px; | ||
| } | ||
|
|
||
| /* When only 1 card survives on the last row, stop it from filling the grid */ | ||
| .recent-achievement { | ||
| max-width: 350px; | ||
| } | ||
|
|
||
| .recent-achievement { | ||
| background: var(--glass-bg); | ||
| border-radius: 10px; | ||
| padding: 15px; | ||
| border: 1px solid var(--border-color); | ||
| max-width: 350px; /* duplicated from grid rule above for specificity safety */ | ||
| } | ||
|
|
||
| .achievement-tag { | ||
|
|
@@ -177,6 +191,17 @@ | |
| .dashboard-stats { | ||
| flex-direction: column; | ||
| } | ||
| /* On mobile remove the max-width caps so cards fill the full column */ | ||
| .stat-card, | ||
| .dashboard-action { | ||
| max-width: 100%; | ||
| } | ||
| .recent-achievements { | ||
| grid-template-columns: 1fr; | ||
| } | ||
| .recent-achievement { | ||
| max-width: 100%; | ||
| } | ||
| } | ||
|
|
||
| .toggle-container { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
student_dashboard.html caps lone cards at calc(33.333% - 14px) to prevent full-width stretching; admin_dashboard.html sets max-width: 100% which is the browser default and adds no constraint. Bootstrap col-md-3 sets width on the outer .col wrapper, not a max-width on .stat-card, so a lone card inside its col still expands to fill that 25% col, and at viewport widths where cols stack to col-12 (below md breakpoint), .stat-card has no cap at all.