23 lines
741 B
TypeScript
23 lines
741 B
TypeScript
"use client"
|
|
|
|
import { ArtistView } from "@/components/artist-view"
|
|
import { ArtistDetailSkeleton } 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 ArtistPage({ artistId }: { artistId: Id<"artists"> }) {
|
|
const data = useCachedQuery(api.library.browseArtistDetail, { id: artistId })
|
|
|
|
if (data === undefined) {
|
|
return <ArtistDetailSkeleton />
|
|
}
|
|
|
|
if (data === null) {
|
|
return <PageMessage>Artist not found.</PageMessage>
|
|
}
|
|
|
|
return <ArtistView artist={data.artist} albums={data.albums} />
|
|
}
|