From 3f68283d892a8cb89ec488f077eaedacb8c5f80e Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Mon, 6 Jul 2026 02:07:26 +0000 Subject: [PATCH] Hide player bar when queue is empty (#4) - Stop showing the mini player when there is no queued track - Reset playback state to 0 and paused at end of queue - Keep the current song in queue history when skipping the last track --------- Co-authored-by: Rem Helper Reviewed-on: https://git.abunchofknowitalls.com/joshuafhiggins/otunes/pulls/4 --- apps/mobile/app/(app)/(tabs)/_layout.tsx | 11 ++++++++--- apps/mobile/app/(app)/(tabs)/home/queue.tsx | 17 +++++++++++++++-- apps/mobile/app/(app)/player.tsx | 13 +++++++++++++ apps/mobile/contexts/playback.tsx | 16 ++++++++++++++++ apps/web/components/playback-provider.tsx | 16 ++++++++++++++++ packages/convex/convex/playback.ts | 7 +++---- 6 files changed, 71 insertions(+), 9 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(tabs)/_layout.tsx index 075ee6e..6620e89 100644 --- a/apps/mobile/app/(app)/(tabs)/_layout.tsx +++ b/apps/mobile/app/(app)/(tabs)/_layout.tsx @@ -4,6 +4,7 @@ import { DynamicColorIOS, Platform, useColorScheme } from "react-native" import { useMemo } from "react" import { TabBottomAccessory } from "@/components/mini-player" +import { usePlayback } from "@/contexts/playback" import { appleMusic, colors } from "@/lib/theme" function useRouterTheme() { @@ -75,6 +76,8 @@ function useNativeTabColors() { export default function TabsLayout() { const routerTheme = useRouterTheme() const tabColors = useNativeTabColors() + const { currentSong, queueSongIds } = usePlayback() + const showBottomAccessory = Boolean(currentSong && queueSongIds.length > 0) return ( @@ -90,9 +93,11 @@ export default function TabsLayout() { tintColor={appleMusic.pink} minimizeBehavior="onScrollDown" > - - - + {showBottomAccessory ? ( + + + + ) : null} diff --git a/apps/mobile/app/(app)/(tabs)/home/queue.tsx b/apps/mobile/app/(app)/(tabs)/home/queue.tsx index a1b4283..1a1257e 100644 --- a/apps/mobile/app/(app)/(tabs)/home/queue.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/queue.tsx @@ -1,5 +1,5 @@ import { usePaginatedQuery, useQuery } from "convex/react" -import { Stack } from "expo-router" +import { Stack, useRouter } from "expo-router" import { FlatList, Pressable, StyleSheet, Text, View } from "react-native" import { Button, LoadingView } from "@/components/ui/primitives" @@ -12,6 +12,7 @@ import { spacing, useThemeColors } from "@/lib/theme" const PAGE_SIZE = 50 export default function QueueScreen() { + const router = useRouter() const colors = useThemeColors() const { queueSongIds, @@ -42,6 +43,18 @@ export default function QueueScreen() { void reorderQueue(next) } + function handleClearQueue() { + if (router.canGoBack()) { + router.back() + setTimeout(() => { + void clearQueue() + }, 0) + return + } + + void clearQueue() + } + if (queueSongs === undefined) { return } @@ -52,7 +65,7 @@ export default function QueueScreen() { options={{ headerRight: () => queueSongIds.length > 0 ? ( -