'use client'; import { useState, useEffect } from 'react'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { ScrollArea } from '@/components/ui/scroll-area'; // Current app version from package.json const APP_VERSION = '2025.07.01'; // Changelog data - add new versions at the top const CHANGELOG = [ { version: '2025.07.01', title: 'July New Month Update', changes: [ 'Integrated standalone Last.fm scrobbling support', 'Added collapsible sidebar with icon-only mode', 'Improved search and browsing experience', 'Added history tracking for played songs', 'New Library Artist Page', 'Enhanced audio player with better controls', 'Added settings page for customization options', 'Introduced Whats New popup for version updates', 'Improved UI consistency with new Badge component', 'New Favorites page with album, song, and artist sections', ], breaking: [], fixes: [ 'Fixed issue with audio player not resuming playback after pause', 'Resolved bug with search results not displaying correctly', 'Improved performance for large libraries', 'Fixed layout issues on smaller screens', 'Resolved scrobbling issues with Last.fm integration' ] }, // Example previous version { version: '2025.06.15', title: 'June Final Update', changes: [ 'Added dark mode toggle', 'Improved playlist management', ], breaking: [], fixes: [ 'Fixed login bug', ] } ]; type TabType = 'latest' | 'archive'; export function WhatsNewPopup() { const [isOpen, setIsOpen] = useState(false); const [tab, setTab] = useState('latest'); const [selectedArchive, setSelectedArchive] = useState(CHANGELOG[1]?.version || ''); useEffect(() => { const hasCompletedOnboarding = localStorage.getItem('onboarding-completed'); if (!hasCompletedOnboarding) return; const lastShownVersion = localStorage.getItem('whats-new-last-shown'); if (lastShownVersion !== APP_VERSION) { setIsOpen(true); } }, []); const handleClose = () => { localStorage.setItem('whats-new-last-shown', APP_VERSION); setIsOpen(false); }; const currentVersionChangelog = CHANGELOG.find(entry => entry.version === APP_VERSION); const archiveChangelogs = CHANGELOG.filter(entry => entry.version !== APP_VERSION); // For archive, show selected version const archiveChangelog = archiveChangelogs.find(entry => entry.version === selectedArchive) || archiveChangelogs[0]; if (!currentVersionChangelog) { return null; } const renderChangelog = (changelog: typeof CHANGELOG[0]) => (
{changelog.title && (

{changelog.title}

)} {changelog.changes.length > 0 && (

✨ New Features & Improvements

    {changelog.changes.map((change, index) => (
  • {change}
  • ))}
)} {changelog.fixes.length > 0 && (

🐛 Bug Fixes

    {changelog.fixes.map((fix, index) => (
  • {fix}
  • ))}
)} {changelog.breaking.length > 0 && (

⚠️ Breaking Changes

    {changelog.breaking.map((breaking, index) => (
  • {breaking}
  • ))}
)}
); return (
What's New in Mice {tab === 'latest' ? currentVersionChangelog.version : archiveChangelog?.version}
{/* Tabs */}
{tab === 'archive' && archiveChangelogs.length > 0 && ( )}
{tab === 'latest' ? renderChangelog(currentVersionChangelog) : archiveChangelog && renderChangelog(archiveChangelog)}
); }