35 lines
854 B
TypeScript
35 lines
854 B
TypeScript
"use client"
|
|
|
|
import { AlbumView } from "@/components/album-view"
|
|
import { CollectionDetailSkeleton } from "@/components/library-skeletons"
|
|
import { PageMessage } from "@/components/page-message"
|
|
import { useCachedQuery } from "@/hooks/use-cached-query"
|
|
import { api } from "@otunes/convex/_generated/api"
|
|
import type { Id } from "@otunes/convex/_generated/dataModel"
|
|
|
|
export function AlbumPage({
|
|
albumId,
|
|
highlightedSongId,
|
|
}: {
|
|
albumId: Id<"albums">
|
|
highlightedSongId?: string
|
|
}) {
|
|
const album = useCachedQuery(api.library.browseAlbumDetail, { id: albumId })
|
|
|
|
if (album === undefined) {
|
|
return <CollectionDetailSkeleton />
|
|
}
|
|
|
|
if (album === null) {
|
|
return <PageMessage>Album not found.</PageMessage>
|
|
}
|
|
|
|
return (
|
|
<AlbumView
|
|
key={album.id}
|
|
album={album}
|
|
highlightedSongId={highlightedSongId}
|
|
/>
|
|
)
|
|
}
|