fix(release-notes): ring the newest entry when the highlight version is unknown
/code-review (S1, finding 3): C-3.19 switched the banner from CURRENT_VERSION (always RELEASE_NOTES[0]) to FRONTEND_VERSION (VITE_APP_VERSION), which is "dev" in the Vite dev server and can drift from the notes — so the modal highlighted nothing. The modal (which already imports RELEASE_NOTES, keeping App decoupled) now falls back to the newest note when the passed version isn't listed.
This commit is contained in:
@@ -20,13 +20,19 @@ export default function ReleaseNotes({
|
|||||||
highlight?: string;
|
highlight?: string;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = 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 (
|
return (
|
||||||
<Modal title={t("about.releaseNotes")} onClose={onClose} maxWidth="max-w-2xl">
|
<Modal title={t("about.releaseNotes")} onClose={onClose} maxWidth="max-w-2xl">
|
||||||
<div className="flex flex-col gap-6">
|
<div className="flex flex-col gap-6">
|
||||||
{RELEASE_NOTES.map((r) => (
|
{RELEASE_NOTES.map((r) => (
|
||||||
<section
|
<section
|
||||||
key={r.version}
|
key={r.version}
|
||||||
className={highlight === r.version ? "rounded-xl ring-1 ring-accent/40 p-3 -m-3" : ""}
|
className={active === r.version ? "rounded-xl ring-1 ring-accent/40 p-3 -m-3" : ""}
|
||||||
>
|
>
|
||||||
<div className="flex items-baseline gap-2 flex-wrap">
|
<div className="flex items-baseline gap-2 flex-wrap">
|
||||||
<h3 className="text-base font-semibold">v{r.version}</h3>
|
<h3 className="text-base font-semibold">v{r.version}</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user