Files
otunes/apps/web/app/(app)/artist/[id]/page.tsx
T
joshuafhiggins 73c7283d4d Add Expo mobile app and extract shared Convex package
- 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
2026-08-02 04:14:01 +00:00

78 lines
2.0 KiB
TypeScript

import { fetchQuery } from "convex/nextjs"
import { ArtistView } from "@/components/artist-view"
import { LibraryLoading } from "@/components/library-loading"
import { api } from "@otunes/convex/_generated/api"
import type { Id } from "@otunes/convex/_generated/dataModel"
import { Metadata } from "next"
interface PageProps {
params: Promise<{ id: string }>
}
export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
const { id } = await params
const data = await fetchQuery(api.library.browseArtistDetail, {
id: id as Id<"artists">,
})
return {
title: `${data ? `${data.artist.name}` : "oTunes"}`,
openGraph: {
title: `${data ? `${data.artist.name}` : "oTunes"}`,
description: "oTunes",
images: data
? {
url: `/api/artist/${data.artist.id}/cover`,
width: 512,
height: 512,
}
: [],
},
}
}
export default async function Page({ params }: PageProps) {
const { id } = await params
const data = await fetchQuery(api.library.browseArtistDetail, {
id: id as Id<"artists">,
})
if (data === undefined) {
return (
<div className="flex h-svh flex-col">
<LibraryLoading />
</div>
)
}
if (data === null) {
return (
<div className="flex h-svh flex-col">
<div className="flex flex-1 items-center justify-center pb-28">
<p className="text-sm text-muted-foreground">Artist not found.</p>
</div>
</div>
)
}
return (
<>
<title>{`${data.artist.name}`}</title>
<meta property="og:title" content={`${data.artist.name}`} />
{/*<meta property="og:description" content={`${playlist.owner.name}`} />*/}
<meta
property="og:image"
content={`/api/artist/${data.artist.id}/cover`}
/>
<ArtistView
artist={data.artist}
albums={data.albums}
recentlyAdded={data.recentlyAdded}
recentlyPlayed={data.recentlyPlayed}
/>
</>
)
}