aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/app/dashboard
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-12-20 12:29:54 +0000
committerGitHub <noreply@github.com>2025-12-20 12:29:54 +0000
commitbd969b34d76bea5ed81b6497d611efccae6984c7 (patch)
treeb9d44112cb9e4a4407c0918ab7f67aed570165dc /apps/mobile/app/dashboard
parente53f3ae528ca189f6d6b29baee0e04da147614f2 (diff)
downloadkarakeep-bd969b34d76bea5ed81b6497d611efccae6984c7.tar.zst
feat: add server version display to mobile app settings (#2276)
- Created useServerVersion hook to fetch server version from /api/version - Display both app version (from expo-constants) and server version - Added version info at the bottom of settings page - Server version shows loading state and handles errors gracefully Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'apps/mobile/app/dashboard')
-rw-r--r--apps/mobile/app/dashboard/(tabs)/settings.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/mobile/app/dashboard/(tabs)/settings.tsx b/apps/mobile/app/dashboard/(tabs)/settings.tsx
index 7c1e00d6..db19b6fe 100644
--- a/apps/mobile/app/dashboard/(tabs)/settings.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/settings.tsx
@@ -2,6 +2,7 @@ import { useEffect } from "react";
import { ActivityIndicator, Pressable, 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 { Button } from "@/components/ui/Button";
import ChevronRight from "@/components/ui/ChevronRight";
@@ -9,6 +10,7 @@ import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import { Divider } from "@/components/ui/Divider";
import PageTitle from "@/components/ui/PageTitle";
import { Text } from "@/components/ui/Text";
+import { useServerVersion } from "@/lib/hooks";
import { useSession } from "@/lib/session";
import useAppSettings from "@/lib/settings";
import { api } from "@/lib/trpc";
@@ -30,6 +32,11 @@ export default function Dashboard() {
}, [settings]);
const { data, error, isLoading } = api.users.whoami.useQuery();
+ const {
+ data: serverVersion,
+ isLoading: isServerVersionLoading,
+ error: serverVersionError,
+ } = useServerVersion();
if (error?.data?.code === "UNAUTHORIZED") {
logout();
@@ -141,6 +148,19 @@ export default function Dashboard() {
>
<Text>Log Out</Text>
</Button>
+ <View className="mt-4 w-full gap-1">
+ <Text className="text-center text-sm text-muted-foreground">
+ App Version: {Constants.expoConfig?.version ?? "unknown"}
+ </Text>
+ <Text className="text-center text-sm text-muted-foreground">
+ Server Version:{" "}
+ {isServerVersionLoading
+ ? "Loading..."
+ : serverVersionError
+ ? "unavailable"
+ : (serverVersion ?? "unknown")}
+ </Text>
+ </View>
</View>
</CustomSafeAreaView>
);