From 0ff352e11a169394a9227e68332ab2a06f331c50 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Mon, 15 Jun 2026 09:22:59 -0400 Subject: [PATCH] feat: initial mobile app UI pass --- apps/mobile/.gitignore | 7 +- apps/mobile/app.json | 5 +- apps/mobile/app/(app)/(tabs)/_layout.tsx | 176 +++-- apps/mobile/app/(app)/(tabs)/home/_layout.tsx | 7 + apps/mobile/app/(app)/(tabs)/home/index.tsx | 46 ++ apps/mobile/app/(app)/(tabs)/index.tsx | 55 -- apps/mobile/app/(app)/(tabs)/library.tsx | 67 -- .../app/(app)/(tabs)/library/_layout.tsx | 7 + .../mobile/app/(app)/(tabs)/library/index.tsx | 109 +++ apps/mobile/app/(app)/(tabs)/more.tsx | 137 ---- apps/mobile/app/(app)/(tabs)/more/_layout.tsx | 7 + apps/mobile/app/(app)/(tabs)/more/index.tsx | 135 ++++ apps/mobile/app/(app)/(tabs)/playlists.tsx | 48 -- .../app/(app)/(tabs)/playlists/_layout.tsx | 29 + .../app/(app)/(tabs)/playlists/index.tsx | 31 + .../app/(app)/(tabs)/search/_layout.tsx | 7 + .../(tabs)/{search.tsx => search/index.tsx} | 49 +- apps/mobile/app/(app)/_layout.tsx | 44 +- apps/mobile/app/(app)/album/[id].tsx | 48 +- apps/mobile/app/(app)/artist/[id].tsx | 58 +- apps/mobile/app/(app)/index.tsx | 5 + apps/mobile/app/(app)/library/albums.tsx | 34 +- apps/mobile/app/(app)/library/artists.tsx | 50 +- apps/mobile/app/(app)/library/songs.tsx | 16 +- apps/mobile/app/(app)/player.tsx | 380 +++++++++ apps/mobile/app/(app)/playlist/[id].tsx | 48 +- apps/mobile/app/(app)/playlist/favorites.tsx | 30 +- apps/mobile/app/(app)/queue.tsx | 130 ++- apps/mobile/app/(app)/recently-added.tsx | 26 +- apps/mobile/app/(app)/recently-played.tsx | 28 +- apps/mobile/app/(app)/settings.tsx | 21 +- apps/mobile/app/(auth)/_layout.tsx | 25 +- apps/mobile/app/_layout.tsx | 12 +- apps/mobile/app/index.tsx | 13 +- apps/mobile/app/server.tsx | 14 +- apps/mobile/components/auth-form.tsx | 10 +- .../components/authenticated-redirect.tsx | 24 + apps/mobile/components/media-cards.tsx | 100 ++- apps/mobile/components/mini-player.tsx | 342 ++++++++ apps/mobile/components/player.tsx | 196 +---- apps/mobile/components/screen-header.tsx | 34 - apps/mobile/contexts/playback.tsx | 220 ++++-- apps/mobile/contexts/server-config.tsx | 31 +- apps/mobile/lib/auth-storage.ts | 30 +- apps/mobile/lib/format.ts | 5 + apps/mobile/lib/navigation.ts | 37 + apps/mobile/lib/server-config.ts | 5 +- apps/mobile/lib/session.ts | 11 + apps/mobile/lib/theme.ts | 92 ++- apps/mobile/package.json | 7 +- pnpm-lock.yaml | 744 ++++++++++++------ 51 files changed, 2534 insertions(+), 1258 deletions(-) create mode 100644 apps/mobile/app/(app)/(tabs)/home/_layout.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/home/index.tsx delete mode 100644 apps/mobile/app/(app)/(tabs)/index.tsx delete mode 100644 apps/mobile/app/(app)/(tabs)/library.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/library/_layout.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/library/index.tsx delete mode 100644 apps/mobile/app/(app)/(tabs)/more.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/more/_layout.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/more/index.tsx delete mode 100644 apps/mobile/app/(app)/(tabs)/playlists.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/playlists/_layout.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/playlists/index.tsx create mode 100644 apps/mobile/app/(app)/(tabs)/search/_layout.tsx rename apps/mobile/app/(app)/(tabs)/{search.tsx => search/index.tsx} (72%) create mode 100644 apps/mobile/app/(app)/index.tsx create mode 100644 apps/mobile/app/(app)/player.tsx create mode 100644 apps/mobile/components/authenticated-redirect.tsx create mode 100644 apps/mobile/components/mini-player.tsx delete mode 100644 apps/mobile/components/screen-header.tsx create mode 100644 apps/mobile/lib/navigation.ts create mode 100644 apps/mobile/lib/session.ts diff --git a/apps/mobile/.gitignore b/apps/mobile/.gitignore index c9258ff..4359542 100644 --- a/apps/mobile/.gitignore +++ b/apps/mobile/.gitignore @@ -1,2 +1,7 @@ ios/ -android/ \ No newline at end of file +android/ +# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb +# The following patterns were generated by expo-cli + +expo-env.d.ts +# @end expo-cli \ No newline at end of file diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 0dd12f4..5ef104a 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -21,9 +21,10 @@ "expo-router", "expo-secure-store", [ - "expo-av", + "expo-audio", { - "microphonePermission": false + "microphonePermission": false, + "enableBackgroundPlayback": true } ] ], diff --git a/apps/mobile/app/(app)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/_layout.tsx index daf3aa3..bd5f1ae 100644 --- a/apps/mobile/app/(app)/(tabs)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/_layout.tsx @@ -1,68 +1,122 @@ -import { Ionicons } from "@expo/vector-icons" -import { Tabs } from "expo-router" +import { DarkTheme, DefaultTheme, ThemeProvider } from "expo-router" +import { NativeTabs } from "expo-router/unstable-native-tabs" +import { DynamicColorIOS, Platform, useColorScheme } from "react-native" +import { useMemo } from "react" -import { useThemeColors } from "@/lib/theme" +import { TabBottomAccessory } from "@/components/mini-player" +import { appleMusic, colors } from "@/lib/theme" + +function useRouterTheme() { + const isDark = useColorScheme() === "dark" + + return useMemo(() => { + const palette = isDark ? colors.dark : colors.light + const base = isDark ? DarkTheme : DefaultTheme + + return { + ...base, + colors: { + ...base.colors, + background: palette.background, + card: palette.card, + text: palette.foreground, + border: palette.border, + primary: palette.primary, + }, + } + }, [isDark]) +} + +function useNativeTabColors() { + const isDark = useColorScheme() === "dark" + const inactive = appleMusic.tabInactive + + const iconColor = + Platform.OS === "ios" + ? { + default: DynamicColorIOS({ dark: inactive, light: "#636366" }), + selected: appleMusic.pink, + } + : { + default: isDark ? inactive : "#636366", + selected: appleMusic.pink, + } + + const labelColor = + Platform.OS === "ios" + ? DynamicColorIOS({ dark: inactive, light: "#636366" }) + : isDark + ? inactive + : "#636366" + + return { + isDark, + iconColor, + labelStyle: { + default: { color: labelColor, fontSize: 10 }, + selected: { color: appleMusic.pink, fontSize: 10, fontWeight: "600" as const }, + }, + blurEffect: isDark ? "systemChromeMaterialDark" : "systemChromeMaterialLight", + backgroundColor: + Platform.OS === "ios" ? undefined : isDark ? appleMusic.background : colors.light.background, + } +} export default function TabsLayout() { - const colors = useThemeColors() + const routerTheme = useRouterTheme() + const tabColors = useNativeTabColors() return ( - - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - + + + + + + + + + Home + + + + + Library + + + + + Playlists + + + + + Search + + + + + More + + + ) } diff --git a/apps/mobile/app/(app)/(tabs)/home/_layout.tsx b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx new file mode 100644 index 0000000..8d84403 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/home/_layout.tsx @@ -0,0 +1,7 @@ +import { Stack } from "expo-router" + +import { useStackScreenOptions } from "@/lib/navigation" + +export default function HomeLayout() { + return +} diff --git a/apps/mobile/app/(app)/(tabs)/home/index.tsx b/apps/mobile/app/(app)/(tabs)/home/index.tsx new file mode 100644 index 0000000..f0e09a3 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/home/index.tsx @@ -0,0 +1,46 @@ +import { useQuery } from "convex/react" +import { ScrollView, StyleSheet } from "react-native" + +import { ContentCarousel } from "@/components/media-cards" +import { LoadingView } from "@/components/ui/primitives" +import { tabContentBottomInset } 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 + } + + return ( + + {recentlyPlayed.length > 0 ? ( + + ) : null} + + + ) +} + +const styles = StyleSheet.create({ + content: { + padding: spacing.lg, + gap: spacing.xl, + }, +}) diff --git a/apps/mobile/app/(app)/(tabs)/index.tsx b/apps/mobile/app/(app)/(tabs)/index.tsx deleted file mode 100644 index bd93a04..0000000 --- a/apps/mobile/app/(app)/(tabs)/index.tsx +++ /dev/null @@ -1,55 +0,0 @@ -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 ( - - - - - ) - } - - return ( - - - - {recentlyPlayed.length > 0 ? ( - - ) : null} - - - - ) -} - -const styles = StyleSheet.create({ - safe: { flex: 1 }, - content: { - padding: spacing.lg, - gap: spacing.xl, - }, -}) diff --git a/apps/mobile/app/(app)/(tabs)/library.tsx b/apps/mobile/app/(app)/(tabs)/library.tsx deleted file mode 100644 index 696b91b..0000000 --- a/apps/mobile/app/(app)/(tabs)/library.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { useRouter } from "expo-router" -import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" -import { Ionicons } from "@expo/vector-icons" - -import { ScreenHeader } from "@/components/screen-header" -import { contentBottomInset } from "@/components/player" -import { radius, spacing, useThemeColors } from "@/lib/theme" - -const links = [ - { title: "Albums", href: "/library/albums", icon: "disc" as const }, - { title: "Artists", href: "/library/artists", icon: "mic" as const }, - { title: "Songs", href: "/library/songs", icon: "musical-notes" as const }, - { title: "Recently Played", href: "/recently-played", icon: "time" as const }, - { title: "Recently Added", href: "/recently-added", icon: "sparkles" as const }, - { title: "Favorites", href: "/playlist/favorites", icon: "star" as const }, -] - -export default function LibraryScreen() { - const router = useRouter() - const colors = useThemeColors() - - return ( - - - - {links.map((link) => ( - router.push(link.href as never)} - > - - - - {link.title} - - - ))} - - - ) -} - -const styles = StyleSheet.create({ - safe: { flex: 1 }, - row: { - flexDirection: "row", - alignItems: "center", - gap: spacing.md, - paddingHorizontal: spacing.lg, - paddingVertical: spacing.md, - borderBottomWidth: StyleSheet.hairlineWidth, - }, - iconWrap: { - width: 40, - height: 40, - borderRadius: radius.md, - alignItems: "center", - justifyContent: "center", - }, - rowTitle: { - flex: 1, - fontSize: 16, - fontWeight: "600", - }, -}) diff --git a/apps/mobile/app/(app)/(tabs)/library/_layout.tsx b/apps/mobile/app/(app)/(tabs)/library/_layout.tsx new file mode 100644 index 0000000..98a5d70 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/library/_layout.tsx @@ -0,0 +1,7 @@ +import { Stack } from "expo-router" + +import { useStackScreenOptions } from "@/lib/navigation" + +export default function LibraryLayout() { + return +} diff --git a/apps/mobile/app/(app)/(tabs)/library/index.tsx b/apps/mobile/app/(app)/(tabs)/library/index.tsx new file mode 100644 index 0000000..e7d63fe --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/library/index.tsx @@ -0,0 +1,109 @@ +import { useQuery } from "convex/react" +import { useRouter } from "expo-router" +import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" +import { SymbolView } from "expo-symbols" +import { Platform } from "react-native" +import { Ionicons } from "@expo/vector-icons" + +import { MediaGrid } from "@/components/media-cards" +import { tabContentBottomInset } from "@/components/player" +import { LoadingView } from "@/components/ui/primitives" +import { api } from "@otunes/convex/_generated/api" +import { appleMusic, spacing, useThemeColors } from "@/lib/theme" + +const links = [ + { title: "Playlists", href: "/(app)/(tabs)/playlists", icon: "music.note.list" as const }, + { title: "Artists", href: "/library/artists", icon: "mic.fill" as const }, + { title: "Albums", href: "/library/albums", icon: "square.stack" as const }, + { title: "Songs", href: "/library/songs", icon: "music.note" as const }, + { title: "Recently Played", href: "/recently-played", icon: "clock" as const }, + { title: "Recently Added", href: "/recently-added", icon: "sparkles" as const }, + { title: "Favorites", href: "/playlist/favorites", icon: "star" as const }, +] + +function LibraryIcon({ name }: { name: (typeof links)[number]["icon"] }) { + if (Platform.OS === "ios") { + return ( + + ) + } + const ionMap: Record = { + "music.note.list": "list", + "mic.fill": "mic", + "square.stack": "albums", + "music.note": "musical-notes", + clock: "time", + sparkles: "sparkles", + star: "star", + } + return +} + +export default function LibraryScreen() { + const router = useRouter() + const colors = useThemeColors() + const recentlyAdded = useQuery(api.library.browseRecentlyAdded) + + return ( + + {links.map((link) => ( + router.push(link.href as never)} + > + + {link.title} + + + ))} + + + router.push("/recently-added")}> + + Recently Added + + + {recentlyAdded === undefined ? ( + + ) : ( + + )} + + + ) +} + +const styles = StyleSheet.create({ + row: { + flexDirection: "row", + alignItems: "center", + gap: spacing.md, + paddingHorizontal: spacing.lg, + paddingVertical: 14, + borderBottomWidth: StyleSheet.hairlineWidth, + }, + rowTitle: { + flex: 1, + fontSize: 20, + fontWeight: "400", + }, + section: { + paddingTop: spacing.xl, + paddingHorizontal: spacing.lg, + gap: spacing.md, + }, + sectionTitle: { + fontSize: 22, + fontWeight: "700", + }, +}) diff --git a/apps/mobile/app/(app)/(tabs)/more.tsx b/apps/mobile/app/(app)/(tabs)/more.tsx deleted file mode 100644 index 2eb2cee..0000000 --- a/apps/mobile/app/(app)/(tabs)/more.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { useAuthActions } from "@convex-dev/auth/react" -import { useQuery } from "convex/react" -import { useRouter } from "expo-router" -import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" -import { Ionicons } from "@expo/vector-icons" - -import { ScreenHeader } from "@/components/screen-header" -import { contentBottomInset } from "@/components/player" -import { useServerConfig } from "@/contexts/server-config" -import { api } from "@otunes/convex/_generated/api" -import type { PlaylistSummary } from "@otunes/convex/types" -import { initialsFromName } from "@/lib/format" -import { radius, spacing, useThemeColors } from "@/lib/theme" - -export default function MoreScreen() { - const router = useRouter() - const colors = useThemeColors() - const { signOut } = useAuthActions() - const { clearServer } = useServerConfig() - const user = useQuery(api.auth.currentUser) - const sidebarPlaylists = useQuery(api.playlists.listSidebarPlaylists) - - async function handleSignOut() { - await signOut() - router.replace("/signin") - } - - async function handleChangeServer() { - await signOut() - await clearServer() - router.replace("/server") - } - - const subscribed = sidebarPlaylists?.subscribed ?? [] - const owned = sidebarPlaylists?.owned ?? [] - - return ( - - - - - - - {initialsFromName(user?.name ?? "NA")} - - - - {user?.name ?? "..."} - {user?.email} - - - - router.push("/settings")}> - - Settings - - router.push("/queue")}> - - Queue - - - {owned.length > 0 ? ( - Your playlists - ) : null} - {owned.map((playlist: PlaylistSummary) => ( - router.push(`/playlist/${playlist.id}`)} - > - - {playlist.title} - - ))} - - {subscribed.length > 0 ? ( - Subscribed - ) : null} - {subscribed.map((playlist: PlaylistSummary) => ( - router.push(`/playlist/${playlist.id}`)} - > - - {playlist.title} - - ))} - - void handleSignOut()}> - - Sign out - - void handleChangeServer()}> - - Change server - - - - ) -} - -const styles = StyleSheet.create({ - safe: { flex: 1 }, - profileCard: { - margin: spacing.lg, - borderRadius: radius.lg, - padding: spacing.lg, - flexDirection: "row", - alignItems: "center", - gap: spacing.md, - }, - avatar: { - width: 48, - height: 48, - borderRadius: 24, - alignItems: "center", - justifyContent: "center", - }, - name: { fontSize: 18, fontWeight: "700" }, - row: { - flexDirection: "row", - alignItems: "center", - gap: spacing.md, - paddingHorizontal: spacing.lg, - paddingVertical: spacing.md, - }, - rowText: { fontSize: 16, fontWeight: "500" }, - sectionLabel: { - paddingHorizontal: spacing.lg, - paddingTop: spacing.lg, - fontSize: 12, - fontWeight: "700", - textTransform: "uppercase", - }, -}) diff --git a/apps/mobile/app/(app)/(tabs)/more/_layout.tsx b/apps/mobile/app/(app)/(tabs)/more/_layout.tsx new file mode 100644 index 0000000..514112a --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/more/_layout.tsx @@ -0,0 +1,7 @@ +import { Stack } from "expo-router" + +import { useStackScreenOptions } from "@/lib/navigation" + +export default function MoreLayout() { + return +} diff --git a/apps/mobile/app/(app)/(tabs)/more/index.tsx b/apps/mobile/app/(app)/(tabs)/more/index.tsx new file mode 100644 index 0000000..6501bf2 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/more/index.tsx @@ -0,0 +1,135 @@ +import { useAuthActions } from "@convex-dev/auth/react" +import { useQuery } from "convex/react" +import { useRouter } from "expo-router" +import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" +import { Ionicons } from "@expo/vector-icons" + +import { tabContentBottomInset } from "@/components/player" +import { useServerConfig } from "@/contexts/server-config" +import { signOutToSignIn } from "@/lib/session" +import { api } from "@otunes/convex/_generated/api" +import type { PlaylistSummary } from "@otunes/convex/types" +import { initialsFromName } from "@/lib/format" +import { radius, spacing, useThemeColors } from "@/lib/theme" + +export default function MoreScreen() { + const router = useRouter() + const colors = useThemeColors() + const { signOut } = useAuthActions() + const { clearServer } = useServerConfig() + const user = useQuery(api.auth.currentUser) + const sidebarPlaylists = useQuery(api.playlists.listSidebarPlaylists) + + async function handleSignOut() { + await signOutToSignIn(signOut, router) + } + + async function handleChangeServer() { + await signOut() + await clearServer() + router.replace("/server") + } + + const subscribed = sidebarPlaylists?.subscribed ?? [] + const owned = sidebarPlaylists?.owned ?? [] + + return ( + + + + + {initialsFromName(user?.name ?? "NA")} + + + + {user?.name ?? "..."} + {user?.email} + + + + router.push("/settings")}> + + Settings + + router.push("/queue")}> + + Queue + + + {owned.length > 0 ? ( + Your playlists + ) : null} + {owned.map((playlist: PlaylistSummary) => ( + router.push(`/playlist/${playlist.id}`)} + > + + {playlist.title} + + ))} + + {subscribed.length > 0 ? ( + Subscribed + ) : null} + {subscribed.map((playlist: PlaylistSummary) => ( + router.push(`/playlist/${playlist.id}`)} + > + + {playlist.title} + + ))} + + void handleSignOut()}> + + Sign out + + void handleChangeServer()}> + + Change server + + + ) +} + +const styles = StyleSheet.create({ + profileCard: { + margin: spacing.lg, + borderRadius: radius.lg, + padding: spacing.lg, + flexDirection: "row", + alignItems: "center", + gap: spacing.md, + }, + avatar: { + width: 48, + height: 48, + borderRadius: 24, + alignItems: "center", + justifyContent: "center", + }, + name: { fontSize: 18, fontWeight: "700" }, + row: { + flexDirection: "row", + alignItems: "center", + gap: spacing.md, + paddingHorizontal: spacing.lg, + paddingVertical: spacing.md, + }, + rowText: { fontSize: 16, fontWeight: "500" }, + sectionLabel: { + paddingHorizontal: spacing.lg, + paddingTop: spacing.lg, + fontSize: 12, + fontWeight: "700", + textTransform: "uppercase", + }, +}) diff --git a/apps/mobile/app/(app)/(tabs)/playlists.tsx b/apps/mobile/app/(app)/(tabs)/playlists.tsx deleted file mode 100644 index 415f00a..0000000 --- a/apps/mobile/app/(app)/(tabs)/playlists.tsx +++ /dev/null @@ -1,48 +0,0 @@ -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 ( - - } - /> - {playlists === undefined ? ( - - ) : ( - - - {playlists.map((playlist: PlaylistSummary) => ( - - ))} - - - )} - - ) -} - -const styles = StyleSheet.create({ - safe: { flex: 1 }, - content: { padding: spacing.lg }, - grid: { - flexDirection: "row", - flexWrap: "wrap", - gap: spacing.lg, - }, -}) diff --git a/apps/mobile/app/(app)/(tabs)/playlists/_layout.tsx b/apps/mobile/app/(app)/(tabs)/playlists/_layout.tsx new file mode 100644 index 0000000..47fff99 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/playlists/_layout.tsx @@ -0,0 +1,29 @@ +import { Stack } from "expo-router" +import { Pressable, Text } from "react-native" + +import { useAddToPlaylist } from "@/contexts/add-to-playlist" +import { useStackScreenOptions } from "@/lib/navigation" +import { appleMusic } from "@/lib/theme" + +function NewPlaylistButton() { + const { openCreatePlaylist } = useAddToPlaylist() + + return ( + + + New + + + ) +} + +export default function PlaylistsLayout() { + return ( + , + })} + /> + ) +} diff --git a/apps/mobile/app/(app)/(tabs)/playlists/index.tsx b/apps/mobile/app/(app)/(tabs)/playlists/index.tsx new file mode 100644 index 0000000..b15e374 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/playlists/index.tsx @@ -0,0 +1,31 @@ +import { useQuery } from "convex/react" +import { ScrollView, StyleSheet } from "react-native" + +import { MediaGrid } from "@/components/media-cards" +import { LoadingView } from "@/components/ui/primitives" +import { tabContentBottomInset } from "@/components/player" +import { api } from "@otunes/convex/_generated/api" +import { spacing, useThemeColors } from "@/lib/theme" + +export default function PlaylistsTabScreen() { + const colors = useThemeColors() + const playlists = useQuery(api.playlists.listAllPlaylists) + + if (playlists === undefined) { + return + } + + return ( + + + + ) +} + +const styles = StyleSheet.create({ + content: { padding: spacing.lg }, +}) diff --git a/apps/mobile/app/(app)/(tabs)/search/_layout.tsx b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx new file mode 100644 index 0000000..f6c0257 --- /dev/null +++ b/apps/mobile/app/(app)/(tabs)/search/_layout.tsx @@ -0,0 +1,7 @@ +import { Stack } from "expo-router" + +import { useStackScreenOptions } from "@/lib/navigation" + +export default function SearchLayout() { + return +} diff --git a/apps/mobile/app/(app)/(tabs)/search.tsx b/apps/mobile/app/(app)/(tabs)/search/index.tsx similarity index 72% rename from apps/mobile/app/(app)/(tabs)/search.tsx rename to apps/mobile/app/(app)/(tabs)/search/index.tsx index 6fe2f3a..59d647b 100644 --- a/apps/mobile/app/(app)/(tabs)/search.tsx +++ b/apps/mobile/app/(app)/(tabs)/search/index.tsx @@ -1,12 +1,11 @@ import { useQuery } from "convex/react" +import { Stack } from "expo-router" import { useMemo, useState } from "react" -import { ScrollView, StyleSheet, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" +import { ScrollView, StyleSheet, Text, View } from "react-native" import { ContentCarousel } from "@/components/media-cards" -import { contentBottomInset, SongRow } from "@/components/player" -import { ScreenHeader } from "@/components/screen-header" -import { Input, LoadingView } from "@/components/ui/primitives" +import { tabContentBottomInset, SongRow } from "@/components/player" +import { LoadingView } from "@/components/ui/primitives" import { usePlayback } from "@/contexts/playback" import { api } from "@otunes/convex/_generated/api" import type { BrowseSong } from "@otunes/convex/types" @@ -53,29 +52,34 @@ export default function SearchScreen() { ) return ( - - - - setSearchQuery(query.trim())} - /> - + <> + handleQueryChange(event.nativeEvent.text)} + onSearchButtonPress={() => setSearchQuery(query.trim())} + autoCapitalize="none" + /> {isSearching ? ( ) : !hasQuery ? ( - + + Find your favorite music + ) : ( - + {!hasLibraryResults ? ( - + + No results for "{searchQuery}" + ) : null} @@ -115,13 +119,12 @@ export default function SearchScreen() { ) : null} )} - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, - searchBox: { paddingHorizontal: spacing.lg, paddingBottom: spacing.md }, - empty: { padding: spacing.lg }, + empty: { padding: spacing.xl, alignItems: "center" }, + emptyText: { fontSize: 16 }, section: { paddingHorizontal: spacing.lg, paddingBottom: spacing.lg, gap: spacing.md }, }) diff --git a/apps/mobile/app/(app)/_layout.tsx b/apps/mobile/app/(app)/_layout.tsx index e31307f..ac09ab6 100644 --- a/apps/mobile/app/(app)/_layout.tsx +++ b/apps/mobile/app/(app)/_layout.tsx @@ -1,22 +1,30 @@ import { useConvexAuth } from "@convex-dev/auth/react" import { Redirect, Stack } from "expo-router" -import { View } from "react-native" +import { Platform } from "react-native" -import { PlayerBar } from "@/components/player" +import { FloatingMiniPlayer } from "@/components/mini-player" import { LoadingView } from "@/components/ui/primitives" import { AddToPlaylistProvider } from "@/contexts/add-to-playlist" import { FavoritesProvider } from "@/contexts/favorites" import { PlaybackProvider } from "@/contexts/playback" import { useServerConfig } from "@/contexts/server-config" +import { useStackScreenOptions } from "@/lib/navigation" export default function AppLayout() { const { config } = useServerConfig() - const { isLoading, isAuthenticated } = useConvexAuth() + const auth = useConvexAuth() + const stackOptions = useStackScreenOptions() if (!config) { return } + if (!auth) { + return + } + + const { isLoading, isAuthenticated } = auth + if (isLoading) { return } @@ -29,10 +37,32 @@ export default function AppLayout() { - - - - + + + + + + + + + + + + + + + + diff --git a/apps/mobile/app/(app)/album/[id].tsx b/apps/mobile/app/(app)/album/[id].tsx index bece4a1..e585698 100644 --- a/apps/mobile/app/(app)/album/[id].tsx +++ b/apps/mobile/app/(app)/album/[id].tsx @@ -1,13 +1,11 @@ import { useQuery } from "convex/react" import { Image } from "expo-image" -import { useLocalSearchParams, useRouter } from "expo-router" +import { Stack, useLocalSearchParams, useRouter } from "expo-router" import { useState } from "react" import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" import { Ionicons } from "@expo/vector-icons" import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" -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" @@ -33,22 +31,14 @@ export default function AlbumScreen() { const [actionsOpen, setActionsOpen] = useState(false) if (album === undefined || !config) { - return ( - - - - - ) + return } if (album === null) { return ( - - - - Album not found. - - + + Album not found. + ) } @@ -70,16 +60,23 @@ export default function AlbumScreen() { } return ( - - setActionsOpen(true)} hitSlop={8}> - - - } + <> + ( + setActionsOpen(true)} hitSlop={8}> + + + ), + }} /> - + setActionsOpen(false)} onAction={handleAlbumAction} /> - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, empty: { flex: 1, alignItems: "center", justifyContent: "center" }, hero: { alignItems: "center", diff --git a/apps/mobile/app/(app)/artist/[id].tsx b/apps/mobile/app/(app)/artist/[id].tsx index 4f2f41c..5c727dc 100644 --- a/apps/mobile/app/(app)/artist/[id].tsx +++ b/apps/mobile/app/(app)/artist/[id].tsx @@ -1,14 +1,12 @@ import { useQuery } from "convex/react" import { Image } from "expo-image" -import { useLocalSearchParams } from "expo-router" +import { Stack, useLocalSearchParams } from "expo-router" import { useState } from "react" import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" import { Ionicons } from "@expo/vector-icons" -import { AlbumCard, ContentCarousel } from "@/components/media-cards" +import { ContentCarousel, MediaGrid } from "@/components/media-cards" import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" -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" @@ -17,7 +15,6 @@ import { usePlayback } from "@/contexts/playback" import { useServerConfig } from "@/contexts/server-config" import { api } from "@otunes/convex/_generated/api" import type { Id } from "@otunes/convex/_generated/dataModel" -import type { BrowseAlbum } from "@otunes/convex/types" import { artistCoverUrl } from "@/lib/urls" import { radius, spacing, useThemeColors } from "@/lib/theme" @@ -32,22 +29,14 @@ export default function ArtistScreen() { const [actionsOpen, setActionsOpen] = useState(false) if (data === undefined || !config) { - return ( - - - - - ) + return } if (data === null) { return ( - - - - Artist not found. - - + + Artist not found. + ) } @@ -66,16 +55,23 @@ export default function ArtistScreen() { } return ( - - setActionsOpen(true)} hitSlop={8}> - - - } + <> + ( + setActionsOpen(true)} hitSlop={8}> + + + ), + }} /> - + Albums - - {data.albums.map((album: BrowseAlbum) => ( - - ))} - + @@ -125,12 +117,11 @@ export default function ArtistScreen() { onClose={() => setActionsOpen(false)} onAction={handleAction} /> - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, empty: { flex: 1, alignItems: "center", justifyContent: "center" }, hero: { alignItems: "center", padding: spacing.lg, gap: spacing.sm }, avatar: { @@ -143,5 +134,4 @@ const styles = StyleSheet.create({ actions: { flexDirection: "row", alignItems: "center", gap: spacing.sm, marginTop: spacing.sm }, section: { padding: spacing.lg, gap: spacing.md }, sectionTitle: { fontSize: 20, fontWeight: "700" }, - grid: { flexDirection: "row", flexWrap: "wrap", gap: spacing.lg }, }) diff --git a/apps/mobile/app/(app)/index.tsx b/apps/mobile/app/(app)/index.tsx new file mode 100644 index 0000000..f1a0fdd --- /dev/null +++ b/apps/mobile/app/(app)/index.tsx @@ -0,0 +1,5 @@ +import { Redirect } from "expo-router" + +export default function AppIndex() { + return +} diff --git a/apps/mobile/app/(app)/library/albums.tsx b/apps/mobile/app/(app)/library/albums.tsx index 174120b..899d455 100644 --- a/apps/mobile/app/(app)/library/albums.tsx +++ b/apps/mobile/app/(app)/library/albums.tsx @@ -1,39 +1,31 @@ import { useQuery } from "convex/react" -import { ScrollView, StyleSheet, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" +import { ScrollView, StyleSheet } from "react-native" -import { AlbumCard } from "@/components/media-cards" -import { ScreenHeader } from "@/components/screen-header" +import { MediaGrid } from "@/components/media-cards" 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) + if (albums === undefined) { + return + } + return ( - - - {albums === undefined ? ( - - ) : ( - - - {albums.map((album: BrowseAlbum) => ( - - ))} - - - )} - + + + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, content: { padding: spacing.lg }, - grid: { flexDirection: "row", flexWrap: "wrap", gap: spacing.lg }, }) diff --git a/apps/mobile/app/(app)/library/artists.tsx b/apps/mobile/app/(app)/library/artists.tsx index 92c2714..9a86866 100644 --- a/apps/mobile/app/(app)/library/artists.tsx +++ b/apps/mobile/app/(app)/library/artists.tsx @@ -1,10 +1,8 @@ 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" @@ -19,35 +17,35 @@ export default function ArtistsScreen() { const { config } = useServerConfig() const artists = useQuery(api.library.browseArtists) + if (artists === undefined || !config) { + return + } + return ( - - - {artists === undefined || !config ? ( - - ) : ( - - {artists.map((artist: BrowseArtist) => ( - router.push(`/artist/${artist.id}`)} - > - - {artist.name} - - ))} - - )} - + + {artists.map((artist: BrowseArtist) => ( + router.push(`/artist/${artist.id}`)} + > + + {artist.name} + + ))} + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, row: { flexDirection: "row", alignItems: "center", diff --git a/apps/mobile/app/(app)/library/songs.tsx b/apps/mobile/app/(app)/library/songs.tsx index 004ed55..4db3dfa 100644 --- a/apps/mobile/app/(app)/library/songs.tsx +++ b/apps/mobile/app/(app)/library/songs.tsx @@ -1,10 +1,8 @@ import { usePaginatedQuery } from "convex/react" import { useState } from "react" import { FlatList, Pressable, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" -import { ScreenHeader } from "@/components/screen-header" import { contentBottomInset, SongRow } from "@/components/player" import { LoadingView } from "@/components/ui/primitives" import { useAddToPlaylist } from "@/contexts/add-to-playlist" @@ -67,17 +65,11 @@ export default function SongsScreen() { } if (results === undefined) { - return ( - - - - - ) + return } return ( - - + {(["title", "artist", "album"] as const).map((key) => ( cycleSort(key)} style={styles.sortButton}> @@ -98,6 +90,7 @@ export default function SongsScreen() { data={results} keyExtractor={(item) => item.id} contentContainerStyle={{ paddingBottom: contentBottomInset }} + contentInsetAdjustmentBehavior="automatic" onEndReached={() => { if (status === "CanLoadMore") loadMore(PAGE_SIZE) }} @@ -120,12 +113,11 @@ export default function SongsScreen() { onClose={() => setActionSong(null)} onAction={handleAction} /> - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, sortRow: { flexDirection: "row", justifyContent: "space-around", diff --git a/apps/mobile/app/(app)/player.tsx b/apps/mobile/app/(app)/player.tsx new file mode 100644 index 0000000..1562847 --- /dev/null +++ b/apps/mobile/app/(app)/player.tsx @@ -0,0 +1,380 @@ +import { Ionicons } from "@expo/vector-icons" +import Slider from "@react-native-community/slider" +import { BlurView } from "expo-blur" +import { Image } from "expo-image" +import { useRouter } from "expo-router" +import * as Haptics from "expo-haptics" +import { useState } from "react" +import { + Platform, + Pressable, + StyleSheet, + Text, + View, +} from "react-native" +import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context" +import { StatusBar } from "expo-status-bar" + +import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" +import { useFavorites } from "@/contexts/favorites" +import { usePlayback } from "@/contexts/playback" +import { useServerConfig } from "@/contexts/server-config" +import { formatDuration, formatRemainingDuration } from "@/lib/format" +import { albumCoverUrl } from "@/lib/urls" +import { appleMusic, radius, spacing, usePlayerTheme } from "@/lib/theme" + +export default function PlayerScreen() { + const router = useRouter() + const insets = useSafeAreaInsets() + const player = usePlayerTheme() + const { config } = useServerConfig() + const { isSongFavorite, toggleSongFavorite } = useFavorites() + const [actionsOpen, setActionsOpen] = useState(false) + const { + currentSong, + isPlaying, + shuffleEnabled, + repeatEnabled, + currentTime, + duration, + volume, + queueSongIds, + setIsPlaying, + setVolume, + seekTo, + toggleShuffle, + cycleRepeat, + skipNext, + skipPrevious, + addToQueueNext, + addToQueueLast, + playShuffled, + } = usePlayback() + + if (!currentSong || !config) { + return null + } + + const coverUri = albumCoverUrl(config.serverUrl, currentSong.album.id) + const favorited = isSongFavorite(currentSong.id) + const bottomInset = Math.max(insets.bottom, spacing.md) + spacing.lg + const { colors } = player + + async function handleAction(action: MediaAction) { + setActionsOpen(false) + switch (action) { + case "favorite": + await toggleSongFavorite(currentSong!.id) + break + case "play-next": + await addToQueueNext([currentSong!.id]) + break + case "play-last": + await addToQueueLast([currentSong!.id]) + break + case "shuffle": + await playShuffled([currentSong!.id]) + break + case "go-artist": + router.push(`/artist/${currentSong!.artist.id}`) + break + case "go-album": + router.push(`/album/${currentSong!.album.id}`) + break + default: + break + } + } + + function togglePlayback() { + void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light) + setIsPlaying(!isPlaying) + } + + return ( + + + + {Platform.OS === "ios" ? ( + <> + + + + ) : ( + + )} + + + router.back()} + hitSlop={12} + style={styles.handleRow} + accessibilityRole="button" + accessibilityLabel="Close player" + > + + + + + + + + + + + + + + {currentSong.title} + + + {currentSong.artist.name} + + + + void toggleSongFavorite(currentSong.id)} + hitSlop={10} + style={[styles.circleButton, { backgroundColor: player.buttonSurface }]} + > + + + setActionsOpen(true)} + hitSlop={10} + style={[styles.circleButton, { backgroundColor: player.buttonSurface }]} + > + + + + + + + 0 ? duration : 1} + value={Math.min(currentTime, duration || 0)} + onSlidingComplete={(value) => void seekTo(value)} + minimumTrackTintColor={colors.foreground} + maximumTrackTintColor={player.trackInactive} + thumbTintColor={colors.foreground} + /> + + + {formatDuration(currentTime)} + + + {formatRemainingDuration(currentTime, duration)} + + + + + + void skipPrevious()} hitSlop={12}> + + + + + + void skipNext()} hitSlop={12}> + + + + + + + + + + + + void toggleShuffle()} hitSlop={12} style={styles.footerButton}> + + + void cycleRepeat()} hitSlop={12} style={styles.footerButton}> + + + router.push("/queue")} + hitSlop={12} + style={styles.footerButton} + disabled={queueSongIds.length === 0} + > + + + + + + + setActionsOpen(false)} + onAction={handleAction} + /> + + ) +} + +const styles = StyleSheet.create({ + root: { + flex: 1, + }, + backgroundImage: { + ...StyleSheet.absoluteFill, + }, + scrim: { + ...StyleSheet.absoluteFill, + }, + safe: { + flex: 1, + paddingHorizontal: spacing.xl, + }, + handleRow: { + alignItems: "center", + paddingTop: spacing.sm, + paddingBottom: spacing.md, + }, + handle: { + width: 36, + height: 5, + borderRadius: radius.full, + }, + upper: { + flex: 1, + minHeight: 0, + justifyContent: "center", + }, + artworkWrap: { + alignItems: "center", + justifyContent: "center", + paddingVertical: spacing.sm, + }, + artwork: { + width: "100%", + maxWidth: 320, + aspectRatio: 1, + borderRadius: 12, + shadowColor: "#000", + shadowOpacity: 0.45, + shadowRadius: 24, + shadowOffset: { width: 0, height: 12 }, + }, + controls: { + flexShrink: 0, + }, + metaRow: { + flexDirection: "row", + alignItems: "flex-start", + gap: spacing.md, + marginBottom: spacing.md, + }, + metaText: { + flex: 1, + minWidth: 0, + }, + songTitle: { + fontSize: 22, + fontWeight: "700", + lineHeight: 28, + }, + artistName: { + fontSize: 18, + marginTop: spacing.xs, + }, + metaActions: { + flexDirection: "row", + alignItems: "center", + gap: spacing.md, + paddingTop: 4, + }, + circleButton: { + width: 34, + height: 34, + borderRadius: 17, + alignItems: "center", + justifyContent: "center", + }, + progressSection: { + marginBottom: spacing.lg, + }, + slider: { + width: "100%", + height: 28, + }, + timeRow: { + flexDirection: "row", + justifyContent: "space-between", + marginTop: -4, + }, + time: { + fontSize: 13, + fontVariant: ["tabular-nums"], + }, + transport: { + flexDirection: "row", + alignItems: "center", + justifyContent: "center", + gap: 48, + marginBottom: spacing.lg, + }, + playButton: { + width: 72, + alignItems: "center", + }, + volumeSection: { + flexDirection: "row", + alignItems: "center", + gap: spacing.sm, + marginBottom: spacing.md, + }, + volumeSlider: { + flex: 1, + height: 28, + }, + footer: { + flexDirection: "row", + justifyContent: "space-between", + paddingHorizontal: spacing.xxl, + paddingTop: spacing.sm, + }, + footerButton: { + minWidth: 44, + minHeight: 44, + alignItems: "center", + justifyContent: "center", + }, +}) diff --git a/apps/mobile/app/(app)/playlist/[id].tsx b/apps/mobile/app/(app)/playlist/[id].tsx index 09f12dd..19d7551 100644 --- a/apps/mobile/app/(app)/playlist/[id].tsx +++ b/apps/mobile/app/(app)/playlist/[id].tsx @@ -1,13 +1,11 @@ import { useMutation, useQuery } from "convex/react" import { Image } from "expo-image" -import { useLocalSearchParams, useRouter } from "expo-router" +import { Stack, useLocalSearchParams, useRouter } from "expo-router" import { useState } from "react" import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" import { Ionicons } from "@expo/vector-icons" import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" -import { ScreenHeader } from "@/components/screen-header" import { Button, LoadingView } from "@/components/ui/primitives" import { contentBottomInset, SongRow } from "@/components/player" import { useAddToPlaylist } from "@/contexts/add-to-playlist" @@ -40,22 +38,14 @@ export default function PlaylistScreen() { const [menuOpen, setMenuOpen] = useState(false) if (playlist === undefined || !config) { - return ( - - - - - ) + return } if (playlist === null) { return ( - - - - Playlist not found. - - + + Playlist not found. + ) } @@ -103,16 +93,23 @@ export default function PlaylistScreen() { } return ( - - setMenuOpen(true)} hitSlop={8}> - - - } + <> + ( + setMenuOpen(true)} hitSlop={8}> + + + ), + }} /> - + - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, empty: { flex: 1, alignItems: "center", justifyContent: "center" }, hero: { alignItems: "center", padding: spacing.lg, gap: spacing.sm }, cover: { diff --git a/apps/mobile/app/(app)/playlist/favorites.tsx b/apps/mobile/app/(app)/playlist/favorites.tsx index 3debafd..5bc42c8 100644 --- a/apps/mobile/app/(app)/playlist/favorites.tsx +++ b/apps/mobile/app/(app)/playlist/favorites.tsx @@ -2,10 +2,8 @@ import { useQuery } from "convex/react" import { Image } from "expo-image" import { useState } from "react" import { ScrollView, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" import { MediaActionsSheet, type MediaAction } from "@/components/media-actions-sheet" -import { ScreenHeader } from "@/components/screen-header" import { Button, LoadingView } from "@/components/ui/primitives" import { contentBottomInset, SongRow } from "@/components/player" import { useAddToPlaylist } from "@/contexts/add-to-playlist" @@ -27,22 +25,14 @@ export default function FavoritesScreen() { const [actionSong, setActionSong] = useState(null) if (favorites === undefined || !config) { - return ( - - - - - ) + return } if (favorites === null) { return ( - - - - Sign in to view your favorites. - - + + Sign in to view your favorites. + ) } @@ -63,9 +53,12 @@ export default function FavoritesScreen() { } return ( - - - + <> + setActionSong(null)} onAction={handleSongAction} /> - + ) } const styles = StyleSheet.create({ - safe: { flex: 1 }, empty: { flex: 1, alignItems: "center", justifyContent: "center" }, hero: { alignItems: "center", padding: spacing.lg, gap: spacing.sm }, cover: { diff --git a/apps/mobile/app/(app)/queue.tsx b/apps/mobile/app/(app)/queue.tsx index fa6effb..a1b4283 100644 --- a/apps/mobile/app/(app)/queue.tsx +++ b/apps/mobile/app/(app)/queue.tsx @@ -1,13 +1,11 @@ import { usePaginatedQuery, useQuery } from "convex/react" +import { Stack } from "expo-router" import { FlatList, Pressable, StyleSheet, Text, View } from "react-native" -import { SafeAreaView } from "react-native-safe-area-context" -import { ScreenHeader } from "@/components/screen-header" import { Button, LoadingView } from "@/components/ui/primitives" import { contentBottomInset, SongRow } from "@/components/player" import { usePlayback } from "@/contexts/playback" import { api } from "@otunes/convex/_generated/api" -import type { Id } from "@otunes/convex/_generated/dataModel" import type { BrowseSong } from "@otunes/convex/types" import { spacing, useThemeColors } from "@/lib/theme" @@ -44,77 +42,77 @@ export default function QueueScreen() { void reorderQueue(next) } + if (queueSongs === undefined) { + return + } + return ( - - 0 ? ( -