mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
The settings and admin shells reserved the page-heading height in the left nav with a hidden replica block. The replica wrapped differently in the 220px nav column than the real heading in the wide content column, so the first nav item sat too low and drifted across locales. Hoist the heading into the shell and place it in its own grid row spanning only the content column: row 1 holds the heading, row 2 holds the nav and the cards. The nav's first item and the first card now start the same grid row, so they align by construction regardless of how the title or subtitle wraps. Drop the spacer component.
69 lines
2.5 KiB
TypeScript
69 lines
2.5 KiB
TypeScript
"use client";
|
|
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import { useTranslations } from "@/lib/i18n/context";
|
|
import { AdminShell } from "@/components/admin/admin-shell";
|
|
import { SystemStatusSummary } from "@/components/admin/system-status-summary";
|
|
import { VersionTileSection } from "@/components/admin/version-tile-section";
|
|
import { RecentAuditPreview } from "@/components/admin/recent-audit-preview";
|
|
import { useAdminSettings } from "@/components/admin/_shared";
|
|
|
|
/**
|
|
* `/admin` — overview landing page. v1.4.15 (phase A2) replaces the
|
|
* previous status-card grid + section quick-jump menu with two
|
|
* at-a-glance panes: a compact system snapshot and the 10 most recent
|
|
* audit entries. The section navigation is already exposed in the
|
|
* shell sidebar (and in the global app sidebar after Phase 4b), so the
|
|
* old grid duplicated existing nav. See `.planning/phase-A2-report.md`.
|
|
*/
|
|
export default function AdminOverviewPage() {
|
|
const { user } = useAuth();
|
|
const { t } = useTranslations();
|
|
// Surface admin-settings fetch failures once at the top of the page.
|
|
// Many sub-sections share `useAdminSettings()` and render defaults
|
|
// silently on error — the banner makes the failure visible so the
|
|
// admin knows the toggles below aren't reflecting real state.
|
|
const { isError: settingsError } = useAdminSettings();
|
|
|
|
if (!user || user.role !== "ADMIN") return null;
|
|
|
|
return (
|
|
<AdminShell>
|
|
<div className="space-y-6">
|
|
{/* v1.18.6.1 — the console title + subtitle render in `<AdminShell>`
|
|
now (its own grid row, so the nav lines up with the first card). */}
|
|
{settingsError && (
|
|
<div
|
|
role="alert"
|
|
className="text-destructive bg-destructive/10 border-destructive/30 rounded-md border px-3 py-2 text-sm"
|
|
>
|
|
{t("admin.adminSettingsLoadError")}
|
|
</div>
|
|
)}
|
|
|
|
{/* Welcome card — greeting with admin context indicator. */}
|
|
<section
|
|
aria-labelledby="admin-overview-welcome-heading"
|
|
className="bg-card border-border rounded-xl border p-6"
|
|
>
|
|
<h2
|
|
id="admin-overview-welcome-heading"
|
|
className="text-lg font-semibold"
|
|
>
|
|
{t("admin.overview.welcomeTitle", { name: user.username })}
|
|
</h2>
|
|
<p className="text-muted-foreground mt-1 text-sm">
|
|
{t("admin.overview.welcomeSubtitle")}
|
|
</p>
|
|
</section>
|
|
|
|
<VersionTileSection />
|
|
|
|
<SystemStatusSummary />
|
|
|
|
<RecentAuditPreview />
|
|
</div>
|
|
</AdminShell>
|
|
);
|
|
}
|