A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feat(mobile): streamline settings screens
Mohamed Bassem0bb4a60c0876
diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsxindex e864c8ca..9f3d9f1f 100644--- a/apps/mobile/app/dashboard/_layout.tsx+++ b/apps/mobile/app/dashboard/_layout.tsx@@ -20,6 +20,10 @@ export default function Dashboard() {const router = useRouter();const { colors } = useColorScheme();const formSheetSurfaceOptions = getFormSheetSurfaceOptions(colors.background);+ const settingsScreenOptions = {+ headerLargeTitle: false,+ sheetGrabberVisible: true,+ };const isLoggedIn = useIsLoggedIn();useEffect(() => {@@ -199,19 +203,38 @@ export default function Dashboard() {name="settings/index"options={{...formSheetSurfaceOptions,+ ...settingsScreenOptions,headerTitle: "Settings",headerTransparent: false,- headerLargeTitle: false,presentation: Platform.select({ios: "formSheet" as const,default: "modal" as const,}),- sheetGrabberVisible: true,+ title: "Settings",+ }}+ />+ <Stack.Screen+ name="settings/reading"+ options={{+ ...settingsScreenOptions,+ headerBackTitle: "Settings",+ headerTitle: "Reader View",+ title: "Reader View",+ }}+ />+ <Stack.Screen+ name="settings/uploads"+ options={{+ ...settingsScreenOptions,+ headerBackTitle: "Settings",+ headerTitle: "Uploads",+ title: "Uploads",}}/><Stack.Screenname="settings/theme"options={{+ ...settingsScreenOptions,title: "Theme",headerTitle: "Theme",headerBackTitle: "Back",@@ -220,41 +243,45 @@ export default function Dashboard() {<Stack.Screenname="settings/bookmark-default-view"options={{- title: "Bookmark View Mode",- headerTitle: "Bookmark View Mode",+ ...settingsScreenOptions,+ title: "Open Bookmarks In",+ headerTitle: "Open Bookmarks In",headerBackTitle: "Back",}}/><Stack.Screenname="settings/reader-settings"options={{- title: "Reader Settings",- headerTitle: "Reader Settings",+ ...settingsScreenOptions,+ title: "Text and Layout",+ headerTitle: "Text and Layout",headerBackTitle: "Back",}}/><Stack.Screenname="settings/offline"options={{- title: "Offline Content",- headerTitle: "Offline Content",+ ...settingsScreenOptions,+ title: "Downloads",+ headerTitle: "Downloads",headerBackTitle: "Back",}}/><Stack.Screenname="settings/usage"options={{- title: "Usage Statistics",- headerTitle: "Usage Statistics",+ ...settingsScreenOptions,+ title: "Statistics",+ headerTitle: "Statistics",headerBackTitle: "Back",- headerLargeTitle: false,}}/><Stack.Screenname="settings/toolbar-settings"options={{- title: "Toolbar Buttons",- headerTitle: "Toolbar Buttons",+ ...settingsScreenOptions,+ title: "Reader Toolbar",+ headerTitle: "Reader Toolbar",headerBackTitle: "Back",}}/>diff --git a/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx b/apps/mobile/app/dashboard/settings/bookmark-default-view.tsxindex 00920349..62230701 100644--- a/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx+++ b/apps/mobile/app/dashboard/settings/bookmark-default-view.tsx@@ -1,10 +1,13 @@-import { Pressable, ScrollView, View } from "react-native";+import { View } from "react-native";import { useRouter } from "expo-router";-import { Divider } from "@/components/ui/Divider";-import { Text } from "@/components/ui/Text";+import {+ SettingsChoiceRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import { useToast } from "@/components/ui/Toast";import useAppSettings from "@/lib/settings";-import { Check } from "lucide-react-native";export default function BookmarkDefaultViewSettings() {const router = useRouter();@@ -20,7 +23,7 @@ export default function BookmarkDefaultViewSettings() {defaultBookmarkView: mode,});toast({- message: "Default Bookmark View updated!",+ message: "Bookmark opening preference updated",showProgress: false,});router.back();@@ -33,43 +36,28 @@ export default function BookmarkDefaultViewSettings() {}};- const options = (["reader", "browser", "externalBrowser"] as const)- .map((mode) => {- const currentMode = settings.defaultBookmarkView;- const isChecked = currentMode === mode;- return [- <Pressable- onPress={() => handleUpdate(mode)}- className="flex flex-row items-center justify-between"- key={mode}- >- <Text className="mr-2 flex-1" numberOfLines={1}>- {- {- browser: "Browser",- reader: "Reader",- externalBrowser: "External Browser",- }[mode]- }- </Text>- {isChecked && <Check color="rgb(0, 122, 255)" />}- </Pressable>,- <Divider- key={mode + "-divider"}- orientation="horizontal"- className="my-3 h-0.5 w-full"- />,- ];- })- .flat();- options.pop();+ const modes = ["reader", "browser", "externalBrowser"] as const;return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"- contentContainerClassName="flex w-full items-center px-4 py-2"- >- <View className="w-full rounded-lg bg-card px-4 py-2">{options}</View>- </ScrollView>+ <SettingsScreen>+ <SettingsGroup footer="Choose what opens when you tap a bookmark.">+ {modes.map((mode, index) => (+ <View key={mode}>+ {index > 0 ? <SettingsSeparator /> : null}+ <SettingsChoiceRow+ label={+ {+ browser: "Browser",+ externalBrowser: "External Browser",+ reader: "Reader",+ }[mode]+ }+ onPress={() => void handleUpdate(mode)}+ selected={settings.defaultBookmarkView === mode}+ />+ </View>+ ))}+ </SettingsGroup>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/index.tsx b/apps/mobile/app/dashboard/settings/index.tsxindex 81077c9d..da655df0 100644--- a/apps/mobile/app/dashboard/settings/index.tsx+++ b/apps/mobile/app/dashboard/settings/index.tsx@@ -4,18 +4,20 @@ import {Alert,Modal,Pressable,- ScrollView,- Switch,TextInput,View,} from "react-native";-import Slider from "@react-native-community/slider";import Constants from "expo-constants";-import { Link } from "expo-router";-import { useHeaderHeight } from "expo-router/react-navigation";+import { useRouter } from "expo-router";+import {+ SettingsActionRow,+ SettingsGroup,+ SettingsNavigationRow,+ SettingsScreen,+ SettingsSeparator,+ SettingsValueRow,+} from "@/components/settings/settings-list";import { UserProfileHeader } from "@/components/settings/UserProfileHeader";-import ChevronRight from "@/components/ui/ChevronRight";-import { Divider } from "@/components/ui/Divider";import { Text } from "@/components/ui/Text";import { useServerVersion } from "@/lib/hooks";import {@@ -23,43 +25,28 @@ import {useOfflineLibrary,} from "@/lib/offlineLibrary";import { useSession } from "@/lib/session";+import {+ BOOKMARK_VIEW_LABELS,+ getUploadQualityLabel,+ THEME_LABELS,+} from "@/lib/settings-display";import useAppSettings from "@/lib/settings";import { useMutation, useQuery } from "@tanstack/react-query";import { useTRPC } from "@karakeep/shared-react/trpc";-function SectionHeader({ title }: { title: string }) {- return (- <Text className="px-4 pb-1 pt-4 text-xs uppercase tracking-wide text-muted-foreground">- {title}- </Text>- );-}-export default function Settings() {- const { logout } = useSession();- const headerHeight = useHeaderHeight();- const {- settings,- setSettings,- isLoading: isSettingsLoading,- } = useAppSettings();+ const router = useRouter();const api = useTRPC();+ const { logout } = useSession();+ const { settings, isLoading } = useAppSettings();const offlineLibrary = useOfflineLibrary(getOfflineLibraryScope(settings));-- const [imageQuality, setImageQuality] = useState<number | null>(null);-- useEffect(() => {- setImageQuality(settings.imageQuality * 100);- }, [settings.imageQuality]);-const { data, error } = useQuery(api.users.whoami.queryOptions());const {data: serverVersion,isLoading: isServerVersionLoading,error: serverVersionError,} = useServerVersion();-const [showPasswordModal, setShowPasswordModal] = useState(false);const [password, setPassword] = useState("");@@ -74,8 +61,8 @@ export default function Settings() {[{ text: "OK", onPress: logout }],);},- onError: (e) => {- if (e.data?.code === "UNAUTHORIZED") {+ onError: (mutationError) => {+ if (mutationError.data?.code === "UNAUTHORIZED") {Alert.alert("Error", "Invalid password. Please try again.");} else {Alert.alert("Error", "Failed to delete account. Please try again.");@@ -84,7 +71,16 @@ export default function Settings() {}),);- const isLocalUser = data?.localUser ?? false;+ useEffect(() => {+ if (error?.data?.code === "UNAUTHORIZED") {+ logout();+ }+ }, [error?.data?.code, logout]);++ const closePasswordModal = () => {+ setShowPasswordModal(false);+ setPassword("");+ };const handleDeleteAccount = () => {Alert.alert(@@ -96,7 +92,7 @@ export default function Settings() {text: "Delete",style: "destructive",onPress: () => {- if (isLocalUser) {+ if (data?.localUser ?? false) {setShowPasswordModal(true);} else {deleteAccount({});@@ -107,276 +103,132 @@ export default function Settings() {);};- if (error?.data?.code === "UNAUTHORIZED") {- logout();- }-return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"- contentContainerStyle={{- paddingHorizontal: 16,- paddingBottom: 40 + headerHeight,- }}- >+ <SettingsScreen><UserProfileHeaderimage={data?.image}name={data?.name}email={data?.email}/>- <SectionHeader title="Appearance" />- <View- className="w-full rounded-xl bg-card py-2"- style={{ borderCurve: "continuous" }}- >- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Link asChild href="/dashboard/settings/theme" className="flex-1">- <Pressable className="flex flex-row items-center">- <Text className="mr-2 flex-1" numberOfLines={1}>- Theme- </Text>- <Text className="mr-1 text-muted-foreground" numberOfLines={1}>- {- { light: "Light", dark: "Dark", system: "System" }[- settings.theme- ]- }- </Text>- <ChevronRight />- </Pressable>- </Link>- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Link- asChild- href="/dashboard/settings/bookmark-default-view"- className="flex-1"- >- <Pressable className="flex flex-row items-center">- <Text className="mr-2 flex-1" numberOfLines={1}>- Default Bookmark View- </Text>- {isSettingsLoading ? (- <ActivityIndicator size="small" />- ) : (- <Text className="mr-1 text-muted-foreground" numberOfLines={1}>- {- {- reader: "Reader",- browser: "Browser",- externalBrowser: "External Browser",- }[settings.defaultBookmarkView]- }- </Text>- )}- <ChevronRight />- </Pressable>- </Link>- </View>- </View>-- <SectionHeader title="Reading" />- <View- className="w-full rounded-xl bg-card py-2"- style={{ borderCurve: "continuous" }}- >- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Link- asChild- href="/dashboard/settings/reader-settings"- className="flex-1"- >- <Pressable className="flex flex-row items-center">- <Text className="mr-2 flex-1" numberOfLines={1}>- Reader Text Settings- </Text>- <ChevronRight />- </Pressable>- </Link>- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Text className="flex-1" numberOfLines={1}>- Show notes in bookmark card- </Text>- <Switch- className="shrink-0"- value={settings.showNotes}- onValueChange={(value) =>- setSettings({- ...settings,- showNotes: value,- })- }- />- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Link- asChild- href="/dashboard/settings/toolbar-settings"- className="flex-1"- >- <Pressable className="flex flex-row justify-between">- <Text>Toolbar Buttons</Text>- <ChevronRight />- </Pressable>- </Link>- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Text className="flex-1" numberOfLines={1}>- Keep screen on while reading- </Text>- <Switch- className="shrink-0"- disabled={isSettingsLoading}- value={settings.keepScreenOnWhileReading}- onValueChange={(value) => {- if (isSettingsLoading) return;- setSettings({- ...settings,- keepScreenOnWhileReading: value,- });- }}- />- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between gap-8 px-4 py-1">- <Link asChild href="/dashboard/settings/offline" className="flex-1">- <Pressable className="flex flex-row items-center">- <Text className="mr-2 flex-1" numberOfLines={1}>- Offline content- </Text>- <Text className="mr-1 text-muted-foreground">- {offlineLibrary.length}- </Text>- <ChevronRight />- </Pressable>- </Link>- </View>- </View>-- <SectionHeader title="Media" />- <View- className="w-full rounded-xl bg-card py-2"- style={{ borderCurve: "continuous" }}- >- <View className="flex w-full flex-col gap-1 px-4 py-2">- <View className="flex flex-row items-center justify-between">- <Text>Upload Image Quality</Text>- <Text className="text-foreground">- {Math.round(imageQuality ?? 0)}%- </Text>- </View>- {imageQuality === null ? (- <ActivityIndicator size="small" />- ) : (- <Slider- style={{ height: 40, width: "100%" }}- onSlidingComplete={(value) =>- setSettings({- ...settings,- imageQuality: Math.round(value) / 100,- })- }- onValueChange={(value) => setImageQuality(value)}- value={imageQuality}- minimumValue={0}- maximumValue={100}- />- )}- </View>- </View>-- <SectionHeader title="Library" />- <View- className="w-full overflow-hidden rounded-xl bg-card"- style={{ borderCurve: "continuous" }}- >- <Link asChild href="/dashboard/settings/usage">- <Pressable className="flex flex-row items-center px-4 py-3">- <Text className="mr-2 flex-1" numberOfLines={1}>- Usage statistics- </Text>- <ChevronRight />- </Pressable>- </Link>- </View>-- <SectionHeader title="Account" />- <View- className="w-full rounded-xl bg-card py-2"- style={{ borderCurve: "continuous" }}- >- <Pressable- className="flex flex-row items-center px-4 py-1"- onPress={logout}- >- <Text className="flex-1 text-destructive">Log Out</Text>- </Pressable>- <Divider orientation="horizontal" className="mx-6 my-1" />- <Pressable- className="flex flex-row items-center px-4 py-1"- onPress={handleDeleteAccount}+ <SettingsGroup header="Preferences">+ <SettingsNavigationRow+ label="Theme"+ onPress={() => router.push("/dashboard/settings/theme")}+ value={THEME_LABELS[settings.theme]}+ />+ <SettingsSeparator />+ <SettingsNavigationRow+ isLoading={isLoading}+ label="Open bookmarks in"+ onPress={() =>+ router.push("/dashboard/settings/bookmark-default-view")+ }+ value={BOOKMARK_VIEW_LABELS[settings.defaultBookmarkView]}+ />+ <SettingsSeparator />+ <SettingsNavigationRow+ label="Reader View"+ onPress={() => router.push("/dashboard/settings/reading")}+ />+ <SettingsSeparator />+ <SettingsNavigationRow+ isLoading={isLoading}+ label="Uploads"+ onPress={() => router.push("/dashboard/settings/uploads")}+ value={getUploadQualityLabel(settings.imageQuality)}+ />+ </SettingsGroup>++ <SettingsGroup header="Data">+ <SettingsNavigationRow+ label="Downloads"+ onPress={() => router.push("/dashboard/settings/offline")}+ value={String(offlineLibrary.length)}+ />+ <SettingsSeparator />+ <SettingsNavigationRow+ label="Statistics"+ onPress={() => router.push("/dashboard/settings/usage")}+ />+ </SettingsGroup>++ <SettingsGroup header="Account">+ <SettingsActionRow label="Log Out" onPress={logout} />+ <SettingsSeparator />+ <SettingsActionRowdisabled={isDeleting}- >- {isDeleting ? (- <ActivityIndicator size="small" />- ) : (- <Text className="flex-1 text-destructive">Delete Account</Text>- )}- </Pressable>- </View>+ isLoading={isDeleting}+ label="Delete Account"+ onPress={handleDeleteAccount}+ />+ </SettingsGroup>++ <SettingsGroup header="About">+ <SettingsValueRow+ label="Server"+ value={isLoading ? "Loading..." : settings.address}+ />+ <SettingsSeparator />+ <SettingsValueRow+ label="App Version"+ value={Constants.expoConfig?.version ?? "Unknown"}+ />+ <SettingsSeparator />+ <SettingsValueRow+ label="Server Version"+ value={+ isServerVersionLoading+ ? "Loading..."+ : serverVersionError+ ? "Unavailable"+ : (serverVersion ?? "Unknown")+ }+ />+ </SettingsGroup><Modal- visible={showPasswordModal}- transparentanimationType="fade"- onRequestClose={() => {- setShowPasswordModal(false);- setPassword("");- }}+ onRequestClose={closePasswordModal}+ transparent+ visible={showPasswordModal}><Pressable- className="flex-1 items-center justify-center bg-black/50"- onPress={() => {- setShowPasswordModal(false);- setPassword("");- }}+ accessibilityViewIsModal+ className="flex-1 items-center justify-center bg-black/50 px-8"+ onPress={closePasswordModal}>- <Pressable className="mx-8 w-full max-w-sm rounded-2xl bg-card p-6">+ <Pressable+ className="w-full max-w-sm rounded-2xl bg-card p-6"+ onPress={(event) => event.stopPropagation()}+ style={{ borderCurve: "continuous" }}+ ><Text className="mb-2 text-lg font-bold">Enter Password</Text><Text className="mb-4 text-sm text-muted-foreground">- Please enter your password to confirm account deletion.+ Enter your password to confirm account deletion.</Text><TextInput+ autoFocusclassName="mb-4 rounded-lg border border-input bg-background px-3 py-2 text-foreground"+ onChangeText={setPassword}placeholder="Password"secureTextEntryvalue={password}- onChangeText={setPassword}- autoFocus/>- <View className="flex flex-row justify-end gap-3">+ <View className="flex-row justify-end gap-3"><PressableclassName="rounded-lg px-4 py-2"- onPress={() => {- setShowPasswordModal(false);- setPassword("");- }}+ onPress={closePasswordModal}><Text className="text-muted-foreground">Cancel</Text></Pressable><PressableclassName="rounded-lg bg-destructive px-4 py-2"+ disabled={isDeleting || password.length === 0}onPress={() => deleteAccount({ password })}- disabled={isDeleting || !password}>{isDeleting ? (- <ActivityIndicator size="small" color="white" />+ <ActivityIndicator color="white" size="small" />) : (<Text className="font-medium text-destructive-foreground">Delete@@ -387,52 +239,6 @@ export default function Settings() {</Pressable></Pressable></Modal>-- <SectionHeader title="About" />- <View- className="w-full rounded-xl bg-card py-2"- style={{ borderCurve: "continuous" }}- >- <View className="flex flex-row items-center justify-between px-4 py-1">- <Text className="text-muted-foreground" numberOfLines={1}>- Server- </Text>- <Text- className="flex-1 text-right text-sm text-muted-foreground"- numberOfLines={1}- >- {isSettingsLoading ? "Loading..." : settings.address}- </Text>- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between px-4 py-1">- <Text className="w-fit text-muted-foreground" numberOfLines={1}>- App Version- </Text>- <Text- className="flex-1 text-right text-sm text-muted-foreground"- numberOfLines={1}- >- {Constants.expoConfig?.version ?? "unknown"}- </Text>- </View>- <Divider orientation="horizontal" className="mx-6 my-1" />- <View className="flex flex-row items-center justify-between px-4 py-1">- <Text className="text-muted-foreground" numberOfLines={1}>- Server Version- </Text>- <Text- className="flex-1 text-right text-sm text-muted-foreground"- numberOfLines={1}- >- {isServerVersionLoading- ? "Loading..."- : serverVersionError- ? "unavailable"- : (serverVersion ?? "unknown")}- </Text>- </View>- </View>- </ScrollView>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/offline.tsx b/apps/mobile/app/dashboard/settings/offline.tsxindex baf844cb..1201bfdf 100644--- a/apps/mobile/app/dashboard/settings/offline.tsx+++ b/apps/mobile/app/dashboard/settings/offline.tsx@@ -1,9 +1,13 @@import { useEffect } from "react";-import { Alert, Pressable, ScrollView, View } from "react-native";+import { Alert, Pressable, View } from "react-native";import { useRouter } from "expo-router";-import { useHeaderHeight } from "expo-router/react-navigation";+import {+ SettingsActionRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import EmptyState from "@/components/ui/EmptyState";-import { Divider } from "@/components/ui/Divider";import { Text } from "@/components/ui/Text";import { useToast } from "@/components/ui/Toast";import { clearPersistedCache, usePersistedCacheSize } from "@/lib/offlineCache";@@ -56,7 +60,6 @@ function CacheSectionHeader({ title, size }: { title: string; size: number }) {export default function OfflineContent() {const router = useRouter();- const headerHeight = useHeaderHeight();const queryClient = useQueryClient();const { toast } = useToast();const { settings } = useAppSettings();@@ -120,99 +123,90 @@ export default function OfflineContent() {};return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"- contentContainerStyle={{- paddingHorizontal: 16,- paddingBottom: 40 + headerHeight,- }}- >- <Text className="px-1 pb-3 text-sm text-muted-foreground">+ <SettingsScreen>+ <Text className="px-1 text-sm text-muted-foreground">Saved offline articles stay on this device. Everything else is cachedonly as you browse and can be cleared at any time.</Text>- <CacheSectionHeader- title="Saved offline content"- size={offlineLibrarySize}- />+ <View className="gap-4">+ <View className="gap-2">+ <CacheSectionHeader+ title="Saved offline content"+ size={offlineLibrarySize}+ />- {offlineLibrary.length === 0 ? (- <EmptyState- icon={BookOpen}- title="No saved offline articles"- subtitle="Open an article and choose Make available offline."- />- ) : (- <View- className="w-full rounded-xl bg-card py-1"- style={{ borderCurve: "continuous" }}- >- {offlineLibrary.map((item, index) => (- <View key={item.bookmarkId}>- <View className="flex-row items-center px-4 py-3">- <Pressable- className="min-w-0 flex-1"- onPress={() =>- router.push(`/dashboard/bookmarks/${item.bookmarkId}`)- }- >- <Text className="font-medium" numberOfLines={2}>- {item.displayTitle}- </Text>- {item.url && (- <Text- className="mt-0.5 text-xs text-muted-foreground"- numberOfLines={1}+ {offlineLibrary.length === 0 ? (+ <EmptyState+ icon={BookOpen}+ title="No saved offline articles"+ subtitle="Open an article and choose Make available offline."+ />+ ) : (+ <SettingsGroup>+ {offlineLibrary.map((item, index) => (+ <View key={item.bookmarkId}>+ {index > 0 ? <SettingsSeparator /> : null}+ <View className="flex-row items-center px-4 py-3">+ <Pressable+ className="min-w-0 flex-1"+ onPress={() =>+ router.push(`/dashboard/bookmarks/${item.bookmarkId}`)+ }+ >+ <Text className="font-medium" numberOfLines={2}>+ {item.displayTitle}+ </Text>+ {item.url ? (+ <Text+ className="mt-0.5 text-xs text-muted-foreground"+ numberOfLines={1}+ >+ {item.url}+ </Text>+ ) : null}+ <Text className="mt-1 text-xs text-muted-foreground">+ Saved{" "}+ {formatDistanceToNow(item.savedAt, { addSuffix: true })}+ </Text>+ </Pressable>+ <Pressable+ accessibilityLabel={`Remove ${item.displayTitle} offline copy`}+ className="ml-3 p-2"+ onPress={() =>+ confirmRemove(item.bookmarkId, item.displayTitle)+ }>- {item.url}- </Text>- )}- <Text className="mt-1 text-xs text-muted-foreground">- Saved{" "}- {formatDistanceToNow(item.savedAt, { addSuffix: true })}- </Text>- </Pressable>- <Pressable- accessibilityLabel={`Remove ${item.displayTitle} offline copy`}- className="ml-3 p-2"- onPress={() =>- confirmRemove(item.bookmarkId, item.displayTitle)- }- >- <Trash2 size={18} color={colors.destructive} />- </Pressable>- </View>- {index < offlineLibrary.length - 1 && (- <Divider orientation="horizontal" className="mx-6" />- )}- </View>- ))}+ <Trash2 size={18} color={colors.destructive} />+ </Pressable>+ </View>+ </View>+ ))}+ </SettingsGroup>+ )}</View>- )}- {offlineLibrary.length > 0 && (- <Pressable- className="mt-4 rounded-xl bg-card px-4 py-3"- onPress={confirmRemoveAll}- >- <Text className="text-center text-destructive">- Remove all offline content- </Text>- </Pressable>- )}+ {offlineLibrary.length > 0 ? (+ <SettingsGroup>+ <SettingsActionRow+ centered+ label="Remove all offline content"+ onPress={confirmRemoveAll}+ />+ </SettingsGroup>+ ) : null}+ </View>- <View className="mt-8">+ <View className="gap-2"><CacheSectionHeader title="Recent cache" size={recentCacheSize} />- <Pressable- className="rounded-xl bg-card px-4 py-3"- onPress={confirmClearRecentCache}- >- <Text className="text-center text-destructive">- Clear recent cache- </Text>- </Pressable>+ <SettingsGroup>+ <SettingsActionRow+ centered+ label="Clear recent cache"+ onPress={confirmClearRecentCache}+ />+ </SettingsGroup></View>- </ScrollView>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/reader-settings.tsx b/apps/mobile/app/dashboard/settings/reader-settings.tsxindex 4215abbd..50d5115c 100644--- a/apps/mobile/app/dashboard/settings/reader-settings.tsx+++ b/apps/mobile/app/dashboard/settings/reader-settings.tsx@@ -1,15 +1,21 @@import { useCallback, useEffect, useRef, useState } from "react";-import { Pressable, ScrollView, View } from "react-native";+import { View } from "react-native";import Slider from "@react-native-community/slider";import {ReaderPreview,ReaderPreviewRef,} from "@/components/reader/ReaderPreview";-import { Divider } from "@/components/ui/Divider";+import {+ SettingsActionRow,+ SettingsChoiceRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import { Text } from "@/components/ui/Text";import { MOBILE_FONT_FAMILIES, useReaderSettings } from "@/lib/readerSettings";import { useColorScheme } from "@/lib/useColorScheme";-import { Check, RotateCcw } from "lucide-react-native";+import { RotateCcw } from "lucide-react-native";import {formatFontFamily,@@ -121,105 +127,96 @@ export default function ReaderSettingsPage() {const fontFamilyOptions: ZReaderFontFamily[] = ["serif", "sans", "mono"];return (- <ScrollView- className="w-full"- contentContainerClassName="items-center gap-4 px-4 py-2"- contentInsetAdjustmentBehavior="automatic"- >- {/* Font Family Selection */}- <View className="w-full">- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">+ <SettingsScreen>+ <View className="w-full gap-2">+ <Text className="px-1 text-sm font-medium text-muted-foreground">Font Family{localOverrides.fontFamily !== undefined && (<Text className="text-blue-500"> (local)</Text>)}</Text>- <View className="w-full rounded-lg bg-card px-4 py-2">+ <SettingsGroup>{fontFamilyOptions.map((fontFamily, index) => {const isChecked = effectiveFontFamily === fontFamily;return (<View key={fontFamily}>- <Pressable+ {index > 0 ? <SettingsSeparator /> : null}+ <SettingsChoiceRow+ label={formatFontFamily(fontFamily)}+ labelStyle={{+ fontFamily: MOBILE_FONT_FAMILIES[fontFamily],+ }}onPress={() => handleFontFamilyChange(fontFamily)}- className="flex flex-row items-center justify-between py-2"- >- <Text- style={{- fontFamily: MOBILE_FONT_FAMILIES[fontFamily],- }}- >- {formatFontFamily(fontFamily)}- </Text>- {isChecked && <Check color="rgb(0, 122, 255)" />}- </Pressable>- {index < fontFamilyOptions.length - 1 && (- <Divider orientation="horizontal" className="h-0.5" />- )}+ selected={isChecked}+ /></View>);})}- </View>+ </SettingsGroup></View>- {/* Font Size */}- <View className="w-full">- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">+ <View className="w-full gap-2">+ <Text className="px-1 text-sm font-medium text-muted-foreground">Font Size ({formatFontSize(displayFontSize)}){localOverrides.fontSize !== undefined && (<Text className="text-blue-500"> (local)</Text>)}</Text>- <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">- <Text className="text-muted-foreground">- {READER_SETTING_CONSTRAINTS.fontSize.min}- </Text>- <Slider- style={{ height: 40, flex: 1 }}- value={displayFontSize}- minimumValue={READER_SETTING_CONSTRAINTS.fontSize.min}- maximumValue={READER_SETTING_CONSTRAINTS.fontSize.max}- onValueChange={(value) => updatePreviewFontSize(Math.round(value))}- onSlidingComplete={(value) =>- handleFontSizeChange(Math.round(value))- }- />- <Text className="text-muted-foreground">- {READER_SETTING_CONSTRAINTS.fontSize.max}- </Text>- </View>+ <SettingsGroup>+ <View className="flex-row items-center gap-3 px-4 py-1">+ <Text className="text-muted-foreground">+ {READER_SETTING_CONSTRAINTS.fontSize.min}+ </Text>+ <Slider+ style={{ height: 40, flex: 1 }}+ value={displayFontSize}+ minimumValue={READER_SETTING_CONSTRAINTS.fontSize.min}+ maximumValue={READER_SETTING_CONSTRAINTS.fontSize.max}+ onValueChange={(value) =>+ updatePreviewFontSize(Math.round(value))+ }+ onSlidingComplete={(value) =>+ handleFontSizeChange(Math.round(value))+ }+ />+ <Text className="text-muted-foreground">+ {READER_SETTING_CONSTRAINTS.fontSize.max}+ </Text>+ </View>+ </SettingsGroup></View>- {/* Line Height */}- <View className="w-full">- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">+ <View className="w-full gap-2">+ <Text className="px-1 text-sm font-medium text-muted-foreground">Line Height ({formatLineHeight(displayLineHeight)}){localOverrides.lineHeight !== undefined && (<Text className="text-blue-500"> (local)</Text>)}</Text>- <View className="flex w-full flex-row items-center gap-3 rounded-lg bg-card px-4 py-3">- <Text className="text-muted-foreground">- {READER_SETTING_CONSTRAINTS.lineHeight.min}- </Text>- <Slider- style={{ height: 40, flex: 1 }}- value={displayLineHeight}- minimumValue={READER_SETTING_CONSTRAINTS.lineHeight.min}- maximumValue={READER_SETTING_CONSTRAINTS.lineHeight.max}- onValueChange={(value) =>- updatePreviewLineHeight(Math.round(value * 10) / 10)- }- onSlidingComplete={handleLineHeightChange}- />- <Text className="text-muted-foreground">- {READER_SETTING_CONSTRAINTS.lineHeight.max}- </Text>- </View>+ <SettingsGroup>+ <View className="flex-row items-center gap-3 px-4 py-1">+ <Text className="text-muted-foreground">+ {READER_SETTING_CONSTRAINTS.lineHeight.min}+ </Text>+ <Slider+ style={{ height: 40, flex: 1 }}+ value={displayLineHeight}+ minimumValue={READER_SETTING_CONSTRAINTS.lineHeight.min}+ maximumValue={READER_SETTING_CONSTRAINTS.lineHeight.max}+ onValueChange={(value) =>+ updatePreviewLineHeight(Math.round(value * 10) / 10)+ }+ onSlidingComplete={handleLineHeightChange}+ />+ <Text className="text-muted-foreground">+ {READER_SETTING_CONSTRAINTS.lineHeight.max}+ </Text>+ </View>+ </SettingsGroup></View>- {/* Preview */}- <View className="w-full">- <Text className="mb-2 px-1 text-sm font-medium text-muted-foreground">+ <View className="w-full gap-2">+ <Text className="px-1 text-sm font-medium text-muted-foreground">Preview</Text><ReaderPreview@@ -230,42 +227,43 @@ export default function ReaderSettingsPage() {/></View>- <Divider orientation="horizontal" className="my-2 w-full" />-- {/* Save as Default */}- <Pressable- onPress={handleSaveAsDefault}- disabled={!hasLocalOverrides}- className="w-full rounded-lg bg-card px-4 py-3"- >- <Text- className={`text-center ${hasLocalOverrides ? "text-blue-500" : "text-muted-foreground"}`}- >- Save as Default (All Devices)- </Text>- </Pressable>-- {/* Clear Local */}- {hasLocalOverrides && (- <Pressable- onPress={handleClearLocalOverrides}- className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"- >- <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />- <Text className="text-muted-foreground">Clear Local Overrides</Text>- </Pressable>- )}-- {/* Clear Server */}- {hasServerDefaults && (- <Pressable- onPress={handleClearServerDefaults}- className="flex w-full flex-row items-center justify-center gap-2 rounded-lg bg-card px-4 py-3"- >- <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />- <Text className="text-muted-foreground">Clear Server Defaults</Text>- </Pressable>- )}- </ScrollView>+ <SettingsGroup>+ <SettingsActionRow+ centered+ disabled={!hasLocalOverrides}+ label="Save as Default (All Devices)"+ onPress={handleSaveAsDefault}+ tone="primary"+ />+ {hasLocalOverrides ? (+ <>+ <SettingsSeparator />+ <SettingsActionRow+ centered+ label="Clear Local Overrides"+ leading={+ <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />+ }+ onPress={handleClearLocalOverrides}+ tone="default"+ />+ </>+ ) : null}+ {hasServerDefaults ? (+ <>+ <SettingsSeparator />+ <SettingsActionRow+ centered+ label="Clear Server Defaults"+ leading={+ <RotateCcw size={16} color={isDark ? "#9ca3af" : "#6b7280"} />+ }+ onPress={handleClearServerDefaults}+ tone="default"+ />+ </>+ ) : null}+ </SettingsGroup>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/reading.tsx b/apps/mobile/app/dashboard/settings/reading.tsxnew file mode 100644index 00000000..b2a5bf79--- /dev/null+++ b/apps/mobile/app/dashboard/settings/reading.tsx@@ -0,0 +1,41 @@+import { useRouter } from "expo-router";+import {+ SettingsGroup,+ SettingsNavigationRow,+ SettingsScreen,+ SettingsSeparator,+ SettingsToggleRow,+} from "@/components/settings/settings-list";+import useAppSettings from "@/lib/settings";++export default function ReaderViewSettings() {+ const router = useRouter();+ const { settings, setSettings, isLoading } = useAppSettings();++ return (+ <SettingsScreen>+ <SettingsGroup header="Reader">+ <SettingsNavigationRow+ label="Text and layout"+ onPress={() => router.push("/dashboard/settings/reader-settings")}+ />+ <SettingsSeparator />+ <SettingsNavigationRow+ label="Reader toolbar"+ onPress={() => router.push("/dashboard/settings/toolbar-settings")}+ />+ </SettingsGroup>++ <SettingsGroup header="Behavior">+ <SettingsToggleRow+ disabled={isLoading}+ label="Keep screen awake"+ onValueChange={(keepScreenOnWhileReading) =>+ setSettings({ ...settings, keepScreenOnWhileReading })+ }+ value={settings.keepScreenOnWhileReading}+ />+ </SettingsGroup>+ </SettingsScreen>+ );+}diff --git a/apps/mobile/app/dashboard/settings/theme.tsx b/apps/mobile/app/dashboard/settings/theme.tsxindex a98ca4a9..4d165001 100644--- a/apps/mobile/app/dashboard/settings/theme.tsx+++ b/apps/mobile/app/dashboard/settings/theme.tsx@@ -1,46 +1,37 @@-import { Pressable, ScrollView, View } from "react-native";-import { Divider } from "@/components/ui/Divider";-import { Text } from "@/components/ui/Text";+import { View } from "react-native";+import {+ SettingsChoiceRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import useAppSettings from "@/lib/settings";-import { Check } from "lucide-react-native";export default function ThemePage() {const { settings, setSettings } = useAppSettings();- const options = (["light", "dark", "system"] as const)- .map((theme) => {- const isChecked = settings.theme === theme;- return [- <Pressable- onPress={() => setSettings({ ...settings, theme })}- className="flex flex-row items-center justify-between"- key={theme}- >- <Text className="mr-2 flex-1" numberOfLines={1}>- {- { light: "Light Mode", dark: "Dark Mode", system: "System" }[- theme- ]- }- </Text>- {isChecked && <Check color="rgb(0, 122, 255)" />}- </Pressable>,- <Divider- key={theme + "-divider"}- orientation="horizontal"- className="my-3 h-0.5 w-full"- />,- ];- })- .flat();- options.pop();+ const themes = ["light", "dark", "system"] as const;return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"- contentContainerClassName="flex w-full items-center px-4 py-2"- >- <View className="w-full rounded-lg bg-card px-4 py-2">{options}</View>- </ScrollView>+ <SettingsScreen>+ <SettingsGroup>+ {themes.map((theme, index) => (+ <View key={theme}>+ {index > 0 ? <SettingsSeparator /> : null}+ <SettingsChoiceRow+ label={+ {+ dark: "Dark Mode",+ light: "Light Mode",+ system: "System",+ }[theme]+ }+ onPress={() => setSettings({ ...settings, theme })}+ selected={settings.theme === theme}+ />+ </View>+ ))}+ </SettingsGroup>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/toolbar-settings.tsx b/apps/mobile/app/dashboard/settings/toolbar-settings.tsxindex 71341a19..b8fdc78a 100644--- a/apps/mobile/app/dashboard/settings/toolbar-settings.tsx+++ b/apps/mobile/app/dashboard/settings/toolbar-settings.tsx@@ -1,12 +1,17 @@import type { ToolbarActionId } from "@/lib/settings";import { useCallback } from "react";-import { Pressable, ScrollView, TouchableOpacity, View } from "react-native";+import { Pressable, View } from "react-native";import DraggableFlatList, {ScaleDecorator,} from "react-native-draggable-flatlist";import { TOOLBAR_ACTION_REGISTRY } from "@/components/bookmarks/BottomActions";+import {+ SettingsActionRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import { TailwindResolver } from "@/components/TailwindResolver";-import { Divider } from "@/components/ui/Divider";import { Text } from "@/components/ui/Text";import useAppSettings, {DEFAULT_OVERFLOW_ACTIONS,@@ -71,11 +76,10 @@ export default function ToolbarSettingsPage() {const meta = TOOLBAR_ACTION_REGISTRY[item];return (<ScaleDecorator>- <TouchableOpacity- activeOpacity={0.7}+ <PressableonLongPress={drag}disabled={isActive}- className="flex flex-row items-center gap-3 bg-card px-4 py-3"+ className="flex-row items-center gap-3 bg-card px-4 py-3 active:opacity-70"><TailwindResolverclassName="text-muted-foreground"@@ -98,7 +102,7 @@ export default function ToolbarSettingsPage() {)}/></Pressable>- </TouchableOpacity>+ </Pressable></ScaleDecorator>);},@@ -119,11 +123,10 @@ export default function ToolbarSettingsPage() {const canPromote = visible.length < MAX_VISIBLE;return (<ScaleDecorator>- <TouchableOpacity- activeOpacity={0.7}+ <PressableonLongPress={drag}disabled={isActive}- className="flex flex-row items-center gap-3 bg-card px-4 py-3"+ className="flex-row items-center gap-3 bg-card px-4 py-3 active:opacity-70"><TailwindResolverclassName="text-muted-foreground"@@ -154,7 +157,7 @@ export default function ToolbarSettingsPage() {)}/></Pressable>- </TouchableOpacity>+ </Pressable></ScaleDecorator>);},@@ -162,18 +165,8 @@ export default function ToolbarSettingsPage() {);return (- <ScrollView- className="w-full"- contentContainerClassName="gap-4 px-4 py-2"- contentInsetAdjustmentBehavior="automatic"- >- <Text className="px-1 text-xs uppercase tracking-wide text-muted-foreground">- Visible Actions (max {MAX_VISIBLE})- </Text>- <View- className="w-full overflow-hidden rounded-xl bg-card"- style={{ borderCurve: "continuous" }}- >+ <SettingsScreen>+ <SettingsGroup header={`Visible actions (max ${MAX_VISIBLE})`}>{visible.length === 0 ? (<View className="px-4 py-3"><Text className="text-sm text-muted-foreground">@@ -187,20 +180,12 @@ export default function ToolbarSettingsPage() {keyExtractor={(item) => item}onDragEnd={({ data }) => save(data, overflow)}scrollEnabled={false}- ItemSeparatorComponent={() => (- <Divider orientation="horizontal" className="mx-6" />- )}+ ItemSeparatorComponent={SettingsSeparator}/>)}- </View>+ </SettingsGroup>- <Text className="px-1 text-xs uppercase tracking-wide text-muted-foreground">- Overflow Actions- </Text>- <View- className="w-full overflow-hidden rounded-xl bg-card"- style={{ borderCurve: "continuous" }}- >+ <SettingsGroup header="Overflow actions">{overflow.length === 0 ? (<View className="px-4 py-3"><Text className="text-sm text-muted-foreground">@@ -214,20 +199,19 @@ export default function ToolbarSettingsPage() {keyExtractor={(item) => item}onDragEnd={({ data }) => save(visible, data)}scrollEnabled={false}- ItemSeparatorComponent={() => (- <Divider orientation="horizontal" className="mx-6" />- )}+ ItemSeparatorComponent={SettingsSeparator}/>)}- </View>+ </SettingsGroup>- <Pressable- onPress={resetToDefaults}- className="w-full rounded-xl bg-card px-4 py-3"- style={{ borderCurve: "continuous" }}- >- <Text className="text-center text-blue-500">Reset to Defaults</Text>- </Pressable>- </ScrollView>+ <SettingsGroup>+ <SettingsActionRow+ centered+ label="Reset to Defaults"+ onPress={resetToDefaults}+ tone="primary"+ />+ </SettingsGroup>+ </SettingsScreen>);}diff --git a/apps/mobile/app/dashboard/settings/uploads.tsx b/apps/mobile/app/dashboard/settings/uploads.tsxnew file mode 100644index 00000000..35f536d3--- /dev/null+++ b/apps/mobile/app/dashboard/settings/uploads.tsx@@ -0,0 +1,48 @@+import { View } from "react-native";+import {+ SettingsChoiceRow,+ SettingsGroup,+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";+import {+ getUploadQualityLabel,+ UPLOAD_QUALITY_OPTIONS,+} from "@/lib/settings-display";+import useAppSettings from "@/lib/settings";++export default function UploadSettings() {+ const { settings, setSettings, isLoading } = useAppSettings();+ const selectedLabel = getUploadQualityLabel(settings.imageQuality);++ return (+ <SettingsScreen>+ <SettingsGroup+ header="Image quality"+ footer="This controls image compression when adding an image bookmark."+ >+ {UPLOAD_QUALITY_OPTIONS.map((option, index) => {+ const isSelected = selectedLabel === option.label;++ return (+ <View key={option.label}>+ {index > 0 ? <SettingsSeparator /> : null}+ <SettingsChoiceRow+ description={option.description}+ disabled={isLoading}+ label={option.label}+ onPress={() =>+ setSettings({+ ...settings,+ imageQuality: option.value,+ })+ }+ selected={isSelected}+ />+ </View>+ );+ })}+ </SettingsGroup>+ </SettingsScreen>+ );+}diff --git a/apps/mobile/components/bookmarks/BookmarkListHeader.tsx b/apps/mobile/components/bookmarks/BookmarkListHeader.tsxindex ce753044..c59bba2d 100644--- a/apps/mobile/components/bookmarks/BookmarkListHeader.tsx+++ b/apps/mobile/components/bookmarks/BookmarkListHeader.tsx@@ -13,29 +13,39 @@ function useBookmarkListLayoutMenu(): {const { settings, setSettings } = useAppSettings();const { menuIconColor } = useMenuIconColors();+ const layoutModeActions: MenuAction[] = [+ {+ id: "card",+ title: "Card",+ state: settings.bookmarkLayout === "card" ? "on" : "off",+ image: Platform.select({ ios: "rectangle.grid.1x2" }),+ imageColor: Platform.select({ ios: menuIconColor }),+ },+ {+ id: "list",+ title: "List",+ state: settings.bookmarkLayout === "list" ? "on" : "off",+ image: Platform.select({ ios: "list.bullet" }),+ imageColor: Platform.select({ ios: menuIconColor }),+ },+ ];+ const showNotesAction: MenuAction = {+ id: "show_notes",+ title: "Show Notes",+ state: settings.showNotes ? "on" : "off",+ image: Platform.select({ ios: "note.text" }),+ imageColor: Platform.select({ ios: menuIconColor }),+ };+const layoutActions: MenuAction[] = [{id: "layout",title: "Layout",image: Platform.select({ ios: "rectangle.grid.1x2" }),imageColor: Platform.select({ ios: menuIconColor }),- subactions: [- {- id: "card",- title: "Card",- state: settings.bookmarkLayout === "card" ? "on" : "off",- image: Platform.select({ ios: "rectangle.grid.1x2" }),- imageColor: Platform.select({ ios: menuIconColor }),- },- {- id: "list",- title: "List",- state: settings.bookmarkLayout === "list" ? "on" : "off",- image: Platform.select({ ios: "list.bullet" }),- imageColor: Platform.select({ ios: menuIconColor }),- },- ],+ subactions: layoutModeActions,},+ showNotesAction,{id: "sort",title: "Sort",@@ -69,6 +79,14 @@ function useBookmarkListLayoutMenu(): {return true;}+ if (event === "show_notes") {+ setSettings({+ ...settings,+ showNotes: !settings.showNotes,+ });+ return true;+ }+if (event === "sort_desc" || event === "sort_asc") {setSettings({...settings,diff --git a/apps/mobile/components/settings/UsageStatsScreen.tsx b/apps/mobile/components/settings/UsageStatsScreen.tsxindex 285d9fe7..06ffa02d 100644--- a/apps/mobile/components/settings/UsageStatsScreen.tsx+++ b/apps/mobile/components/settings/UsageStatsScreen.tsx@@ -1,13 +1,10 @@import type { LucideIcon } from "lucide-react-native";-import {- RefreshControl,- ScrollView,- useWindowDimensions,- View,-} from "react-native";-import { useHeaderHeight } from "expo-router/react-navigation";+import { RefreshControl, useWindowDimensions, View } from "react-native";import QueryPageState from "@/components/QueryPageState";-import { Divider } from "@/components/ui/Divider";+import {+ SettingsScreen,+ SettingsSeparator,+} from "@/components/settings/settings-list";import EmptyState from "@/components/ui/EmptyState";import { Skeleton } from "@/components/ui/Skeleton";import { Text } from "@/components/ui/Text";@@ -127,7 +124,7 @@ function SectionCard({<Icon size={18} color={colors.primary} strokeWidth={2.25} /><Text className="font-semibold">{title}</Text></View>- <Divider orientation="horizontal" className="mx-4" />+ <SettingsSeparator className="mx-4 my-0" /><View className="gap-4 p-4">{children}</View></View>);@@ -430,17 +427,8 @@ function SourcesList({ stats }: { stats: UserStats }) {}function StatsSkeleton() {- const headerHeight = useHeaderHeight();-return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"- contentContainerStyle={{- gap: 12,- paddingHorizontal: 16,- paddingBottom: 40 + headerHeight,- }}- >+ <SettingsScreen contentContainerStyle={{ gap: 12 }}><View className="rounded-2xl bg-card p-5"><Skeleton className="mb-5 h-10 w-10 rounded-full" /><Skeleton className="mb-2 h-10 w-28" />@@ -457,12 +445,11 @@ function StatsSkeleton() {</View><Skeleton className="h-52 rounded-2xl" /><Skeleton className="h-72 rounded-2xl" />- </ScrollView>+ </SettingsScreen>);}export default function UsageStatsScreen() {- const headerHeight = useHeaderHeight();const { width: windowWidth } = useWindowDimensions();const { colors } = useColorScheme();const api = useTRPC();@@ -491,8 +478,7 @@ export default function UsageStatsScreen() {metricColumnCount;return (- <ScrollView- contentInsetAdjustmentBehavior="automatic"+ <SettingsScreenrefreshControl={<RefreshControlrefreshing={isRefetching}@@ -501,11 +487,7 @@ export default function UsageStatsScreen() {colors={[colors.primary]}/>}- contentContainerStyle={{- gap: 12,- paddingHorizontal: 16,- paddingBottom: 40 + headerHeight,- }}+ contentContainerStyle={{ gap: 12 }}><ViewclassName="overflow-hidden rounded-2xl bg-card"@@ -535,7 +517,7 @@ export default function UsageStatsScreen() {<BookOpen size={21} color={colors.primary} strokeWidth={2.25} /></View></View>- <Divider orientation="horizontal" style={{ marginVertical: 18 }} />+ <SettingsSeparator className="mx-0" style={{ marginVertical: 18 }} /><View className="flex-row items-start gap-4"><View className="flex-1"><Text selectable className="font-semibold tabular-nums">@@ -679,6 +661,6 @@ export default function UsageStatsScreen() {) : null}</>)}- </ScrollView>+ </SettingsScreen>);}diff --git a/apps/mobile/components/settings/settings-list.tsx b/apps/mobile/components/settings/settings-list.tsxnew file mode 100644index 00000000..784cf35c--- /dev/null+++ b/apps/mobile/components/settings/settings-list.tsx@@ -0,0 +1,274 @@+import type { ComponentProps, ReactNode } from "react";+import type { StyleProp, TextStyle, ViewStyle } from "react-native";+import {+ ActivityIndicator,+ Pressable,+ ScrollView,+ StyleSheet,+ Switch,+ View,+} from "react-native";+import { useHeaderHeight } from "expo-router/react-navigation";+import ChevronRight from "@/components/ui/ChevronRight";+import { Text } from "@/components/ui/Text";+import { useColorScheme } from "@/lib/useColorScheme";+import { cn } from "@/lib/utils";+import { Check } from "lucide-react-native";++function SettingsScreen({+ children,+ contentContainerStyle,+ ...props+}: Omit<+ ComponentProps<typeof ScrollView>,+ "contentContainerStyle" | "contentInsetAdjustmentBehavior"+> & {+ children: ReactNode;+ contentContainerStyle?: StyleProp<ViewStyle>;+}) {+ const headerHeight = useHeaderHeight();++ return (+ <ScrollView+ {...props}+ contentInsetAdjustmentBehavior="automatic"+ contentContainerStyle={[+ {+ gap: 24,+ paddingBottom: 40 + headerHeight,+ paddingHorizontal: 16,+ paddingTop: 12,+ },+ contentContainerStyle,+ ]}+ >+ {children}+ </ScrollView>+ );+}++function SettingsGroup({+ children,+ footer,+ header,+}: {+ children: ReactNode;+ footer?: string;+ header?: string;+}) {+ return (+ <View className="gap-1.5">+ {header ? (+ <Text+ variant="footnote"+ color="tertiary"+ className="px-4 uppercase tracking-wide"+ >+ {header}+ </Text>+ ) : null}+ <View+ className="overflow-hidden rounded-xl bg-card py-2"+ style={{ borderCurve: "continuous" }}+ >+ {children}+ </View>+ {footer ? (+ <Text variant="footnote" color="tertiary" className="px-4 pt-1">+ {footer}+ </Text>+ ) : null}+ </View>+ );+}++function SettingsSeparator({+ className,+ style,+}: {+ className?: string;+ style?: StyleProp<ViewStyle>;+}) {+ return (+ <View+ className={cn("mx-6 my-1 bg-border", className)}+ style={[{ height: StyleSheet.hairlineWidth }, style]}+ />+ );+}++function SettingsNavigationRow({+ isLoading = false,+ label,+ onPress,+ value,+}: {+ isLoading?: boolean;+ label: string;+ onPress: () => void;+ value?: string;+}) {+ return (+ <Pressable+ accessibilityHint={`Opens ${label} settings`}+ accessibilityRole="button"+ className="flex-row items-center px-4 py-1 active:bg-muted/10"+ onPress={onPress}+ >+ <Text className="mr-3 flex-1" numberOfLines={1}>+ {label}+ </Text>+ {isLoading ? (+ <ActivityIndicator className="mr-2" size="small" />+ ) : value ? (+ <Text color="tertiary" className="mr-2 max-w-[45%]" numberOfLines={1}>+ {value}+ </Text>+ ) : null}+ <ChevronRight size={17} strokeWidth={2.25} />+ </Pressable>+ );+}++function SettingsToggleRow({+ disabled = false,+ label,+ onValueChange,+ value,+}: {+ disabled?: boolean;+ label: string;+ onValueChange: (value: boolean) => void;+ value: boolean;+}) {+ return (+ <View className="flex-row items-center px-4 py-1">+ <Text className="mr-3 flex-1">{label}</Text>+ <Switch+ accessibilityLabel={label}+ disabled={disabled}+ onValueChange={onValueChange}+ value={value}+ />+ </View>+ );+}++function SettingsChoiceRow({+ description,+ disabled = false,+ label,+ labelStyle,+ onPress,+ selected,+}: {+ description?: string;+ disabled?: boolean;+ label: string;+ labelStyle?: StyleProp<TextStyle>;+ onPress: () => void;+ selected: boolean;+}) {+ const { colors } = useColorScheme();++ return (+ <Pressable+ accessibilityRole="radio"+ accessibilityState={{ checked: selected, disabled }}+ className={cn(+ "flex-row items-center px-4 active:bg-muted/10",+ description ? "min-h-16 py-2" : "py-1",+ )}+ disabled={disabled}+ onPress={onPress}+ >+ <View className="mr-3 flex-1 gap-0.5">+ <Text numberOfLines={1} style={labelStyle}>+ {label}+ </Text>+ {description ? (+ <Text variant="footnote" color="tertiary">+ {description}+ </Text>+ ) : null}+ </View>+ {selected ? (+ <Check color={colors.primary} size={22} strokeWidth={2.4} />+ ) : null}+ </Pressable>+ );+}++function SettingsValueRow({ label, value }: { label: string; value: string }) {+ return (+ <View className="flex-row items-center gap-4 px-4 py-1">+ <Text className="flex-1">{label}</Text>+ <Text+ selectable+ color="tertiary"+ className="max-w-[60%] text-right"+ numberOfLines={2}+ >+ {value}+ </Text>+ </View>+ );+}++function SettingsActionRow({+ centered = false,+ disabled = false,+ isLoading = false,+ label,+ leading,+ onPress,+ tone = "destructive",+}: {+ centered?: boolean;+ disabled?: boolean;+ isLoading?: boolean;+ label: string;+ leading?: ReactNode;+ onPress: () => void;+ tone?: "default" | "destructive" | "primary";+}) {+ const textClassName = disabled+ ? "text-muted-foreground"+ : tone === "primary"+ ? "text-primary"+ : tone === "destructive"+ ? "text-destructive"+ : "text-foreground";++ return (+ <Pressable+ accessibilityRole="button"+ className={cn(+ "flex-row items-center gap-2 px-4 py-1 active:bg-muted/10",+ centered ? "justify-center" : undefined,+ )}+ disabled={disabled}+ onPress={onPress}+ >+ {isLoading ? (+ <ActivityIndicator size="small" />+ ) : (+ <>+ {leading}+ <Text className={textClassName}>{label}</Text>+ </>+ )}+ </Pressable>+ );+}++export {+ SettingsActionRow,+ SettingsChoiceRow,+ SettingsGroup,+ SettingsNavigationRow,+ SettingsScreen,+ SettingsSeparator,+ SettingsToggleRow,+ SettingsValueRow,+};diff --git a/apps/mobile/lib/settings-display.ts b/apps/mobile/lib/settings-display.tsnew file mode 100644index 00000000..1ccbe964--- /dev/null+++ b/apps/mobile/lib/settings-display.ts@@ -0,0 +1,46 @@+import type { Settings } from "@/lib/settings";++const THEME_LABELS: Record<Settings["theme"], string> = {+ dark: "Dark",+ light: "Light",+ system: "System",+};++const BOOKMARK_VIEW_LABELS: Record<Settings["defaultBookmarkView"], string> = {+ browser: "Browser",+ externalBrowser: "External Browser",+ reader: "Reader",+};++const UPLOAD_QUALITY_OPTIONS = [+ {+ description: "Smaller files and faster uploads",+ label: "Data Saver",+ value: 0.2,+ },+ {+ description: "A balance of detail and file size",+ label: "Standard",+ value: 0.6,+ },+ {+ description: "Keep the most image detail",+ label: "Original",+ value: 1,+ },+] as const;++function getUploadQualityLabel(value: number) {+ return UPLOAD_QUALITY_OPTIONS.reduce((closest, option) =>+ Math.abs(option.value - value) < Math.abs(closest.value - value)+ ? option+ : closest,+ ).label;+}++export {+ BOOKMARK_VIEW_LABELS,+ getUploadQualityLabel,+ THEME_LABELS,+ UPLOAD_QUALITY_OPTIONS,+};