diff --git a/app/components/WhatsNewPopup.tsx b/app/components/WhatsNewPopup.tsx index e5d894b..c0a7ab6 100644 --- a/app/components/WhatsNewPopup.tsx +++ b/app/components/WhatsNewPopup.tsx @@ -5,17 +5,11 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/u 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 = '2025.07.01'; // Changelog data - add new versions at the top - -// title can be like this -// "month New Month Update" -// "month Mid-Month Update" -// "month Final Update" const CHANGELOG = [ { version: '2025.07.01', @@ -40,111 +34,164 @@ const CHANGELOG = [ '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(() => { - // 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); + 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 - {currentVersionChangelog.version} + What's New in Mice + + {tab === 'latest' ? currentVersionChangelog.version : archiveChangelog?.version} + - {/*

- Released on {currentVersionChangelog.date} -

*/}
+ {/* Tabs */} +
+ + + {tab === 'archive' && archiveChangelogs.length > 0 && ( + + )} +
+ -
- {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} -
  • - ))} -
-
- )} -
+ {tab === 'latest' + ? renderChangelog(currentVersionChangelog) + : archiveChangelog && renderChangelog(archiveChangelog)}
-
+