diff --git a/changelog.d/fixed-mobile-overview-kpi-overflow.md b/changelog.d/fixed-mobile-overview-kpi-overflow.md new file mode 100644 index 0000000000..8cb38392aa --- /dev/null +++ b/changelog.d/fixed-mobile-overview-kpi-overflow.md @@ -0,0 +1 @@ +- Overview KPI tiles no longer overflow the phone viewport: the refresh/stale pill wraps inside the card, tile sublines and sparklines stay within the tile, and labels/sublines use compact font tokens on narrow screens (hivecommons/hive#16601). diff --git a/src/pkg/dashboard/static-src/css/overview.css b/src/pkg/dashboard/static-src/css/overview.css index 1d1f948601..0d0fc45e63 100644 --- a/src/pkg/dashboard/static-src/css/overview.css +++ b/src/pkg/dashboard/static-src/css/overview.css @@ -13,23 +13,34 @@ .overview-repo-filter { display: grid; gap: var(--sp-2); max-height: min(16rem, 32vh); overflow: auto; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); } .overview-settings-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); } .overview-headline { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); } - .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; } + /* Every headline child must be allowed to shrink to the card: the grid's + single auto track otherwise grows to the widest min-content child and + drags the KPI tiles past the phone viewport (hivecommons/hive#16601). */ + .overview-headline > * { min-width: 0; max-width: 100%; } + .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; min-width: 0; } .overview-kpi-operator { display: inline-flex; align-items: center; justify-content: center; align-self: start; padding-top: var(--sp-3); color: var(--muted); font-size: var(--fs-lg); font-weight: 800; line-height: 1; } .overview-kpi-coverage-spacer { width: 1px; min-height: 100%; background: var(--border); opacity: 0.8; } - .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; } + .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; justify-self: start; white-space: normal; overflow-wrap: anywhere; } @media (max-width: 1399px) { .overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .overview-kpi-operator, .overview-kpi-coverage-spacer { display: none; } } @media (max-width: 720px) { .overview-kpis { grid-template-columns: minmax(0, 1fr); } } .overview-kpi-range { display: inline-flex; gap: var(--sp-1); } .overview-kpi-range-btn { min-width: 2rem; height: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; cursor: pointer; } .overview-kpi-range-btn.active { border-color: var(--accent); color: var(--accent); } - .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; cursor: pointer; } + .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; min-width: 0; cursor: pointer; } .overview-kpi:hover { border-color: var(--accent); } .overview-kpi-value { font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; } .overview-kpi-label { color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; } - .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; } - .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); } - .overview-kpi-spark .sparkline { width: 100%; } - .overview-kpi-spark svg { width: 100%; height: 24px; } + .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; overflow-wrap: anywhere; } + .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); min-width: 0; } + .overview-kpi-spark .sparkline { width: 100%; max-width: 100%; min-width: 0; } + .overview-kpi-spark svg { width: 100%; max-width: 100%; height: 24px; } + /* Phone tile type (hivecommons/hive#16601): --fs-2xs has no :root value, so + the label/subline above inherit the 16px body size and read as large as + the number on a phone. Pin them to defined tokens at this width. */ + @media (max-width: 720px) { + .overview-kpi-label { font-size: var(--fs-base); } + .overview-kpi-subline { font-size: var(--fs-md); } + } .overview-kpi-coverage[data-coverage-state="success"] { --overview-coverage-color: var(--green); } .overview-kpi-coverage[data-coverage-state="warn"] { --overview-coverage-color: var(--yellow); } .overview-kpi-coverage[data-coverage-state="danger"] { --overview-coverage-color: var(--red); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index aa350a10b5..994342cfee 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -3228,23 +3228,34 @@ .overview-repo-filter { display: grid; gap: var(--sp-2); max-height: min(16rem, 32vh); overflow: auto; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); } .overview-settings-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); } .overview-headline { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); } - .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; } + /* Every headline child must be allowed to shrink to the card: the grid's + single auto track otherwise grows to the widest min-content child and + drags the KPI tiles past the phone viewport (hivecommons/hive#16601). */ + .overview-headline > * { min-width: 0; max-width: 100%; } + .overview-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr) auto) minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-3); align-items: stretch; min-width: 0; } .overview-kpi-operator { display: inline-flex; align-items: center; justify-content: center; align-self: start; padding-top: var(--sp-3); color: var(--muted); font-size: var(--fs-lg); font-weight: 800; line-height: 1; } .overview-kpi-coverage-spacer { width: 1px; min-height: 100%; background: var(--border); opacity: 0.8; } - .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; } + .overview-kpi-stale { display: inline-flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-2); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--orange); color: var(--orange); font-size: var(--fs-xs); font-weight: 700; justify-self: start; white-space: normal; overflow-wrap: anywhere; } @media (max-width: 1399px) { .overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .overview-kpi-operator, .overview-kpi-coverage-spacer { display: none; } } @media (max-width: 720px) { .overview-kpis { grid-template-columns: minmax(0, 1fr); } } .overview-kpi-range { display: inline-flex; gap: var(--sp-1); } .overview-kpi-range-btn { min-width: 2rem; height: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; cursor: pointer; } .overview-kpi-range-btn.active { border-color: var(--accent); color: var(--accent); } - .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; cursor: pointer; } + .overview-kpi { display: grid; gap: var(--sp-1); text-align: left; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); color: var(--text); padding: var(--sp-3); min-height: 5.9rem; min-width: 0; cursor: pointer; } .overview-kpi:hover { border-color: var(--accent); } .overview-kpi-value { font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; } .overview-kpi-label { color: var(--muted); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; } - .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; } - .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); } - .overview-kpi-spark .sparkline { width: 100%; } - .overview-kpi-spark svg { width: 100%; height: 24px; } + .overview-kpi-subline { color: var(--muted); font-size: var(--fs-2xs); line-height: 1.25; overflow-wrap: anywhere; } + .overview-kpi-spark { min-height: 24px; display: flex; align-items: end; margin-top: var(--sp-1); min-width: 0; } + .overview-kpi-spark .sparkline { width: 100%; max-width: 100%; min-width: 0; } + .overview-kpi-spark svg { width: 100%; max-width: 100%; height: 24px; } + /* Phone tile type (hivecommons/hive#16601): --fs-2xs has no :root value, so + the label/subline above inherit the 16px body size and read as large as + the number on a phone. Pin them to defined tokens at this width. */ + @media (max-width: 720px) { + .overview-kpi-label { font-size: var(--fs-base); } + .overview-kpi-subline { font-size: var(--fs-md); } + } .overview-kpi-coverage[data-coverage-state="success"] { --overview-coverage-color: var(--green); } .overview-kpi-coverage[data-coverage-state="warn"] { --overview-coverage-color: var(--yellow); } .overview-kpi-coverage[data-coverage-state="danger"] { --overview-coverage-color: var(--red); }