Skip to content

An AI-powered search engine with a generative UI

feat: add changelog notification banner system

Yoshiki Miurab04c5a9ec3d3
diff --git a/app/page.tsx b/app/page.tsx
index 7cb53da5..61a6dd9d 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,10 +1,16 @@
import { getModels } from '@/lib/config/models'
import { generateId } from '@/lib/db/schema'
+import { ChangelogBanner } from '@/components/changelog-banner'
import { Chat } from '@/components/chat'
export default async function Page() {
const id = generateId()
const models = await getModels()
- return <Chat id={id} models={models} />
+ return (
+ <>
+ <Chat id={id} models={models} />
+ <ChangelogBanner />
+ </>
+ )
}
diff --git a/components/changelog-banner.tsx b/components/changelog-banner.tsx
new file mode 100644
index 00000000..ed9b7bc7
--- /dev/null
+++ b/components/changelog-banner.tsx
@@ -0,0 +1,37 @@
+'use client'
+
+import { X } from 'lucide-react'
+
+import { useChangelog } from '@/hooks/use-changelog'
+
+export function ChangelogBanner() {
+ const { changelog, isVisible, dismiss } = useChangelog()
+
+ if (!isVisible || !changelog) return null
+
+ return (
+ <div className="fixed bottom-4 right-4 z-40 animate-in slide-in-from-bottom-5 duration-300">
+ <div className="relative bg-background/95 backdrop-blur border rounded-lg shadow-sm p-3 pr-6 max-w-[300px]">
+ <button
+ onClick={dismiss}
+ className="absolute -top-2 -right-2 bg-background border rounded-full p-1 text-muted-foreground hover:text-foreground transition-colors shadow-sm"
+ aria-label="Close"
+ >
+ <X className="h-3 w-3" />
+ </button>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 mb-1">
+ <span className="text-xs px-1.5 py-0.5 bg-muted rounded-md font-mono">
+ v{changelog.version}
+ </span>
+ </div>
+ <ul className="text-xs text-muted-foreground space-y-0.5">
+ {changelog.features.map((feature, index) => (
+ <li key={index}>• {feature}</li>
+ ))}
+ </ul>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/hooks/use-changelog.ts b/hooks/use-changelog.ts
new file mode 100644
index 00000000..cd4529d5
--- /dev/null
+++ b/hooks/use-changelog.ts
@@ -0,0 +1,61 @@
+import { useEffect, useState } from 'react'
+
+interface Changelog {
+ version: string
+ date: string
+ features: string[]
+ showUntil?: string
+ dismissKey: string
+}
+
+export function useChangelog() {
+ const [changelog, setChangelog] = useState<Changelog | null>(null)
+ const [isVisible, setIsVisible] = useState(false)
+
+ useEffect(() => {
+ async function fetchChangelog() {
+ try {
+ const response = await fetch('/changelog.json')
+ const data = await response.json()
+
+ if (data.current) {
+ const dismissKey = data.current.dismissKey
+ const isDismissed = localStorage.getItem(dismissKey)
+
+ // Check expiration date
+ if (data.current.showUntil) {
+ const showUntilDate = new Date(data.current.showUntil)
+ const now = new Date()
+ if (now > showUntilDate) {
+ return // Expired, don't show
+ }
+ }
+
+ if (!isDismissed) {
+ setChangelog(data.current)
+ // Delay display to avoid immediate popup on page load
+ setTimeout(() => setIsVisible(true), 1500)
+ }
+ }
+ } catch (error) {
+ // Silent fail - notifications are not critical
+ console.debug('Failed to fetch changelog', error)
+ }
+ }
+
+ fetchChangelog()
+ }, [])
+
+ const dismiss = () => {
+ if (changelog) {
+ localStorage.setItem(changelog.dismissKey, 'true')
+ setIsVisible(false)
+ }
+ }
+
+ return {
+ changelog,
+ isVisible,
+ dismiss
+ }
+}
diff --git a/public/changelog.json b/public/changelog.json
new file mode 100644
index 00000000..d9cf46e1
--- /dev/null
+++ b/public/changelog.json
@@ -0,0 +1,14 @@
+{
+ "current": {
+ "version": "0.5.0",
+ "date": "2025-01-10",
+ "features": [
+ "AI model selection",
+ "Langfuse integration",
+ "Improved search results"
+ ],
+ "showUntil": "2025-01-20",
+ "dismissKey": "changelog-v0.5.0"
+ },
+ "history": []
+}