From 71b1cae5ab7a01e9bcc7cc115622155084345eeb Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Mon, 9 Nov 2026 22:22:32 -0500 Subject: [PATCH] fix(ui): keep page actions together on narrow screens View bar search now shrinks instead of orphaning the icon buttons; 4-tile KPI bands go 4 across or 2x2 (never 3+1); topbar search wraps to its own full-width row at tablet width instead of overflowing; SSL secondary actions collapse into an overflow menu on phones. --- frontend/src/components/ds/KpiBand.jsx | 1 + frontend/src/pages/SSLCertificates.jsx | 86 +++++++++++++------ frontend/src/styles/components/_datagrid.scss | 7 +- .../src/styles/components/_design-system.scss | 15 ++++ 4 files changed, 83 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/ds/KpiBand.jsx b/frontend/src/components/ds/KpiBand.jsx index 96948ffc..b0847d1a 100644 --- a/frontend/src/components/ds/KpiBand.jsx +++ b/frontend/src/components/ds/KpiBand.jsx @@ -83,6 +83,7 @@ export function KpiBand({
{primary}
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx index 54094190..0ab8c644 100644 --- a/frontend/src/pages/SSLCertificates.jsx +++ b/frontend/src/pages/SSLCertificates.jsx @@ -1,7 +1,7 @@ import { useState, useEffect, useId, useMemo } from 'react'; import { ShieldCheck, RefreshCw, Plus, Lock, MoreVertical, - Settings, Download, Upload, + Settings, Download, Upload, MoreHorizontal, } from 'lucide-react'; import api from '../services/api'; import Modal from '@/components/Modal'; @@ -24,6 +24,7 @@ import { import DomainField from '../components/DomainField'; import { formatExpiry } from '../utils/expiry'; import { useTranslation } from 'react-i18next'; +import useMediaQuery from '@/hooks/useMediaQuery'; import { toastError } from '@/utils/errorMessage'; import { formatDateTime } from '@/utils/intl'; @@ -98,6 +99,7 @@ const SSL_BUILTIN_VIEWS = [ const SSLCertificates = () => { const { t } = useTranslation(); + const phone = useMediaQuery('(max-width: 639px)'); const fieldId = useId(); const toast = useToast(); const { confirm } = useConfirm(); @@ -471,37 +473,71 @@ const SSLCertificates = () => { {t('app.sSLCertificates.installCertbot', 'Install Certbot')} )} - - {certificates.length > 0 && ( - + {phone ? ( + // Phones: the secondary actions share one overflow menu so the + // bar stays a single row; Install Certbot / New certificate stay out. + + + + + + + + {t('app.sSLCertificates.autoRenew2', 'Auto-renew')} + + {certificates.length > 0 && ( + + + {t('app.sSLCertificates.renewAll', 'Renew all')} + + )} + + + {t('common.actions.refresh', 'Refresh')} + + setShowUploadModal(true)}> + + {t('app.sSLCertificates.upload', 'Upload')} + + + + ) : ( + <> + + {certificates.length > 0 && ( + + )} + + + )} - - - ), [actionLoading, certbotInstalled, certbotMissing, certificates.length, search]); + ), [actionLoading, certbotInstalled, certbotMissing, certificates.length, search, phone]); return ( <> diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss index 627ea64e..d302e8c1 100644 --- a/frontend/src/styles/components/_datagrid.scss +++ b/frontend/src/styles/components/_datagrid.scss @@ -60,10 +60,15 @@ &__actions { display: flex; align-items: center; - flex-wrap: wrap; + // No wrap: the search shrinks, so an icon button is never orphaned. When + // the bar itself wraps, this group takes its own row, icons together. + flex-wrap: nowrap; + flex: 0 1 auto; min-width: 0; gap: $space-2; margin-inline-start: auto; + + > * { flex-shrink: 0; } } // Amber, not red: unsaved tweaks are a state, not an error. diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss index 785a8fec..ec96fade 100644 --- a/frontend/src/styles/components/_design-system.scss +++ b/frontend/src/styles/components/_design-system.scss @@ -275,6 +275,7 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); flex-direction: column; gap: $space-3; margin-bottom: $space-5; + container-type: inline-size; } .sk-kpiband { @@ -290,6 +291,11 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); @media (max-width: 560px) { grid-template-columns: 1fr 1fr; } + // Four tiles: 4 across or 2x2, never the 3+1 auto-fit gives at tablet width. + // Measured on the band's own container, so a sidebar-narrowed page agrees. + @container (max-width: 820px) { + &[data-cols='4'] { grid-template-columns: repeat(2, minmax(0, 1fr)); } + } // Skeleton tile — same geometry as .sk-kpi so content doesn't jump on load. &__skel { @@ -1517,6 +1523,7 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); &__actions { order: 2; width: 100%; + flex-wrap: wrap; min-width: 0; justify-content: flex-start; overflow-x: auto; @@ -1528,6 +1535,11 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); > *, > .sk-topbar__chrome > * { flex-shrink: 0; } + // The search takes what is left on its row and wraps to a row of its + // own (full width) when even its minimum doesn't fit — never offscreen. + > .sk-searchfield, + > .sk-topbar__chrome > .sk-searchfield { flex: 1 1 180px; max-width: none; min-width: 0; } + &::-webkit-scrollbar { display: none; } } &__tabs { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; } @@ -1669,6 +1681,9 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); min-width: 180px; max-width: 420px; + // Inside a view bar it shrinks before its icon buttons would wrap. + .sk-viewbar__actions > & { flex: 1 1 auto; min-width: 96px; } + &__icon { position: absolute; left: 11px;