Third sweep, 20 more sites: the rest of AdminUsers (the access-request and invite clusters), Scheduler, SettingsPanel, SetupWizard, About, Feed, KeyGate, OnboardingWizard -- and, importantly, four platform components that were still hand-rolling their own buttons: Modal's close, Banner's dismiss, SidePanel's two toggles and QueryState's retry. A platform layer that bypasses its own primitive is the same defect one level up. Hand-rolled buttons with their own geometry: 110 -> 39; Button call sites 37 -> 106. What is left is deliberate, and it is the list Button's own docstring excludes plus two families this pass refused to force: video overlay controls painted on white/N, drag handles, chip removers, accent-solid pills, the bg-card family on the signed-out screen, and sites whose paint is conditional (`suspended ? warn : neutral`) or otherwise has no variant yet. Forcing those through a className override would be unsafe without tailwind-merge, which is exactly the hazard this sprint documented. 3x tsc, eslint, knip, prettier, 689 vitest green; UAT on Settings and the About dialog (its close button and full-width CTA are both migrated), clean console.
80 lines
2.5 KiB
TypeScript
80 lines
2.5 KiB
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { qk } from "../lib/queryKeys";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Info, Sparkles } from "lucide-react";
|
|
import { api } from "../lib/api";
|
|
import { FRONTEND_VERSION, FRONTEND_SHA, FRONTEND_BUILD_DATE } from "../lib/version";
|
|
import { Button } from "./ui/Button";
|
|
import Modal from "./ui/Modal";
|
|
|
|
function fmtDate(d?: string | null): string {
|
|
if (!d) return "—";
|
|
const t = new Date(d);
|
|
return isNaN(t.getTime()) ? d : t.toLocaleString();
|
|
}
|
|
|
|
// About dialog: app + build + schema versions (frontend/backend/database), plus a
|
|
// shortcut into the release notes.
|
|
export default function About({
|
|
onClose,
|
|
onOpenReleaseNotes,
|
|
}: {
|
|
onClose: () => void;
|
|
onOpenReleaseNotes: () => void;
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const { data } = useQuery({
|
|
queryKey: qk.version(),
|
|
queryFn: api.version,
|
|
staleTime: 5 * 60_000,
|
|
});
|
|
|
|
const rows: [string, string][] = [
|
|
[
|
|
t("about.frontend"),
|
|
FRONTEND_VERSION + (FRONTEND_SHA !== "unknown" ? ` · ${FRONTEND_SHA}` : ""),
|
|
],
|
|
[
|
|
t("about.backend"),
|
|
data ? data.app_version + (data.git_sha !== "unknown" ? ` · ${data.git_sha}` : "") : "…",
|
|
],
|
|
[t("about.database"), data?.db_revision ?? "…"],
|
|
[t("about.buildDate"), fmtDate(data?.build_date ?? FRONTEND_BUILD_DATE)],
|
|
];
|
|
|
|
return (
|
|
<Modal
|
|
title={
|
|
<span className="flex items-center gap-2">
|
|
<Info className="w-5 h-5 text-accent" /> {t("about.title")}
|
|
</span>
|
|
}
|
|
onClose={onClose}
|
|
>
|
|
<div className="flex items-baseline gap-2">
|
|
<div className="text-2xl font-bold tracking-tight">
|
|
Sift<span className="text-accent">lode</span>
|
|
</div>
|
|
<div className="text-sm text-muted">v{FRONTEND_VERSION}</div>
|
|
</div>
|
|
<p className="text-sm text-muted mt-2">{t("about.tagline")}</p>
|
|
|
|
<div className="mt-4 rounded-xl border border-border overflow-hidden text-sm">
|
|
{rows.map(([k, v], i) => (
|
|
<div
|
|
key={k}
|
|
className={`flex justify-between gap-4 px-3 py-2 ${i % 2 ? "bg-surface/40" : ""}`}
|
|
>
|
|
<span className="text-muted">{k}</span>
|
|
<span className="font-medium text-right break-all">{v}</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<Button variant="primary" size="lg" className="mt-4 w-full" onClick={onOpenReleaseNotes}>
|
|
<Sparkles className="w-4 h-4" /> {t("about.whatsNew")}
|
|
</Button>
|
|
</Modal>
|
|
);
|
|
}
|