Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

improved not found page on mobile

daniel31x13c89684408f34
diff --git a/apps/mobile/app/+not-found.tsx b/apps/mobile/app/+not-found.tsx
index e46bc4ec..c8c58457 100644
--- a/apps/mobile/app/+not-found.tsx
+++ b/apps/mobile/app/+not-found.tsx
@@ -1,20 +1,63 @@
-import { Link, Stack } from "expo-router";
-import { View, StyleSheet } from "react-native";
+import { Button } from "@/components/ui/Button";
+import { rawTheme, ThemeName } from "@/lib/colors";
+import useAuthStore from "@/store/auth";
+import { router, usePathname } from "expo-router";
+import { useColorScheme } from "nativewind";
+import { ActivityIndicator, Text, View } from "react-native";
+import { SafeAreaView } from "react-native-safe-area-context";
export default function NotFoundScreen() {
+ const { auth } = useAuthStore();
+ const pathname = usePathname();
+ const { colorScheme } = useColorScheme();
+ const theme = rawTheme[colorScheme as ThemeName];
+
+ const isAuthenticated = auth.status === "authenticated" && !!auth.session;
+
+ if (auth.status === "loading") {
+ return (
+ <View className="bg-base-100 flex-1 items-center justify-center">
+ <ActivityIndicator size="large" color={theme["base-content"]} />
+ </View>
+ );
+ }
+
return (
- <>
- <Stack.Screen options={{ title: "Oops! This screen doesn't exist." }} />
- <View style={styles.container}>
- <Link href="/">Go to home screen</Link>
+ <SafeAreaView className="bg-base-100 flex-1">
+ <View className="flex-1 items-center justify-center gap-4 px-8">
+ <Text className="text-neutral text-3xl">404</Text>
+ <Text className="text-base-content text-2xl font-semibold text-center">
+ Page Not Found
+ </Text>
+ <Text className="text-neutral text-base text-center">
+ The page you followed isn't available in this version of the app.
+ Updating to the latest version might do the trick.
+ </Text>
+ {pathname ? (
+ <Text
+ className="text-neutral font-bold text-xs text-center opacity-60"
+ numberOfLines={1}
+ >
+ {pathname}
+ </Text>
+ ) : null}
+ <Button
+ variant="accent"
+ size="lg"
+ className="px-8 mt-4"
+ accessibilityRole="button"
+ accessibilityLabel={
+ isAuthenticated ? "Back to Dashboard" : "Back to Login"
+ }
+ onPress={() =>
+ router.replace(isAuthenticated ? "/(tabs)/dashboard" : "/")
+ }
+ >
+ <Text className="text-white text-lg">
+ {isAuthenticated ? "Back to Dashboard" : "Back to Login"}
+ </Text>
+ </Button>
</View>
- </>
+ </SafeAreaView>
);
}
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: "center",
- alignItems: "center",
- },
-});