- Replace mobile placeholder with Expo Router app (tabs, playback, auth, library) - Move Convex backend to @otunes/convex for web and mobile reuse - Update web app imports and API routes to use shared package
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { useQuery } from "convex/react"
|
|
import { Plus } from "lucide-react"
|
|
|
|
import { useAddToPlaylist } from "@/components/add-to-playlist-provider"
|
|
import { LibraryLoading } from "@/components/library-loading"
|
|
import { PlaylistCard } from "@/components/playlist-card"
|
|
import { Button } from "@/components/ui/button"
|
|
import { api } from "@otunes/convex/_generated/api"
|
|
|
|
export default function Page() {
|
|
const playlists = useQuery(api.playlists.listAllPlaylists)
|
|
const { openCreatePlaylist } = useAddToPlaylist()
|
|
|
|
return (
|
|
<div className="flex h-svh flex-col">
|
|
<header className="flex items-center justify-between gap-2 border-b px-4 py-3">
|
|
<h1 className="text-lg font-semibold">Playlists</h1>
|
|
<Button
|
|
variant="secondary"
|
|
size="sm"
|
|
className="gap-2"
|
|
onClick={openCreatePlaylist}
|
|
>
|
|
<Plus className="size-4" />
|
|
New Playlist
|
|
</Button>
|
|
</header>
|
|
|
|
{playlists === undefined ? (
|
|
<LibraryLoading />
|
|
) : (
|
|
<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">
|
|
{playlists.map((playlist) => (
|
|
<PlaylistCard key={playlist.id} playlist={playlist} />
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|