'use client'; import { ScrollArea, ScrollBar } from '../components/ui/scroll-area'; import { Separator } from '../components/ui/separator'; import { Tabs, TabsContent } from '../components/ui/tabs'; import { AlbumArtwork } from './components/album-artwork'; import { useNavidrome } from './components/NavidromeContext'; import { useEffect, useState } from 'react'; import { Album } from '@/lib/navidrome'; import { LoginForm } from '@/app/components/start-screen'; export default function MusicPage() { const { albums, isLoading} = useNavidrome(); const [recentAlbums, setRecentAlbums] = useState([]); const [newestAlbums, setNewestAlbums] = useState([]); useEffect(() => { if (albums.length > 0) { // Split albums into recent and newest for display const recent = albums.slice(0, Math.ceil(albums.length / 2)); const newest = albums.slice(Math.ceil(albums.length / 2)); setRecentAlbums(recent); setNewestAlbums(newest); } }, [albums]); return (
<>

Recently Added

Latest additions to your music library.

{isLoading ? ( // Loading skeletons Array.from({ length: 6 }).map((_, i) => (
)) ) : ( recentAlbums.map((album) => ( )) )}

Your Library

Albums from your music collection.

{isLoading ? ( // Loading skeletons Array.from({ length: 10 }).map((_, i) => (
)) ) : ( newestAlbums.map((album) => ( )) )}
); }