diff --git a/app/(dashboard)/certificates/components/CaTab.tsx b/app/(dashboard)/certificates/components/CaTab.tsx index af1ea5c1..c42cc686 100644 --- a/app/(dashboard)/certificates/components/CaTab.tsx +++ b/app/(dashboard)/certificates/components/CaTab.tsx @@ -18,6 +18,8 @@ import { TableHead, TableRow, Typography, + useMediaQuery, + useTheme, } from "@mui/material"; import AddIcon from "@mui/icons-material/Add"; import MoreVertIcon from "@mui/icons-material/MoreVert"; @@ -171,6 +173,8 @@ export function CaTab({ caCertificates, search, statusFilter }: Props) { const [drawerCert, setDrawerCert] = useState(false); const [deleteCert, setDeleteCert] = useState(null); const [expandedId, setExpandedId] = useState(null); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("md")); const filtered = caCertificates.filter((ca) => { // CA certs have no expiry status so if filtering by expiry, hide them @@ -179,6 +183,50 @@ export function CaTab({ caCertificates, search, statusFilter }: Props) { return true; }); + if (isMobile) { + return ( + + + + + {filtered.length === 0 ? ( + + + {search || statusFilter ? "No CA certificates match" : "No CA certificates configured."} + + + ) : ( + + {filtered.map((ca) => { + const activeCount = ca.issuedCerts.filter((c) => !c.revoked_at).length; + return ( + + + + {ca.name} + setDrawerCert(ca)} onDelete={() => setDeleteCert(ca)} /> + + + {ca.has_private_key && } + {ca.issuedCerts.length > 0 && ( + 0 ? "success" : "default"} variant="outlined" /> + )} + {formatRelativeDate(ca.created_at)} + + + + ); + })} + + )} + setDrawerCert(false)} /> + {deleteCert && setDeleteCert(null)} />} + + ); + } + return ( diff --git a/app/(dashboard)/certificates/components/ImportedTab.tsx b/app/(dashboard)/certificates/components/ImportedTab.tsx index ea665056..0b48d65f 100644 --- a/app/(dashboard)/certificates/components/ImportedTab.tsx +++ b/app/(dashboard)/certificates/components/ImportedTab.tsx @@ -4,6 +4,7 @@ import { Alert, Box, Button, + Card, Chip, IconButton, Menu, @@ -88,8 +89,26 @@ function ActionsMenu({ cert, onEdit }: { cert: ImportedCertView; onEdit: () => v ); } +function importedMobileCard(c: ImportedCertView, onEdit: () => void) { + return ( + + + + {c.name} + + + + {c.domains.slice(0, 2).join(", ")}{c.domains.length > 2 ? ` +${c.domains.length - 2} more` : ""} + + + + + ); +} + export function ImportedTab({ importedCerts, managedCerts, search, statusFilter }: Props) { const [drawerCert, setDrawerCert] = useState(false); + const mobileCardRenderer = (c: ImportedCertView) => importedMobileCard(c, () => setDrawerCert(c)); const filtered = importedCerts.filter((c) => { if (statusFilter && c.expiryStatus !== statusFilter) return false; @@ -164,6 +183,7 @@ export function ImportedTab({ importedCerts, managedCerts, search, statusFilter data={filtered} keyField="id" emptyMessage="No imported certificates match" + mobileCard={mobileCardRenderer} /> {/* Legacy managed certs */}