- 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
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { useQuery } from "convex/react"
|
|
import { ScrollView, StyleSheet } from "react-native"
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
|
|
import { ContentCarousel } from "@/components/media-cards"
|
|
import { ScreenHeader } from "@/components/screen-header"
|
|
import { LoadingView } from "@/components/ui/primitives"
|
|
import { contentBottomInset } from "@/components/player"
|
|
import { api } from "@otunes/convex/_generated/api"
|
|
import { spacing, useThemeColors } from "@/lib/theme"
|
|
|
|
export default function HomeScreen() {
|
|
const colors = useThemeColors()
|
|
const recentlyAdded = useQuery(api.library.browseRecentlyAdded)
|
|
const recentlyPlayed = useQuery(api.library.browseRecentlyPlayed)
|
|
|
|
if (recentlyAdded === undefined || recentlyPlayed === undefined) {
|
|
return (
|
|
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]}>
|
|
<ScreenHeader title="Home" />
|
|
<LoadingView />
|
|
</SafeAreaView>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]} edges={["top"]}>
|
|
<ScreenHeader title="Home" />
|
|
<ScrollView
|
|
contentContainerStyle={[styles.content, { paddingBottom: contentBottomInset }]}
|
|
>
|
|
{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)}
|
|
/>
|
|
</ScrollView>
|
|
</SafeAreaView>
|
|
)
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
safe: { flex: 1 },
|
|
content: {
|
|
padding: spacing.lg,
|
|
gap: spacing.xl,
|
|
},
|
|
})
|