import { Html } from '@elysiajs/html'; import type { Children } from '@kitajs/html'; export default function RootLayout({ title, authed, wide, children }: { title?: string; authed: boolean; // Bumps the main column to 6xl for pages with wide data tables // (e.g. accounts). Defaults to the standard 4xl reading column. wide?: boolean; children: Children; }) { const mainClass = wide ? 'max-w-6xl w-full px-6 py-8 flex flex-col gap-6' : 'max-w-4xl w-full px-6 py-8 flex flex-col gap-6'; const navInnerClass = wide ? 'max-w-6xl mx-auto w-full px-6 py-4 flex flex-row items-center gap-6' : 'max-w-4xl mx-auto w-full px-6 py-4 flex flex-row items-center gap-6'; return ( {title ? `${title} · safekeeper` : 'safekeeper'}
{children}
); } export function fmtBytes(bytes: number | null | undefined): string { if (bytes == null) return '—'; const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']; let n = bytes; let u = 0; while (n >= 1024 && u < units.length - 1) { n /= 1024; u += 1; } return `${n.toFixed(u === 0 ? 0 : 2)} ${units[u]}`; } export function fmtDate(d: Date | null | undefined): string { if (!d) return 'never'; return d.toISOString().replace('T', ' ').slice(0, 19) + ' UTC'; }