From e53f77323abddc4a0a17e58a6e6e27afc2c91a07 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Fri, 20 Nov 2026 00:46:59 -0500 Subject: [PATCH] feat(mobile): rework settings layout Move the section pills to the bottom, add a close button (native on iOS), pair save actions with their inputs as icon buttons, and merge streaming quality and spatial audio into one group. Co-Authored-By: Claude Opus 5.5 --- .../mobile/app/(app)/(tabs)/home/settings.tsx | 1286 +++++++++-------- apps/mobile/app/(app)/_layout.tsx | 18 +- apps/mobile/app/(app)/settings.tsx | 17 +- 3 files changed, 700 insertions(+), 621 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/settings.tsx b/apps/mobile/app/(app)/(tabs)/home/settings.tsx index 4118351..4f55b16 100644 --- a/apps/mobile/app/(app)/(tabs)/home/settings.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/settings.tsx @@ -3,9 +3,10 @@ import { Ionicons } from "@expo/vector-icons" import { useAction, useMutation, useQuery } from "convex/react" import { Image } from "expo-image" import * as ImagePicker from "expo-image-picker" -import { useEffect, useMemo, useState } from "react" +import { Children, useEffect, useMemo, useState } from "react" import { router } from "expo-router" import { + ActivityIndicator, Alert, Platform, Pressable, @@ -15,10 +16,9 @@ import { Text, View, } from "react-native" -import type { StyleProp, ViewStyle } from "react-native" +import { useSafeAreaInsets } from "react-native-safe-area-context" import { AudioFormatBadge } from "@/components/audio-format-badge" -import { contentBottomInset } from "@/components/player" import { useDownloads, useDownloadsVersion } from "@/contexts/downloads" import { readRememberedDownloadQuality, @@ -31,7 +31,7 @@ import { formatBytes, type DownloadQuality, } from "@otunes/convex/download-quality" -import { Button, Input, LoadingView } from "@/components/ui/primitives" +import { Input, LoadingView } from "@/components/ui/primitives" import { useInvalidateAuthSession } from "@/contexts/convex-auth-session" import { useServerConfig } from "@/contexts/server-config" import { @@ -49,6 +49,8 @@ import type { PlaybackQuality } from "@otunes/convex/playback-stream" import { api } from "@otunes/convex/_generated/api" import type { Id } from "@otunes/convex/_generated/dataModel" +type IconName = React.ComponentProps["name"] + type Section = "profile" | "quality" | "downloads" | "library" | "users" type CurrentUser = { @@ -71,7 +73,7 @@ type AdminUser = { type SectionConfig = { id: Section label: string - icon: React.ComponentProps["name"] + icon: IconName admin?: boolean } @@ -87,15 +89,43 @@ const QUALITY_OPTIONS: { ] const SECTIONS: SectionConfig[] = [ - { id: "profile", label: "Profile", icon: "person-circle-outline" }, - { id: "quality", label: "Playback", icon: "volume-high-outline" }, - { id: "downloads", label: "Downloads", icon: "arrow-down-circle-outline" }, - { id: "library", label: "Library", icon: "library-outline", admin: true }, - { id: "users", label: "Users", icon: "people-outline", admin: true }, + { + id: "profile", + label: "Profile", + icon: "person-circle-outline", + }, + { + id: "quality", + label: "Playback", + icon: "volume-high-outline", + }, + { + id: "downloads", + label: "Downloads", + icon: "arrow-down-circle-outline", + }, + { + id: "library", + label: "Library", + icon: "library-outline", + admin: true, + }, + { + id: "users", + label: "Users", + icon: "people-outline", + admin: true, + }, ] +/** + * Settings, presented as a full-height modal: a title bar with a close + * button (native header on iOS), the active section's content, and a pill + * section switcher at the bottom. + */ export default function SettingsScreen() { const colors = useThemeColors() + const insets = useSafeAreaInsets() const user = useCachedQuery(api.auth.currentUser) const { invalidateSession } = useInvalidateAuthSession() const { clearServer } = useServerConfig() @@ -129,61 +159,92 @@ export default function SettingsScreen() { } return ( - - - {visibleSections.map((item) => { - const selected = section === item.id - return ( - setSection(item.id)} - style={[ - styles.pill, - { backgroundColor: selected ? colors.primary : "transparent" }, - ]} - > - - - ) - })} + {/* iOS shows the native header from the stack layout instead. */} + {Platform.OS === "ios" ? null : ( + + + Settings + + router.back()} + /> + + )} + + + {section === "profile" ? ( + <> + + + void handleChangeServer()} + onSignOut={() => void handleSignOut()} + /> + + ) : null} + {section === "quality" ? : null} + {section === "downloads" ? : null} + {section === "library" && isAdmin ? : null} + {section === "users" && isAdmin && allUsers ? ( + + ) : null} + + + + + {visibleSections.map((item) => { + const selected = section === item.id + return ( + setSection(item.id)} + style={[ + styles.pill, + { + backgroundColor: selected ? colors.primary : "transparent", + }, + ]} + > + + + ) + })} + - - {section === "profile" ? ( - <> - - - - ) : null} - {section === "quality" ? : null} - {section === "downloads" ? : null} - {section === "library" && isAdmin ? : null} - {section === "users" && isAdmin && allUsers ? ( - - ) : null} - - {section === "profile" ? ( - void handleChangeServer()} - onSignOut={() => void handleSignOut()} - /> - ) : null} - + ) } @@ -192,10 +253,9 @@ function AppearanceSection() { const [saving, setSaving] = useState(false) return ( - + { @@ -210,7 +270,7 @@ function AppearanceSection() { } }} /> - + ) } @@ -278,173 +338,148 @@ function ProfileSection({ user }: { user: CurrentUser }) { return ( <> - - - - -