From 7988d4f1b7ee8585b3debfec22c1b5834bb64dc0 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Fri, 20 Nov 2026 01:17:42 -0500 Subject: [PATCH] feat(mobile): native add button and read-only profile in settings Use a native SwiftUI glass plus button to create accounts, keep group title rows the same height so section spacing is even, and drop the name, email and password editors from the profile tab. Co-Authored-By: Claude Opus 5.5 --- .../mobile/app/(app)/(tabs)/home/settings.tsx | 181 ++++-------------- apps/mobile/components/add-button.ios.tsx | 32 ++++ apps/mobile/components/add-button.tsx | 26 +++ 3 files changed, 97 insertions(+), 142 deletions(-) create mode 100644 apps/mobile/components/add-button.ios.tsx create mode 100644 apps/mobile/components/add-button.tsx diff --git a/apps/mobile/app/(app)/(tabs)/home/settings.tsx b/apps/mobile/app/(app)/(tabs)/home/settings.tsx index d49595b..ea99c20 100644 --- a/apps/mobile/app/(app)/(tabs)/home/settings.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/settings.tsx @@ -18,6 +18,7 @@ import { } from "react-native" import { useSafeAreaInsets } from "react-native-safe-area-context" +import { AddButton } from "@/components/add-button" import { AudioFormatBadge } from "@/components/audio-format-badge" import { useDownloads, useDownloadsVersion } from "@/contexts/downloads" import { @@ -31,7 +32,7 @@ import { formatBytes, type DownloadQuality, } from "@otunes/convex/download-quality" -import { Input, LoadingView } from "@/components/ui/primitives" +import { LoadingView } from "@/components/ui/primitives" import { useInvalidateAuthSession } from "@/contexts/convex-auth-session" import { useServerConfig } from "@/contexts/server-config" import { @@ -276,15 +277,7 @@ function AppearanceSection() { function ProfileSection({ user }: { user: CurrentUser }) { const colors = useThemeColors() - const updateName = useMutation(api.users.updateProfileName) - const updateEmail = useMutation(api.users.updateProfileEmail) const updateImage = useMutation(api.users.updateProfileImage) - const updatePassword = useAction(api.users.updateOwnPassword) - const [name, setName] = useState(user.name) - const [email, setEmail] = useState(user.email) - const [newPassword, setNewPassword] = useState("") - const [confirmPassword, setConfirmPassword] = useState("") - const [changingPassword, setChangingPassword] = useState(false) async function pickImage() { const result = await ImagePicker.launchImageLibraryAsync({ @@ -316,130 +309,37 @@ function ProfileSection({ user }: { user: CurrentUser }) { } } - async function handlePasswordChange() { - if (newPassword !== confirmPassword) { - showError("Passwords do not match") - return - } - - setChangingPassword(true) - try { - await updatePassword({ newPassword }) - setNewPassword("") - setConfirmPassword("") - } catch (error) { - showError( - error instanceof Error ? error.message : "Failed to update password" - ) - } finally { - setChangingPassword(false) - } - } - return ( - <> - - - - - {user.name} - - - {user.email} - - - void pickImage()} - /> - {user.image ? ( - void removeImage()} - /> - ) : null} + + + + + {user.name} + + + {user.email} + - - - - - - void updateName({ name: name.trim() }).catch((error: Error) => - showError(error.message) - ) - } - /> - - - - - void updateEmail({ email: email.trim() }).catch((error: Error) => - showError(error.message) - ) - } - /> - - - - - - - {/* Spacer keeps both password fields the same width. */} - - - - - void handlePasswordChange()} - /> - - - + void pickImage()} + /> + {user.image ? ( + void removeImage()} + /> + ) : null} + ) } @@ -667,6 +567,7 @@ function DownloadsSection() { icon="trash-outline" label="Remove all downloads" destructive + plain onPress={() => confirm( "Remove all downloads?", @@ -873,8 +774,7 @@ function UsersSection({ router.push("/(app)/create-account")} /> @@ -1018,7 +918,8 @@ function GroupTitle({ {title} - {action} + {/* Overflows the row so every group title keeps the same height. */} + {action ? {action} : null} ) } @@ -1310,6 +1211,10 @@ const styles = StyleSheet.create({ justifyContent: "space-between", minHeight: 32, }, + groupAction: { + height: 0, + justifyContent: "center", + }, groupTitle: { fontSize: 15, fontWeight: "700", @@ -1357,14 +1262,6 @@ const styles = StyleSheet.create({ alignItems: "center", gap: spacing.md, }, - inputRow: { - flexDirection: "row", - alignItems: "center", - gap: spacing.sm, - }, - input: { - flex: 1, - }, iconButton: { width: 44, height: 44, diff --git a/apps/mobile/components/add-button.ios.tsx b/apps/mobile/components/add-button.ios.tsx new file mode 100644 index 0000000..4e01390 --- /dev/null +++ b/apps/mobile/components/add-button.ios.tsx @@ -0,0 +1,32 @@ +import { Button, Host } from "@expo/ui/swift-ui" +import { + buttonBorderShape, + buttonStyle, + controlSize, + labelStyle, +} from "@expo/ui/swift-ui/modifiers" + +/** A native SwiftUI glass "+" button, matching the iOS header close button. */ +export function AddButton({ + label, + onPress, +}: { + label: string + onPress: () => void +}) { + return ( + +