- 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
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import { useQuery } from "convex/react"
|
|
|
|
import { ContentCarousel } from "@/components/content-carousel"
|
|
import { LibraryLoading } from "@/components/library-loading"
|
|
import { api } from "@otunes/convex/_generated/api"
|
|
|
|
export default function Page() {
|
|
const recentlyAdded = useQuery(api.library.browseRecentlyAdded)
|
|
const recentlyPlayed = useQuery(api.library.browseRecentlyPlayed)
|
|
|
|
if (recentlyAdded === undefined || recentlyPlayed === undefined) {
|
|
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">Home</h1>
|
|
</header>
|
|
<LibraryLoading />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
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">Home</h1>
|
|
</header>
|
|
|
|
<div className="flex-1 overflow-y-auto p-6 pb-28">
|
|
<div className="flex flex-col gap-10">
|
|
{recentlyPlayed.length > 0 ? (
|
|
<ContentCarousel
|
|
title="Recently Played"
|
|
href="/recently-played"
|
|
content={recentlyPlayed.slice(0, 9)}
|
|
/>
|
|
) : null}
|
|
<ContentCarousel
|
|
title="Recently Added"
|
|
href="/recently-added"
|
|
content={recentlyAdded.slice(0, 9)}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|