From e455e46852900c6d2b3e77b7a77e1b9da41b2ca8 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 8 Feb 2026 22:45:32 +0000 Subject: feat(mobile): more native screens --- .../app/dashboard/(tabs)/(settings)/_layout.tsx | 18 ++ .../app/dashboard/(tabs)/(settings)/index.tsx | 225 +++++++++++++++++++++ 2 files changed, 243 insertions(+) create mode 100644 apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx create mode 100644 apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx (limited to 'apps/mobile/app/dashboard/(tabs)/(settings)') diff --git a/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx new file mode 100644 index 00000000..8c51d5a3 --- /dev/null +++ b/apps/mobile/app/dashboard/(tabs)/(settings)/_layout.tsx @@ -0,0 +1,18 @@ +import { Stack } from "expo-router/stack"; + +export default function Layout() { + return ( + + + + ); +} diff --git a/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx new file mode 100644 index 00000000..de17ff5a --- /dev/null +++ b/apps/mobile/app/dashboard/(tabs)/(settings)/index.tsx @@ -0,0 +1,225 @@ +import { useEffect } from "react"; +import { + ActivityIndicator, + Pressable, + ScrollView, + Switch, + View, +} from "react-native"; +import { Slider } from "react-native-awesome-slider"; +import { useSharedValue } from "react-native-reanimated"; +import Constants from "expo-constants"; +import { Link } from "expo-router"; +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 { useSession } from "@/lib/session"; +import useAppSettings from "@/lib/settings"; +import { useQuery } from "@tanstack/react-query"; + +import { useTRPC } from "@karakeep/shared-react/trpc"; + +function SectionHeader({ title }: { title: string }) { + return ( + + {title} + + ); +} + +export default function Settings() { + const { logout } = useSession(); + const { + settings, + setSettings, + isLoading: isSettingsLoading, + } = useAppSettings(); + const api = useTRPC(); + + const imageQuality = useSharedValue(0); + const imageQualityMin = useSharedValue(0); + const imageQualityMax = useSharedValue(100); + + useEffect(() => { + imageQuality.value = settings.imageQuality * 100; + }, [settings]); + + const { data, error } = useQuery(api.users.whoami.queryOptions()); + const { + data: serverVersion, + isLoading: isServerVersionLoading, + error: serverVersionError, + } = useServerVersion(); + + if (error?.data?.code === "UNAUTHORIZED") { + logout(); + } + + return ( + + + + + + + + + Theme + + + { + { light: "Light", dark: "Dark", system: "System" }[ + settings.theme + ] + } + + + + + + + + + + + Default Bookmark View + + {isSettingsLoading ? ( + + ) : ( + + {settings.defaultBookmarkView === "reader" + ? "Reader" + : "Browser"} + + )} + + + + + + + + + + + + + Reader Text Settings + + + + + + + + Show notes in bookmark card + + + setSettings({ + ...settings, + showNotes: value, + }) + } + /> + + + + + + + Upload Image Quality + + + {Math.round(settings.imageQuality * 100)}% + + + setSettings({ + ...settings, + imageQuality: Math.round(value) / 100, + }) + } + progress={imageQuality} + minimumValue={imageQualityMin} + maximumValue={imageQualityMax} + /> + + + + + + + + Log Out + + + + + + + Server + + {isSettingsLoading ? "Loading..." : settings.address} + + + + + App Version + + {Constants.expoConfig?.version ?? "unknown"} + + + + + Server Version + + {isServerVersionLoading + ? "Loading..." + : serverVersionError + ? "unavailable" + : (serverVersion ?? "unknown")} + + + + + ); +} -- cgit v1.2.3-70-g09d2