Files
otunes/apps/web/app/(app)/library/artists/[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

47 lines
1.3 KiB
TypeScript

import { fetchQuery } from "convex/nextjs"
import { ArtistsView } from "@/components/artists-view"
import { api } from "@otunes/convex/_generated/api"
import { Metadata } from "next"
interface PageProps {
params: Promise<{ id: string }>
}
export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
const { id } = await params
const artists = await fetchQuery(api.library.browseArtists)
const selectedArtist = artists.find((artist) => artist.id === id)
return {
title: `${selectedArtist ? `${selectedArtist.name}` : "oTunes"}`,
openGraph: {
title: `${selectedArtist ? `${selectedArtist.name}` : "oTunes"}`,
description: "oTunes",
images: selectedArtist
? {
url: `/api/artist/${selectedArtist.id}/cover`,
width: 512,
height: 512,
}
: [],
},
}
}
export default async function Page({ params }: PageProps) {
const { id } = await params
const artists = await fetchQuery(api.library.browseArtists)
const albums = await fetchQuery(api.library.browseAlbums)
return (
<div className="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>
<ArtistsView artists={artists} albums={albums} artistId={id} />
</div>
)
}