From 370944f443cb997ef71dda0c8ef6f4e92bea87d7 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 15 Apr 2026 02:05:41 +0200 Subject: feat: new-release notice and colocate changelog under domain --- .../components/changelog-notification.tsx | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 apps/web/src/lib/changelog/components/changelog-notification.tsx (limited to 'apps/web/src/lib/changelog/components/changelog-notification.tsx') diff --git a/apps/web/src/lib/changelog/components/changelog-notification.tsx b/apps/web/src/lib/changelog/components/changelog-notification.tsx new file mode 100644 index 00000000..c45eaaac --- /dev/null +++ b/apps/web/src/lib/changelog/components/changelog-notification.tsx @@ -0,0 +1,90 @@ +"use client"; + +import { useState, useEffect } from "react"; +import Link from "next/link"; +import { Cancel01Icon } from "@hugeicons/core-free-icons"; +import { HugeiconsIcon } from "@hugeicons/react"; +import { Button } from "@/components/ui/button"; +import { getSortedReleases } from "../utils"; +import type { Release } from "../utils"; + +const STORAGE_KEY = "last-seen-version"; + +export function ChangelogNotification() { + const [release, setRelease] = useState(null); + + useEffect(() => { + const releases = getSortedReleases(); + const latest = releases[0]; + if (!latest) return; + + let storedVersion: string | null = null; + try { + storedVersion = localStorage.getItem(STORAGE_KEY); + } catch { + // localStorage unavailable + } + + // First-time visitor: record the version silently, nothing to announce. + if (storedVersion === null) { + try { + localStorage.setItem(STORAGE_KEY, latest.version); + } catch { + // ignore + } + return; + } + + // Already seen this version. + if (storedVersion === latest.version) return; + + // New version since last visit: record it and show the notification. + try { + localStorage.setItem(STORAGE_KEY, latest.version); + } catch { + // ignore + } + + setRelease(latest); + }, []); + + if (!release) return null; + + return ( +
+
+
+ + {release.title} + + + v{release.version} + +
+ +
+ + {release.summary && ( +

+ {release.summary} +

+ )} + +
+ +
+
+ ); +} -- cgit v1.3.1