mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
refactor(admin): the console speaks the Settings vocabulary without an accent
Twenty-six of twenty-eight admin files already used the Settings card and header. What made the console read as its own system was everything on top of that: three hand-rolled cards, a header slot that meant five different things, and a heading the frame took but never painted. - `SectionFrame` drops `title` and `subtitle`. Seventeen call sites passed both into a component that has rendered neither since v1.18.6.1 — the shell reads the same keys itself. A prop contract nothing honours is a promise the next reader believes. - The invite card, the four host-metric headers, and the `/admin` welcome card stop hand-rolling `bg-card border rounded-xl` shells with their own padding steps and their own heading weights. `text-sm` as a card title on the first card of a page, directly above a correct one, was the first thing the eye landed on. - The header status slot carries status. The backups run, the invite create, the danger-zone wipe, and the user filters come out of it; the app-log refresh stays but reads as the secondary it is. - Loading states paint their card and header. Encryption returned a bare spinner row and then a card, so the section jumped when the status landed — the fix `coach-feedback-section.tsx` already carried, applied where it was missing. Same for the notification-status card. - One label/value tile. `StatusItem`, the encryption section's private `Stat`, the user-management inline panels and the backups upload box were four fills and three paddings for one role. - The overview stopped printing the running version, build SHA and build time twice, thirty pixels apart. The version tile owns build identity — it is the one that checks for a newer release; the snapshot owns what is running. - `ai-server-key` had three paragraphs stacked in a muted `text-xs` slot; one sentence stays there and the two that carry information move into the body as foreground. The central-codex consent copy moves the same way, and its disconnect is `variant="destructive"` — which `ConfirmButton` refused to accept, so every destructive confirm in the tree had been hand-tinting an outline instead. - Leftovers: the `-mt-2` correcting the card's own rhythm, two alpha hovers on text, `text-[10px]` badges, the redundant `space-y-6` wrapper, the empty state repeating the header's CTA, and the `mt-6` a card added inside a frame that already spaces its children.
This commit is contained in:
1 parent
b2e1aa0cde
commit
330f60115a
27 files changed
+472
-569
No files matched your search
@@ -21,6 +21,8 @@ import { Loader2, ShieldAlert, Sparkles, Trash2 } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { SettingsInfoTile } from "@/components/settings/_info-tile";
|
||||
import { SettingsCardActions } from "@/components/settings/_card-actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ConfirmButton } from "@/components/ui/confirm-button";
|
||||
import { SettingsCard } from "@/components/settings/settings-card";
|
||||
@@ -167,10 +169,9 @@ export function CentralCodexSection() {
|
||||
/>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="text-muted-foreground flex items-start gap-2 text-xs">
|
||||
<ShieldAlert className="mt-0.5 size-3.5 shrink-0" aria-hidden />
|
||||
<p className="min-w-0">{t("admin.centralCodex.honesty")}</p>
|
||||
</div>
|
||||
<SettingsInfoTile icon={ShieldAlert} tone="warning">
|
||||
<p className="text-foreground">{t("admin.centralCodex.honesty")}</p>
|
||||
</SettingsInfoTile>
|
||||
|
||||
{data?.connectedAt && isConnected && (
|
||||
<p className="text-muted-foreground text-xs">
|
||||
@@ -181,25 +182,27 @@ export function CentralCodexSection() {
|
||||
)}
|
||||
|
||||
{isConnected ? (
|
||||
<ConfirmButton
|
||||
slot="admin-central-codex-disconnect"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="text-destructive min-h-11 shrink-0 sm:min-h-9"
|
||||
icon={<Trash2 className="h-4 w-4" />}
|
||||
label={t("admin.centralCodex.disconnectButton")}
|
||||
title={t("admin.centralCodex.disconnectTitle")}
|
||||
body={t("admin.centralCodex.disconnectBody")}
|
||||
confirmLabel={t("admin.centralCodex.disconnectConfirm")}
|
||||
pending={disconnecting}
|
||||
onConfirm={handleDisconnect}
|
||||
/>
|
||||
<SettingsCardActions>
|
||||
<ConfirmButton
|
||||
slot="admin-central-codex-disconnect"
|
||||
variant="destructive"
|
||||
size="sm"
|
||||
className="min-h-11 shrink-0 sm:min-h-9"
|
||||
icon={<Trash2 className="h-4 w-4" />}
|
||||
label={t("admin.centralCodex.disconnectButton")}
|
||||
title={t("admin.centralCodex.disconnectTitle")}
|
||||
body={t("admin.centralCodex.disconnectBody")}
|
||||
confirmLabel={t("admin.centralCodex.disconnectConfirm")}
|
||||
pending={disconnecting}
|
||||
onConfirm={handleDisconnect}
|
||||
/>
|
||||
</SettingsCardActions>
|
||||
) : deviceCode ? (
|
||||
<div className="border-primary bg-primary/5 space-y-3 rounded-lg border-l-4 p-4">
|
||||
<p className="text-sm font-medium">
|
||||
{t("settings.ai.deviceCodeHeading")}
|
||||
</p>
|
||||
<ol className="text-muted-foreground list-decimal space-y-2 pl-5 text-sm">
|
||||
<ol className="text-muted-foreground list-decimal space-y-2 pl-6 text-sm">
|
||||
<li>
|
||||
{t("settings.ai.deviceCodeStep1")}{" "}
|
||||
<a
|
||||
@@ -248,20 +251,22 @@ export function CentralCodexSection() {
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleConnect}
|
||||
disabled={devicePolling}
|
||||
className="min-h-11 w-full sm:min-h-9 sm:w-auto"
|
||||
data-slot="admin-central-codex-connect"
|
||||
>
|
||||
{devicePolling ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : (
|
||||
<Sparkles className="h-4 w-4" />
|
||||
)}
|
||||
{t("admin.centralCodex.connectButton")}
|
||||
</Button>
|
||||
<SettingsCardActions>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={handleConnect}
|
||||
disabled={devicePolling}
|
||||
className="min-h-11 w-full sm:min-h-9 sm:w-auto"
|
||||
data-slot="admin-central-codex-connect"
|
||||
>
|
||||
{devicePolling ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : (
|
||||
<Sparkles className="h-4 w-4" />
|
||||
)}
|
||||
{t("admin.centralCodex.connectButton")}
|
||||
</Button>
|
||||
</SettingsCardActions>
|
||||
)}
|
||||
</div>
|
||||
</SettingsCard>
|
||||
|
||||
Reference in new issue
Block a user