- 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
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { useQuery } from "convex/react"
|
|
import { ScrollView, StyleSheet, View } from "react-native"
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
|
|
import { AlbumCard } 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 type { BrowseAlbum } from "@otunes/convex/types"
|
|
import { spacing, useThemeColors } from "@/lib/theme"
|
|
|
|
export default function AlbumsScreen() {
|
|
const colors = useThemeColors()
|
|
const albums = useQuery(api.library.browseAlbums)
|
|
|
|
return (
|
|
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]} edges={["top"]}>
|
|
<ScreenHeader title="Albums" />
|
|
{albums === undefined ? (
|
|
<LoadingView />
|
|
) : (
|
|
<ScrollView contentContainerStyle={[styles.content, { paddingBottom: contentBottomInset }]}>
|
|
<View style={styles.grid}>
|
|
{albums.map((album: BrowseAlbum) => (
|
|
<AlbumCard key={album.id} album={album} />
|
|
))}
|
|
</View>
|
|
</ScrollView>
|
|
)}
|
|
</SafeAreaView>
|
|
)
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
safe: { flex: 1 },
|
|
content: { padding: spacing.lg },
|
|
grid: { flexDirection: "row", flexWrap: "wrap", gap: spacing.lg },
|
|
})
|