From cab5e7846f7d400945e134d271d1052cbf620378 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Sun, 8 Nov 2026 08:28:27 -0500 Subject: [PATCH] feat(ui): compact Security posture card on phones On phones the posture gauge now sits beside the verdict, the three live KPI tiles share one row, and fix buttons stay inline on their check row instead of dropping to a full-width block. Tablet and desktop are unchanged. --- .../src/components/security/OverviewTab.jsx | 6 ++-- frontend/src/styles/pages/_security.scss | 29 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsx index 9c413c8d..b5b75d42 100644 --- a/frontend/src/components/security/OverviewTab.jsx +++ b/frontend/src/components/security/OverviewTab.jsx @@ -6,6 +6,7 @@ import { useContributions } from '@/plugins/contributions'; import { Button } from '@/components/ui/button'; import { Pill, ScoreGauge, KpiBand, MetricCard } from '@/components/ds'; import { useTranslation } from 'react-i18next'; +import useMediaQuery from '../../hooks/useMediaQuery'; import { ShieldCheck, RefreshCw, @@ -27,6 +28,7 @@ const STATE_ICON = { pass: CheckCircle2, warn: AlertTriangle, unknown: Circle }; const OverviewTab = ({ status, onRefresh, onNavigateTab }) => { const { t } = useTranslation(); + const phone = useMediaQuery('(max-width: 640px)'); // = $breakpoint-sm // One action runs at a time; `busyKey` names it so only that row spins and // the rest disable (no double-submits against the same daemon). const [busyKey, setBusyKey] = useState(null); @@ -135,7 +137,7 @@ const OverviewTab = ({ status, onRefresh, onNavigateTab }) => {
{score !== null ? ( - + ) : (
@@ -177,7 +179,7 @@ const OverviewTab = ({ status, onRefresh, onNavigateTab }) => { const Icon = STATE_ICON[c.state]; const rowBusy = busyKey === c.key; return ( -
+
{c.label} {c.detail} diff --git a/frontend/src/styles/pages/_security.scss b/frontend/src/styles/pages/_security.scss index 4a8643a7..4acc27fc 100644 --- a/frontend/src/styles/pages/_security.scss +++ b/frontend/src/styles/pages/_security.scss @@ -271,10 +271,11 @@ margin-bottom: $space-2; border-bottom: 1px solid var(--border-soft); + // Phone: gauge beside the verdict, KPI row below at full width @media (max-width: $breakpoint-sm) { - flex-direction: column; - align-items: flex-start; - gap: $space-4; + display: grid; + grid-template-columns: 72px minmax(0, 1fr); // gauge size + gap: $space-3 $space-4; } } @@ -288,6 +289,8 @@ font-size: $text-xs; color: var(--text-faint); + @media (max-width: $breakpoint-sm) { width: 72px; height: 72px; } + svg { color: var(--text-faint); } } @@ -295,12 +298,20 @@ flex: 1; min-width: 0; - @media (max-width: $breakpoint-sm) { align-self: stretch; } + // Dissolve so verdict joins the gauge row and the KPIs span below + @media (max-width: $breakpoint-sm) { + display: contents; + + // KpiBand's wrapper is the grid item, so it must do the spanning + .sk-kpiband-wrap { grid-column: 1 / -1; margin-bottom: 0; } + } } .sec-posture__verdict { margin: 0 0 $space-3; font-size: $text-base; + + @media (max-width: $breakpoint-sm) { margin: 0; } font-weight: $font-weight-semibold; color: var(--text); } @@ -313,8 +324,10 @@ @media (max-width: $breakpoint-sm) { display: grid; - grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); // geometry: fluid tile track + grid-template-columns: repeat(3, minmax(0, 1fr)); gap: $space-2; + + .sk-kpi { padding: $space-2; gap: $space-2; } } } @@ -368,10 +381,10 @@ &:first-child { border-top: none; } @media (max-width: $breakpoint-sm) { - flex-wrap: wrap; padding-block: $space-2; - .sec-posture__fix { flex: 1 0 100%; } + // The fix button already says what to do; drop the muted detail + &--fix .sec-posture__detail { display: none; } } &--pass .sec-posture__ico { color: var(--green); } @@ -398,6 +411,8 @@ flex-shrink: 0; min-width: 124px; justify-content: center; + + @media (max-width: $breakpoint-sm) { min-width: 0; } } .sec-posture__foot {