Files
siftlode/frontend/src/components/ReleaseNotes.tsx
T
peter a5bcd9fca2 fix: numbers follow the UI language, not the browser's
`n.toLocaleString()` groups in the BROWSER's locale, so an English UI in a
Hungarian browser printed "1 234 567" while a Hungarian UI in an English
browser printed "1,234,567" — the number half of the date defect fixed in
618ef812. One `formatNumber` in lib/format.ts (a per-language cached
Intl.NumberFormat, like the relative-time formatters beside it) now serves
every grouped figure: Stats, Scheduler, the channel columns and the stats
popover, VideoCard's view tooltip, the ItemCount pill, and formatTotalHours.

ReleaseNotes' `toLocaleDateString(undefined, …)` was the one DATE site the
previous sweep missed; it moves onto formatDate.

The new cases assert both languages and that the two differ, instead of
comparing against the runtime's own default: that default is Hungarian on the
dev box and English on a CI image, so a one-language assertion would pass
under the old bug on half the machines. Verified in Chromium on :5173 with the
browser forced to hu-HU and the UI in English — Stats, Scheduler and the
channel table all keep comma grouping.
2026-09-16 01:05:53 +02:00

86 lines
3.5 KiB
TypeScript

import { useTranslation } from "react-i18next";
import { Bug, Sparkles } from "lucide-react";
import { RELEASE_NOTES } from "../lib/releaseNotes";
import { formatDate } from "../lib/format";
import Modal from "./ui/Modal";
// The release date in the UI language — `toLocaleDateString(undefined, …)` formats in the BROWSER's
// locale, which put Hungarian-shaped dates in an English release-notes list. Unparseable input falls
// back to the raw string (a hand-written note could carry anything).
function fmtDate(d: string, lang: string): string {
return isNaN(new Date(d).getTime()) ? d : formatDate(d, lang);
}
// Public release notes (chores are intentionally omitted here). `highlight` rings the
// version the user just updated to when opened from the new-version banner.
export default function ReleaseNotes({
onClose,
highlight,
}: {
onClose: () => void;
highlight?: string;
}) {
const { t, i18n } = useTranslation();
// Ring the newest note if `highlight` isn't one of the listed versions — e.g. a Vite dev build
// where the caller's FRONTEND_VERSION is "dev", or a VERSION bump whose note hasn't landed yet —
// so the banner always rings *something* current instead of nothing.
const active = RELEASE_NOTES.some((r) => r.version === highlight)
? highlight
: RELEASE_NOTES[0]?.version;
return (
<Modal title={t("about.releaseNotes")} onClose={onClose} maxWidth="max-w-2xl">
<div className="flex flex-col gap-6">
{RELEASE_NOTES.map((r) => (
<section
key={r.version}
className={active === r.version ? "rounded-xl ring-1 ring-accent/40 p-3 -m-3" : ""}
>
<div className="flex items-baseline gap-2 flex-wrap">
<h3 className="text-base font-semibold">v{r.version}</h3>
<span className="text-xs text-muted">{fmtDate(r.date, i18n.language)}</span>
{r.sha && (
<span className="text-2xs font-mono text-muted bg-surface px-1.5 py-0.5 rounded-sm">
{r.sha}
</span>
)}
</div>
{r.summary && <p className="text-sm text-muted mt-1">{r.summary}</p>}
{r.features?.length ? (
<div className="mt-3">
<div className="flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-accent">
<Sparkles className="w-3.5 h-3.5" /> {t("about.new")}
</div>
<ul className="mt-1.5 space-y-1.5 text-sm">
{r.features.map((f, i) => (
<li key={i} className="flex gap-2">
<span className="text-accent">•</span>
<span>{f}</span>
</li>
))}
</ul>
</div>
) : null}
{r.fixes?.length ? (
<div className="mt-3">
<div className="flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted">
<Bug className="w-3.5 h-3.5" /> {t("about.fixes")}
</div>
<ul className="mt-1.5 space-y-1.5 text-sm">
{r.fixes.map((f, i) => (
<li key={i} className="flex gap-2">
<span className="text-muted">•</span>
<span>{f}</span>
</li>
))}
</ul>
</div>
) : null}
</section>
))}
</div>
</Modal>
);
}