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

67 lines
2.2 KiB
TypeScript

import { useQuery } from "convex/react"
import { useRouter } from "expo-router"
import { Pressable, ScrollView, StyleSheet, Text } from "react-native"
import { SafeAreaView } from "react-native-safe-area-context"
import { Image } from "expo-image"
import { ScreenHeader } from "@/components/screen-header"
import { LoadingView } from "@/components/ui/primitives"
import { contentBottomInset } from "@/components/player"
import { useServerConfig } from "@/contexts/server-config"
import { api } from "@otunes/convex/_generated/api"
import type { BrowseArtist } from "@otunes/convex/types"
import { artistCoverUrl } from "@/lib/urls"
import { radius, spacing, useThemeColors } from "@/lib/theme"
export default function ArtistsScreen() {
const router = useRouter()
const colors = useThemeColors()
const { config } = useServerConfig()
const artists = useQuery(api.library.browseArtists)
return (
<SafeAreaView style={[styles.safe, { backgroundColor: colors.background }]} edges={["top"]}>
<ScreenHeader title="Artists" />
{artists === undefined || !config ? (
<LoadingView />
) : (
<ScrollView contentContainerStyle={{ paddingBottom: contentBottomInset }}>
{artists.map((artist: BrowseArtist) => (
<Pressable
key={artist.id}
style={[styles.row, { borderBottomColor: colors.border }]}
onPress={() => router.push(`/artist/${artist.id}`)}
>
<Image
source={{ uri: artistCoverUrl(config.serverUrl, artist.id) }}
style={styles.avatar}
contentFit="cover"
/>
<Text style={[styles.name, { color: colors.foreground }]}>{artist.name}</Text>
</Pressable>
))}
</ScrollView>
)}
</SafeAreaView>
)
}
const styles = StyleSheet.create({
safe: { flex: 1 },
row: {
flexDirection: "row",
alignItems: "center",
gap: spacing.md,
paddingHorizontal: spacing.lg,
paddingVertical: spacing.md,
borderBottomWidth: StyleSheet.hairlineWidth,
},
avatar: {
width: 44,
height: 44,
borderRadius: 22,
backgroundColor: "#eee",
},
name: { fontSize: 16, fontWeight: "600" },
})