feat: basic library UI and sidebar

This commit is contained in:
joshuafhiggins committed 2026-05-30 23:26:57 -04:00 Verified
1 parent a24b5c3b62
commit 3869ae4844
11 files changed
+511 -12

No files matched your search

+2
View File
@@ -34,3 +34,5 @@ pnpm-debug.log*
# typescript
*.tsbuildinfo
next-env.d.ts
/.idea
+8 -1
View File
@@ -3,6 +3,8 @@ import { Geist, Geist_Mono, Inter } from "next/font/google"
import "./globals.css"
import { ThemeProvider } from "@/components/theme-provider"
import { cn } from "@/lib/utils";
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
import { AppSidebar } from "@/components/app-sidebar"
const inter = Inter({subsets:['latin'],variable:'--font-sans'})
@@ -23,7 +25,12 @@ export default function RootLayout({
className={cn("antialiased", fontMono.variable, "font-sans", inter.variable)}
>
<body>
<ThemeProvider>{children}</ThemeProvider>
<ThemeProvider>
<SidebarProvider>
<AppSidebar />
<SidebarInset>{children}</SidebarInset>
</SidebarProvider>
</ThemeProvider>
</body>
</html>
)
+83
View File
@@ -0,0 +1,83 @@
import { AlbumCard, type Album } from "@/components/album-card"
import { PlayerBar } from "@/components/player-bar"
const page: Album[] = [
{ title: "Live from the Hollywood Bowl", artist: "AJR", cover: null },
{ title: "Ends of the Earth", artist: "The Longest Johns", cover: null },
{ title: "The Parting Glass - Single", artist: "The Ramparts", cover: null },
{
title: "Fairytale of New York - Single",
artist: "The Ramparts",
cover: null,
},
{
title: "The Rocky Road to Dublin - Single",
artist: "The Ramparts",
cover: null,
},
{ title: "1778 - EP", artist: "The Wellermen", cover: null },
{ title: "The High Kings", artist: "The High Kings", cover: null },
{ title: "The Fall-Off", artist: "J. Cole", cover: null },
{ title: "Enchanted Isle", artist: "VOCES8", cover: null },
{ title: "Unknown Album", artist: "", cover: null },
{
title: "Song of Durin (Complete Edition)",
artist: "Clamavi De Profundis",
cover: null,
},
{
title: "Sid Meier's Civilization V (Soundtrack)",
artist: "Geoff Knorr & Michael Curran",
cover: null,
},
{
title: "The Last Goodbye - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "Do You Hear the People Sing? - Single",
artist: "Seth Staton Watkins & Aaron Dolan",
cover: null,
},
{
title: "Fiddler's Green - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "The Orange and the Green - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "Horse Soldier, Horse Soldier - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "My Mother Told Me (feat. 3lake) - Single",
artist: "Seth Staton Watkins",
cover: null,
},
]
export default function Page() {
return (
<div className="relative flex h-svh flex-col">
<header className="flex items-center gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Albums</h1>
</header>
<div className="flex-1 overflow-y-auto p-6 pb-28">
<div className="grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{page.map((album) => (
<AlbumCard key={album.title} album={album} />
))}
</div>
</div>
<PlayerBar />
</div>
)
}
+83
View File
@@ -0,0 +1,83 @@
import { AlbumCard, type Album } from "@/components/album-card"
import { PlayerBar } from "@/components/player-bar"
const page: Album[] = [
{ title: "Live from the Hollywood Bowl", artist: "AJR", cover: null },
{ title: "Ends of the Earth", artist: "The Longest Johns", cover: null },
{ title: "The Parting Glass - Single", artist: "The Ramparts", cover: null },
{
title: "Fairytale of New York - Single",
artist: "The Ramparts",
cover: null,
},
{
title: "The Rocky Road to Dublin - Single",
artist: "The Ramparts",
cover: null,
},
{ title: "1778 - EP", artist: "The Wellermen", cover: null },
{ title: "The High Kings", artist: "The High Kings", cover: null },
{ title: "The Fall-Off", artist: "J. Cole", cover: null },
{ title: "Enchanted Isle", artist: "VOCES8", cover: null },
{ title: "Unknown Album", artist: "", cover: null },
{
title: "Song of Durin (Complete Edition)",
artist: "Clamavi De Profundis",
cover: null,
},
{
title: "Sid Meier's Civilization V (Soundtrack)",
artist: "Geoff Knorr & Michael Curran",
cover: null,
},
{
title: "The Last Goodbye - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "Do You Hear the People Sing? - Single",
artist: "Seth Staton Watkins & Aaron Dolan",
cover: null,
},
{
title: "Fiddler's Green - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "The Orange and the Green - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "Horse Soldier, Horse Soldier - Single",
artist: "Seth Staton Watkins",
cover: null,
},
{
title: "My Mother Told Me (feat. 3lake) - Single",
artist: "Seth Staton Watkins",
cover: null,
},
]
export default function Page() {
return (
<div className="relative flex h-svh flex-col">
<header className="flex items-center gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Artists</h1>
</header>
<div className="flex-1 overflow-y-auto p-6 pb-28">
<div className="grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{page.map((album) => (
<AlbumCard key={album.title} album={album} />
))}
</div>
</div>
<PlayerBar />
</div>
)
}
+43
View File
@@ -0,0 +1,43 @@
import { AlbumCard, type Album } from "@/components/album-card"
import { PlayerBar } from "@/components/player-bar"
const albums: Album[] = [
{ title: "Live from the Hollywood Bowl", artist: "AJR", cover: null },
{ title: "Ends of the Earth", artist: "The Longest Johns", cover: null },
{ title: "The Parting Glass - Single", artist: "The Ramparts", cover: null },
{ title: "Fairytale of New York - Single", artist: "The Ramparts", cover: null },
{ title: "The Rocky Road to Dublin - Single", artist: "The Ramparts", cover: null },
{ title: "1778 - EP", artist: "The Wellermen", cover: null },
{ title: "The High Kings", artist: "The High Kings", cover: null },
{ title: "The Fall-Off", artist: "J. Cole", cover: null },
{ title: "Enchanted Isle", artist: "VOCES8", cover: null },
{ title: "Unknown Album", artist: "", cover: null },
{ title: "Song of Durin (Complete Edition)", artist: "Clamavi De Profundis", cover: null },
{ title: "Sid Meier's Civilization V (Soundtrack)", artist: "Geoff Knorr & Michael Curran", cover: null },
{ title: "The Last Goodbye - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "Do You Hear the People Sing? - Single", artist: "Seth Staton Watkins & Aaron Dolan", cover: null },
{ title: "Fiddler's Green - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "The Orange and the Green - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "Horse Soldier, Horse Soldier - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "My Mother Told Me (feat. 3lake) - Single", artist: "Seth Staton Watkins", cover: null },
]
export default function Page() {
return (
<div className="relative flex h-svh flex-col">
<header className="flex items-center gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Recently Added</h1>
</header>
<div className="flex-1 overflow-y-auto p-6 pb-28">
<div className="grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{albums.map((album) => (
<AlbumCard key={album.title} album={album} />
))}
</div>
</div>
<PlayerBar />
</div>
)
}
+35 -11
View File
@@ -1,19 +1,43 @@
import { Button } from "@/components/ui/button"
import { AlbumCard, type Album } from "@/components/album-card"
import { PlayerBar } from "@/components/player-bar"
const albums: Album[] = [
{ title: "Live from the Hollywood Bowl", artist: "AJR", cover: null },
{ title: "Ends of the Earth", artist: "The Longest Johns", cover: null },
{ title: "The Parting Glass - Single", artist: "The Ramparts", cover: null },
{ title: "Fairytale of New York - Single", artist: "The Ramparts", cover: null },
{ title: "The Rocky Road to Dublin - Single", artist: "The Ramparts", cover: null },
{ title: "1778 - EP", artist: "The Wellermen", cover: null },
{ title: "The High Kings", artist: "The High Kings", cover: null },
{ title: "The Fall-Off", artist: "J. Cole", cover: null },
{ title: "Enchanted Isle", artist: "VOCES8", cover: null },
{ title: "Unknown Album", artist: "", cover: null },
{ title: "Song of Durin (Complete Edition)", artist: "Clamavi De Profundis", cover: null },
{ title: "Sid Meier's Civilization V (Soundtrack)", artist: "Geoff Knorr & Michael Curran", cover: null },
{ title: "The Last Goodbye - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "Do You Hear the People Sing? - Single", artist: "Seth Staton Watkins & Aaron Dolan", cover: null },
{ title: "Fiddler's Green - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "The Orange and the Green - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "Horse Soldier, Horse Soldier - Single", artist: "Seth Staton Watkins", cover: null },
{ title: "My Mother Told Me (feat. 3lake) - Single", artist: "Seth Staton Watkins", cover: null },
]
export default function Page() {
return (
<div className="flex min-h-svh p-6">
<div className="flex max-w-md min-w-0 flex-col gap-4 text-sm leading-loose">
<div>
<h1 className="font-medium">Project ready!</h1>
<p>You may now add components and start building.</p>
<p>We&apos;ve already added the button component for you.</p>
<Button className="mt-2">Button</Button>
</div>
<div className="font-mono text-xs text-muted-foreground">
(Press <kbd>d</kbd> to toggle dark mode)
<div className="relative flex h-svh flex-col">
<header className="flex items-center gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Recently Added</h1>
</header>
<div className="flex-1 overflow-y-auto p-6 pb-28">
<div className="grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{albums.map((album) => (
<AlbumCard key={album.title} album={album} />
))}
</div>
</div>
<PlayerBar />
</div>
)
}
+48
View File
@@ -0,0 +1,48 @@
import Image from "next/image"
import Link from "next/link"
export type Album = {
// id: string
title: string
artist: string
// artistID: string
cover: string | null
}
export function AlbumCard({ album }: { album: Album }) {
return (
<div className="group flex flex-col gap-2">
<Link
className="relative flex aspect-square items-center justify-center overflow-hidden rounded-lg ring-1 ring-foreground/10"
href={"/library/albums/" + album.title}
>
{album.cover ? (
<Image
src={album.cover}
alt={album.title}
fill
sizes="(max-width: 640px) 50vw, (max-width: 1024px) 25vw, 16vw"
className="object-cover"
/>
) : (
<Image
src="/placeholder-album.svg"
alt={album.title}
fill
className="object-cover"
/>
)}
</Link>
<div className="min-w-0">
<Link href={"/library/albums/" + album.title}>
<p className="truncate text-sm font-medium">{album.title}</p>
</Link>
<Link href={"/library/artists/" + album.title}>
<p className="truncate text-xs text-muted-foreground">
{album.artist}
</p>
</Link>
</div>
</div>
)
}
+135
View File
@@ -0,0 +1,135 @@
"use client"
import {
Disc3,
House,
ListMusic,
Mic,
Music2,
Search,
} from "lucide-react"
import { useRouter, usePathname } from "next/navigation"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar"
import Image from "next/image"
const browse = [
{ title: "Search", path: "", icon: Search },
{ title: "Home", path: "/", icon: House },
]
const library = [
{ title: "Recently Added", path: "/library/recently-added", icon: ListMusic },
{ title: "Artists", path: "/library/artists", icon: Mic },
{ title: "Albums", path: "/library/albums", icon: Disc3 },
{ title: "Songs", path: "/library/songs", icon: Music2 },
]
const playlists = [
{ title: "All Playlists", path: "", icon: ListMusic },
{ title: "Favorite Songs", path: "", icon: ListMusic },
{ title: "Choir & Bands", path: "", icon: ListMusic },
{ title: "Plays", path: "", icon: ListMusic },
{ title: "Sea Shanties", path: "", icon: ListMusic },
{ title: "Stay Civilized", path: "", icon: ListMusic },
]
export function AppSidebar() {
const router = useRouter()
const pathname = usePathname()
return (
<Sidebar>
<SidebarHeader>
<div className="flex items-center gap-1 px-2 py-1">
<Image src={"/logo.svg"} alt={"oTunes"} width={20} height={20} className="size-5 dark:invert" />
<span className="text-lg font-semibold tracking-tight">oTunes</span>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupContent>
<SidebarMenu>
{browse.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
isActive={pathname === item.path}
onClick={() => router.push(item.path)}
>
<item.icon />
<span>{item.title}</span>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
<SidebarGroup>
<SidebarGroupLabel>Library</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{library.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
isActive={pathname === item.path}
onClick={() => router.push(item.path)}
>
<item.icon />
<span>{item.title}</span>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
<SidebarGroup>
<SidebarGroupLabel>Playlists</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{playlists.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
isActive={pathname === item.path}
onClick={() => router.push(item.path)}
>
<item.icon />
<span>{item.title}</span>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg">
<Avatar size="sm">
<AvatarFallback>JH</AvatarFallback>
</Avatar>
<span>Joshua Higgins</span>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarFooter>
</Sidebar>
)
}
+60
View File
@@ -0,0 +1,60 @@
import {
ListMusic,
Music,
Pause,
Repeat,
Shuffle,
SkipBack,
SkipForward,
Volume2,
} from "lucide-react"
import { Button } from "@/components/ui/button"
export function PlayerBar() {
return (
<div className="pointer-events-none absolute inset-x-0 bottom-0 z-10 flex justify-center px-4 pb-4">
<div className="pointer-events-auto flex w-full max-w-3xl items-center gap-3 rounded-xl border bg-card/80 px-3 py-2 shadow-lg backdrop-blur">
<div className="flex items-center gap-1">
<Button variant="ghost" size="icon" aria-label="Shuffle">
<Shuffle />
</Button>
<Button variant="ghost" size="icon" aria-label="Previous">
<SkipBack />
</Button>
<Button variant="ghost" size="icon" aria-label="Play">
<Pause />
</Button>
<Button variant="ghost" size="icon" aria-label="Next">
<SkipForward />
</Button>
<Button variant="ghost" size="icon" aria-label="Repeat">
<Repeat />
</Button>
</div>
<div className="flex min-w-0 flex-1 items-center justify-center gap-3 rounded-lg bg-muted/60 px-3 py-1.5">
<div className="size-8 shrink-0 rounded bg-gradient-to-br from-emerald-500 to-teal-800" />
<div className="min-w-0 text-center">
<p className="truncate text-sm font-medium">Ends of the Earth</p>
<p className="truncate text-xs text-muted-foreground">
The Longest Johns — Ends of the Earth
</p>
</div>
</div>
<div className="flex items-center gap-1">
<Button variant="ghost" size="icon" aria-label="Lyrics">
<Music />
</Button>
<Button variant="ghost" size="icon" aria-label="Queue">
<ListMusic />
</Button>
<Button variant="ghost" size="icon" aria-label="Volume">
<Volume2 />
</Button>
</div>
</div>
</div>
)
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="209" height="256" viewBox="0 0 814 1000"><path d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>

After

Width:  |  Height:  |  Size: 678 B

+13
View File
@@ -0,0 +1,13 @@
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" width="100" height="100"><style>:root {
--icon: rgba(60, 60, 67, 0.18);
--bg: #e3e3e3;
color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
:root {
--icon: rgba(235, 235, 245, 0.16);
--bg: #323232;
}
}
</style><g fill="none" fill-rule="evenodd"><path fill="var(--bg)" d="M0 0h100v100H0z"></path><path fill="var(--icon)" d="M34.098 73.66c3.256 0 8.153-2.404 8.153-8.873v-21c0-1.146.202-1.393 1.235-1.596L61.5 38.485c1.146-.247 1.595.045 1.595 1.078l.157 14.083c0 1.146-.584 1.865-1.64 2.09l-3.346.74c-4.493.966-6.694 3.078-6.694 6.447 0 3.347 2.718 5.795 6.424 5.795 3.257 0 8.064-2.291 8.064-8.738V28.76c0-2.112-.966-2.763-3.392-2.291l-21.27 4.402c-1.483.292-2.27 1.1-2.27 2.381l.136 25.358c0 1.056-.494 1.775-1.438 1.954l-3.504.72c-4.447.943-6.558 3.166-6.558 6.603 0 3.391 2.628 5.772 6.334 5.772Z" fill-rule="nonzero"></path></g></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB