The app HAS a platform layer -- AnchoredPopover (22 importers, with arrows/typeahead/Escape/anchor-flip), QueryState (21), Modal (17), PageShell, DataTable, Tabs, Tooltip and ~26 more -- but it sat flat among ~160 feature components with nothing marking it as one. Several of those files describe themselves as 'the one place' or 'canonical' and were still bypassed by hand-rolled markup, because a layer nobody can see is a layer nobody uses; three separate inventory passes of this codebase misread it the same way. Moves the 33 domain-free modules into components/ui/, rewrites the imports in 89 files, and makes the boundary a lint rule rather than a convention: inside ui/ a one-level-up import (a feature component) and any lib/api slice are errors. The rule was verified to fire on both and to leave generic lib/ helpers alone. README.md states which side of the line a component belongs on and why. No behaviour change: 3x tsc, eslint, knip, prettier and 687 vitest tests all green; no backend file touched.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Sparkles } from "lucide-react";
|
|
import { FRONTEND_VERSION, SEEN_VERSION_KEY } from "../lib/version";
|
|
import Banner from "./ui/Banner";
|
|
|
|
// Eye-catching, dismissible bar shown once after the running build's version changes
|
|
// (compares the baked frontend version to the last one the user acknowledged).
|
|
export default function VersionBanner({ onOpen }: { onOpen: () => void }) {
|
|
const { t } = useTranslation();
|
|
const [dismissed, setDismissed] = useState(false);
|
|
const seen = localStorage.getItem(SEEN_VERSION_KEY);
|
|
// Don't nag in un-stamped dev builds, or once this version has been seen.
|
|
const show = FRONTEND_VERSION !== "dev" && seen !== FRONTEND_VERSION && !dismissed;
|
|
if (!show) return null;
|
|
|
|
function markSeen() {
|
|
localStorage.setItem(SEEN_VERSION_KEY, FRONTEND_VERSION);
|
|
setDismissed(true);
|
|
}
|
|
|
|
return (
|
|
<Banner
|
|
tone="accent"
|
|
icon={Sparkles}
|
|
action={{
|
|
label: t("header.banner.releaseNotes"),
|
|
onClick: () => {
|
|
onOpen();
|
|
markSeen();
|
|
},
|
|
}}
|
|
onDismiss={markSeen}
|
|
dismissTitle={t("header.banner.dismiss")}
|
|
>
|
|
{t("header.banner.updated", { version: FRONTEND_VERSION })}
|
|
</Banner>
|
|
);
|
|
}
|