A pure move (git mv, history kept): 333 files leave components/, which now holds only the platform layer (ui/) and the legal pages. The shell is the frame (App, header, nav rail, palette, boot); each page lives in modules/<page>/ with its rail, store and tests; what several pages share sits in features/<name>/; the shared-link page is watch/. Domain-free helpers went straight to ui/ (ViewSwitcher, FilterRail, the confirm dialog, the language switcher, the copy rows). Every relative specifier was rewritten (imports, dynamic imports, vi.mock, new URL), and the contract tests that scan sources now scan the whole app source, not only components/ — each glob was counted before and after so none went green over fewer files. The locale-format rule matched `/src/components/` only, so the move would have taken ~300 files out from under its i18n-singleton check; it now covers every folder that holds components, with a test per folder.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { Sparkles } from "lucide-react";
|
|
import { FRONTEND_VERSION, SEEN_VERSION_OPTIONS, SEEN_VERSION_PREF } from "../lib/version";
|
|
import { usePref } from "../lib/usePref";
|
|
import Banner from "../components/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 [seen, setSeen] = usePref(SEEN_VERSION_PREF, null, SEEN_VERSION_OPTIONS);
|
|
// Don't nag in un-stamped dev builds, or once this version has been seen.
|
|
const show = FRONTEND_VERSION !== "dev" && seen !== FRONTEND_VERSION;
|
|
if (!show) return null;
|
|
|
|
const markSeen = () => setSeen(FRONTEND_VERSION);
|
|
|
|
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>
|
|
);
|
|
}
|