Skip to content

Commit 2d360a4

Browse files
Edwin Chanclaude
authored andcommitted
fix(analytics): give charts real height and stop horizontal overflow
- Bump trend SVG to 320 viewBox height and use xMidYMid meet so the curves render at their true aspect ratio instead of getting squashed - Constrain analytics-frame/row/panel children with min-width: 0 so long tables and SVGs no longer push the page off to the right - Make daily-bars taller (200px) so the strip reads as a chart, not a thin sliver Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 82ccc99 commit 2d360a4

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

app/admin/analytics/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ export default async function AnalyticsOverviewPage({
410410

411411
// SVG geometry
412412
const CHART_W = 760;
413-
const CHART_H = 220;
413+
const CHART_H = 320;
414414
const maxAttemptsBucket = Math.max(1, ...trendBuckets.map((b) => b.attempts));
415415
const attemptsPath = buildLinePath(
416416
trendBuckets.map((b) => b.attempts),
@@ -562,7 +562,7 @@ export default async function AnalyticsOverviewPage({
562562
<div className="chart-wrap">
563563
<svg
564564
viewBox={`0 0 ${CHART_W} ${CHART_H + 36}`}
565-
preserveAspectRatio="none"
565+
preserveAspectRatio="xMidYMid meet"
566566
role="img"
567567
aria-label="Weekly attempts and completions"
568568
>

app/globals.css

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4849,6 +4849,14 @@ html.dark .theme-choice-button.active {
48494849
.analytics-frame {
48504850
display: grid;
48514851
gap: 18px;
4852+
width: 100%;
4853+
max-width: 100%;
4854+
min-width: 0;
4855+
overflow-x: hidden;
4856+
}
4857+
4858+
.analytics-frame > * {
4859+
min-width: 0;
48524860
}
48534861

48544862
.analytics-metric-grid {
@@ -4868,6 +4876,10 @@ html.dark .theme-choice-button.active {
48684876
align-items: start;
48694877
}
48704878

4879+
.analytics-row > * {
4880+
min-width: 0;
4881+
}
4882+
48714883
@media (max-width: 960px) {
48724884
.analytics-row {
48734885
grid-template-columns: minmax(0, 1fr);
@@ -4879,6 +4891,7 @@ html.dark .theme-choice-button.active {
48794891
flex-direction: column;
48804892
gap: 14px;
48814893
padding-bottom: 20px;
4894+
min-width: 0;
48824895
}
48834896

48844897
.analytics-empty {
@@ -4891,6 +4904,7 @@ html.dark .theme-choice-button.active {
48914904
.chart-legend {
48924905
display: inline-flex;
48934906
align-items: center;
4907+
flex-wrap: wrap;
48944908
gap: 12px;
48954909
color: var(--color-muted);
48964910
font-size: 0.78rem;
@@ -4934,18 +4948,21 @@ html.dark .theme-choice-button.active {
49344948
flex-direction: column;
49354949
gap: 12px;
49364950
padding: 0 20px;
4951+
min-width: 0;
49374952
}
49384953

49394954
.chart-wrap svg {
4955+
display: block;
49404956
width: 100%;
49414957
height: auto;
4942-
max-height: 260px;
4958+
max-width: 100%;
49434959
}
49444960

49454961
.chart-summary {
49464962
display: grid;
49474963
grid-template-columns: repeat(6, minmax(0, 1fr));
49484964
gap: 8px;
4965+
min-width: 0;
49494966
}
49504967

49514968
.chart-summary-cell {
@@ -4989,8 +5006,9 @@ html.dark .theme-choice-button.active {
49895006
grid-template-columns: repeat(30, minmax(0, 1fr));
49905007
align-items: end;
49915008
gap: 3px;
4992-
height: 160px;
5009+
height: 200px;
49935010
padding: 16px 20px 20px;
5011+
min-width: 0;
49945012
}
49955013

49965014
.daily-bar {

0 commit comments

Comments
 (0)