diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-20 11:31:17 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-20 11:31:17 +0200 |
| commit | 3e89d2998588f8e35c524e523ba2ee853f0f6475 (patch) | |
| tree | 57221f96c1259b3b07e3ddf8c1adefc502b9d8eb /apps/web/src/lib/changelog/components/changelog-notification.tsx | |
| parent | 729d10592f4e802f91c555c309ff3ba4b119f843 (diff) | |
| download | opencut-3e89d2998588f8e35c524e523ba2ee853f0f6475.tar.gz | |
refactor: restructure files to their domains, new preview overlay system, and dep graph
Diffstat (limited to 'apps/web/src/lib/changelog/components/changelog-notification.tsx')
| -rw-r--r-- | apps/web/src/lib/changelog/components/changelog-notification.tsx | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/apps/web/src/lib/changelog/components/changelog-notification.tsx b/apps/web/src/lib/changelog/components/changelog-notification.tsx deleted file mode 100644 index 4433df30..00000000 --- a/apps/web/src/lib/changelog/components/changelog-notification.tsx +++ /dev/null @@ -1,87 +0,0 @@ -"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<Release | null>(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 - } - - const isOutdated = - storedVersion === null || - storedVersion.localeCompare(latest.version, undefined, { - numeric: true, - }) < 0; - - // TODO(v0.4): revert to the standard "null = first-time visitor, record silently" - // path. The null case intentionally shows the card for this release so existing - // users who never had the key get the 0.3.0 announcement. - if (!isOutdated) return; - - try { - localStorage.setItem(STORAGE_KEY, latest.version); - } catch { - // ignore - } - - setRelease(latest); - }, []); - - if (!release) return null; - - return ( - <div className="fixed bottom-5 left-5 z-50 flex w-72 flex-col gap-3 rounded-xl border bg-card p-4 shadow-lg"> - <div className="flex items-start justify-between gap-2"> - <div className="flex flex-col gap-1"> - <span className="text-sm font-semibold leading-snug"> - {release.title} - </span> - <span className="text-xs text-muted-foreground"> - v{release.version} - </span> - </div> - <Button - variant="ghost" - size="icon" - className="-mr-1 -mt-1 shrink-0" - onClick={() => setRelease(null)} - aria-label="Dismiss" - > - <HugeiconsIcon icon={Cancel01Icon} className="size-4" /> - </Button> - </div> - - {release.summary && ( - <p className="text-xs leading-relaxed text-muted-foreground"> - {release.summary} - </p> - )} - - <div className="flex justify-end"> - <Button asChild size="sm"> - <Link href="/changelog" onClick={() => setRelease(null)}> - See full changelog - </Link> - </Button> - </div> - </div> - ); -} |
