From e77845b6fcaa0dbe42c31a1c35aabd66b2b65619 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Fri, 20 Nov 2026 01:10:19 -0500 Subject: [PATCH] feat(mobile): grouped settings lists and a combined admin tab Merge Library and Users into one Admin tab, render settings lists as inset grouped cards with stacked option details and footers, even out the Session icon sizes, and enlarge the iOS header title. Co-Authored-By: Claude Opus 5.5 --- .../mobile/app/(app)/(tabs)/home/settings.tsx | 354 ++++++++++-------- apps/mobile/app/(app)/_layout.tsx | 2 + 2 files changed, 205 insertions(+), 151 deletions(-) diff --git a/apps/mobile/app/(app)/(tabs)/home/settings.tsx b/apps/mobile/app/(app)/(tabs)/home/settings.tsx index 4f55b16..d49595b 100644 --- a/apps/mobile/app/(app)/(tabs)/home/settings.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/settings.tsx @@ -51,7 +51,7 @@ import type { Id } from "@otunes/convex/_generated/dataModel" type IconName = React.ComponentProps["name"] -type Section = "profile" | "quality" | "downloads" | "library" | "users" +type Section = "profile" | "quality" | "downloads" | "admin" type CurrentUser = { _id: Id<"users"> @@ -105,15 +105,9 @@ const SECTIONS: SectionConfig[] = [ icon: "arrow-down-circle-outline", }, { - id: "library", - label: "Library", - icon: "library-outline", - admin: true, - }, - { - id: "users", - label: "Users", - icon: "people-outline", + id: "admin", + label: "Admin", + icon: "shield-outline", admin: true, }, ] @@ -132,7 +126,7 @@ export default function SettingsScreen() { const [section, setSection] = useState
("profile") const allUsers = useQuery( api.users.listUsers, - user?.isAdmin === true && section === "users" ? {} : "skip" + user?.isAdmin === true && section === "admin" ? {} : "skip" ) if (!user) { @@ -203,9 +197,13 @@ export default function SettingsScreen() { ) : null} {section === "quality" ? : null} {section === "downloads" ? : null} - {section === "library" && isAdmin ? : null} - {section === "users" && isAdmin && allUsers ? ( - + {section === "admin" && isAdmin ? ( + <> + + {allUsers ? ( + + ) : null} + ) : null} @@ -254,22 +252,24 @@ function AppearanceSection() { return ( - { - setSaving(true) - try { - await setArtworkColorsEnabled(checked) - clearCoverPaletteCache() - } catch { - showError("Could not save artwork colors preference.") - } finally { - setSaving(false) - } - }} - /> + + { + setSaving(true) + try { + await setArtworkColorsEnabled(checked) + clearCoverPaletteCache() + } catch { + showError("Could not save artwork colors preference.") + } finally { + setSaving(false) + } + }} + /> + ) } @@ -449,37 +449,42 @@ function QualitySection({ user }: { user: CurrentUser }) { const quality = user.playbackQuality ?? "medium" return ( - - - {QUALITY_OPTIONS.map((option) => ( - - void updateQuality({ playbackQuality: option.value }).catch( - (error: Error) => showError(error.message) + <> + + + {QUALITY_OPTIONS.map((option) => ( + + void updateQuality({ playbackQuality: option.value }).catch( + (error: Error) => showError(error.message) + ) + } + /> + ))} + + + + + + void updateAtmos({ preferAtmos: checked }).catch((error: Error) => + showError(error.message) ) } /> - ))} - - - - void updateAtmos({ preferAtmos: checked }).catch((error: Error) => - showError(error.message) - ) - } - /> - + + + ) } @@ -541,7 +546,11 @@ function RememberedQualityGroup() { label: string detail: string }[] = [ - { value: null, label: "Ask every time", detail: "" }, + { + value: null, + label: "Ask Every Time", + detail: "Choose when downloading", + }, ...DOWNLOAD_QUALITIES.map((quality) => ({ value: quality, label: DOWNLOAD_QUALITY_LABELS[quality], @@ -550,7 +559,10 @@ function RememberedQualityGroup() { ] return ( - + {options.map((option) => ( - - {formatBytes(breakdown.bytes)} · {songCount(breakdown.songs)} - {breakdown.queued > 0 ? ` · ${breakdown.queued} downloading` : ""} - - {breakdown.songs > 0 ? ( - <> - - {qualities.map((entry) => ( + + + + {formatBytes(breakdown.bytes)} · {songCount(breakdown.songs)} + {breakdown.queued > 0 ? ` · ${breakdown.queued} downloading` : ""} + + {breakdown.songs > 0 ? ( + <> - ))} - - {qualities.map((entry) => ( - - - - - - - {songCount(entry.songs)} - - - {formatBytes(entry.bytes)} - - - ))} - - ) : null} + {qualities.map((entry) => ( + + ))} + + {qualities.map((entry) => ( + + + + + + + {songCount(entry.songs)} + + + {formatBytes(entry.bytes)} + + + ))} + + ) : null} + + @@ -685,7 +703,7 @@ function DownloadsSection() { {fallbackCount > 0 ? ( - - void setDisableCreation({ disabled: checked }).catch( - (error: Error) => showError(error.message) - ) - } - /> + + + void setDisableCreation({ disabled: checked }).catch( + (error: Error) => showError(error.message) + ) + } + /> + {children} + {footer ? ( + + {footer} + + ) : null} ) } @@ -990,23 +1023,18 @@ function GroupTitle({ ) } -/** Stacks rows with hairline separators between them. */ +/** An inset grouped card that stacks rows with inset hairline separators. */ function List({ children }: { children: React.ReactNode }) { const colors = useThemeColors() return ( - + {Children.toArray(children).map((row, index) => ( - 0 - ? { - borderTopWidth: StyleSheet.hairlineWidth, - borderTopColor: colors.border, - } - : undefined - } - > + + {index > 0 ? ( + + ) : null} {row} ))} @@ -1014,7 +1042,7 @@ function List({ children }: { children: React.ReactNode }) { ) } -/** A single-choice row with an inline detail and a checkmark when selected. */ +/** A single-choice row with a detail line and a checkmark when selected. */ function OptionRow({ label, detail, @@ -1034,19 +1062,17 @@ function OptionRow({ onPress={onPress} style={({ pressed }) => [styles.listRow, { opacity: pressed ? 0.6 : 1 }]} > - - {label} - - - {detail} - - + + + {label} + + + {detail} + + + {selected ? ( + + ) : null} ) } @@ -1095,12 +1121,15 @@ function SwitchRow({ function ActionRow({ icon, + iconSize = 20, title, destructive, loading, onPress, }: { icon: IconName + /** Ionicons glyphs vary in optical size; tune per icon so rows match. */ + iconSize?: number title: string destructive?: boolean loading?: boolean @@ -1116,7 +1145,9 @@ function ActionRow({ onPress={onPress} style={({ pressed }) => [styles.listRow, { opacity: pressed ? 0.6 : 1 }]} > - + + + {title} @@ -1283,22 +1314,43 @@ const styles = StyleSheet.create({ fontSize: 15, fontWeight: "700", }, + list: { + borderRadius: radius.lg, + overflow: "hidden", + paddingHorizontal: spacing.lg, + }, + separator: { + height: StyleSheet.hairlineWidth, + }, + groupFooter: { + fontSize: 13, + lineHeight: 18, + paddingHorizontal: spacing.lg, + }, + storageCard: { + gap: spacing.sm, + paddingVertical: spacing.md, + }, + rowIcon: { + width: 24, + alignItems: "center", + }, listRow: { - minHeight: 44, + minHeight: 48, flexDirection: "row", alignItems: "center", gap: spacing.md, - paddingVertical: spacing.xs, + paddingVertical: spacing.sm, }, rowCopy: { flex: 1, gap: 2, }, rowTitle: { - fontSize: 16, + fontSize: 17, }, rowDetail: { - fontSize: 13, + fontSize: 15, }, photoRow: { flexDirection: "row", diff --git a/apps/mobile/app/(app)/_layout.tsx b/apps/mobile/app/(app)/_layout.tsx index b1db68b..409b1f9 100644 --- a/apps/mobile/app/(app)/_layout.tsx +++ b/apps/mobile/app/(app)/_layout.tsx @@ -95,6 +95,8 @@ export default function AppLayout() { headerTransparent: false, headerShadowVisible: false, headerStyle: { backgroundColor: "#000" }, + // Matches the inline title size of Apple Music's settings. + headerTitleStyle: { fontSize: 20, fontWeight: "700" }, presentation: Platform.OS === "ios" ? "modal" : "fullScreenModal", animation: "slide_from_bottom",