Files
otunes/apps/mobile/app/(app)/(tabs)/playlists.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

49 lines
1.6 KiB
TypeScript

import { useQuery } from "convex/react"
import { ScrollView, StyleSheet, View } from "react-native"
import { SafeAreaView } from "react-native-safe-area-context"
import { PlaylistCard } from "@/components/media-cards"
import { ScreenHeader } from "@/components/screen-header"
import { Button, LoadingView } from "@/components/ui/primitives"
import { contentBottomInset } from "@/components/player"
import { useAddToPlaylist } from "@/contexts/add-to-playlist"
import { api } from "@otunes/convex/_generated/api"
import type { PlaylistSummary } from "@otunes/convex/types"
import { spacing, useThemeColors } from "@/lib/theme"
export default function PlaylistsTabScreen() {
const colors = useThemeColors()
const playlists = useQuery(api.playlists.listAllPlaylists)
const { openCreatePlaylist } = useAddToPlaylist()
return (
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]} edges={["top"]}>
<ScreenHeader
title="Playlists"
right={<Button title="New" variant="secondary" onPress={openCreatePlaylist} />}
/>
{playlists === undefined ? (
<LoadingView />
) : (
<ScrollView contentContainerStyle={[styles.content, { paddingBottom: contentBottomInset }]}>
<View style={styles.grid}>
{playlists.map((playlist: PlaylistSummary) => (
<PlaylistCard key={playlist.id} playlist={playlist} />
))}
</View>
</ScrollView>
)}
</SafeAreaView>
)
}
const styles = StyleSheet.create({
safe: { flex: 1 },
content: { padding: spacing.lg },
grid: {
flexDirection: "row",
flexWrap: "wrap",
gap: spacing.lg,
},
})