'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'; import { X } from 'lucide-react'; // Current app version from package.json const APP_VERSION = '1.0.0'; // Changelog data - add new versions at the top const CHANGELOG = [ { version: '1.0.0', date: '2025-07-01', title: 'Initial Release', changes: [ 'Added Favorites functionality for albums, songs, and artists', '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', ], breaking: [], fixes: [] } ]; export function WhatsNewPopup() { const [isOpen, setIsOpen] = useState(false); useEffect(() => { // Only show for users who have completed onboarding const hasCompletedOnboarding = localStorage.getItem('onboarding-completed'); if (!hasCompletedOnboarding) return; // Check if we've shown the popup for this version const lastShownVersion = localStorage.getItem('whats-new-last-shown'); if (lastShownVersion !== APP_VERSION) { setIsOpen(true); } }, []); const handleClose = () => { // Mark this version as shown localStorage.setItem('whats-new-last-shown', APP_VERSION); setIsOpen(false); }; const currentVersionChangelog = CHANGELOG.find(entry => entry.version === APP_VERSION); if (!currentVersionChangelog) { return null; } return (
What's New in mice {currentVersionChangelog.version}

Released on {currentVersionChangelog.date}

{currentVersionChangelog.title && (

{currentVersionChangelog.title}

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

✨ New Features & Improvements

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

🐛 Bug Fixes

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

⚠️ Breaking Changes

    {currentVersionChangelog.breaking.map((breaking, index) => (
  • {breaking}
  • ))}
)}
); }