Skip to content

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

feat(mobile): initial commit for theme settings

daniel31x13f4c8030a1b93
diff --git a/apps/mobile/app/(tabs)/settings/_layout.tsx b/apps/mobile/app/(tabs)/settings/_layout.tsx
index 6c08d60a..22c24931 100644
--- a/apps/mobile/app/(tabs)/settings/_layout.tsx
+++ b/apps/mobile/app/(tabs)/settings/_layout.tsx
@@ -11,7 +11,7 @@ export default function RootLayout() {
headerTransparent: true,
headerBlurEffect: "systemUltraThinMaterial",
headerLargeStyle: {
- backgroundColor: "white",
+ backgroundColor: "#f2f2f2",
},
}}
/>
diff --git a/apps/mobile/app/(tabs)/settings/index.tsx b/apps/mobile/app/(tabs)/settings/index.tsx
index fc006b2e..16e4346b 100644
--- a/apps/mobile/app/(tabs)/settings/index.tsx
+++ b/apps/mobile/app/(tabs)/settings/index.tsx
@@ -1,22 +1,81 @@
+import { IconSymbol } from "@/components/ui/IconSymbol";
import useAuthStore from "@/store/auth";
-import { View, Text, StyleSheet, Button, ScrollView } from "react-native";
+import { useUser } from "@linkwarden/router/user";
+import {
+ View,
+ Text,
+ StyleSheet,
+ Button,
+ ScrollView,
+ TouchableOpacity,
+ Platform,
+ Alert,
+} from "react-native";
+import { nativeApplicationVersion } from "expo-application";
export default function SettingsScreen() {
- const { signOut } = useAuthStore();
+ const { signOut, auth } = useAuthStore();
+ const { data: user } = useUser(auth);
return (
<View style={styles.container}>
<ScrollView
contentContainerStyle={{
- flexDirection: "column",
- gap: 15,
- paddingVertical: 20,
- alignItems: "center",
+ padding: 20,
}}
contentInsetAdjustmentBehavior="automatic"
>
- <Text>Settings</Text>
- <Button title="Sign out" onPress={() => signOut()} />
+ <View className="bg-white rounded-xl px-4 py-3">
+ <Text className="font-semibold text-xl">Your account</Text>
+ <Text className="text-gray-500 mt-2 mb-3">
+ {user?.email || "@" + user?.username}
+ </Text>
+ <View className="h-px bg-gray-300 -mr-4" />
+ <TouchableOpacity
+ className="flex-row items-center mt-3 bg-white"
+ onPress={() =>
+ Alert.alert("Sign Out", "Are you sure you want to sign out?", [
+ {
+ text: "Cancel",
+ style: "cancel",
+ },
+ {
+ text: "Sign Out",
+ style: "destructive",
+ onPress: () => {
+ signOut();
+ },
+ },
+ ])
+ }
+ >
+ <Text className="flex-1 text-base text-red-500">Sign Out</Text>
+ <IconSymbol
+ name="rectangle.portrait.and.arrow.right"
+ size={18}
+ color="red"
+ />
+ </TouchableOpacity>
+ </View>
+
+ <View>
+ <Text className="mb-4 mx-4 mt-6 text-gray-500">Settings</Text>
+ <View className="bg-white rounded-xl flex-col">
+ <TouchableOpacity className="flex-row items-center py-3 px-4">
+ <Text className="flex-1 text-base">Settings</Text>
+ <IconSymbol name="chevron.right" size={18} color="gray" />
+ </TouchableOpacity>
+ <View className="h-px bg-gray-300 ml-4" />
+ <TouchableOpacity className="flex-row items-center py-3 px-4">
+ <Text className="flex-1 text-base">Settings</Text>
+ <IconSymbol name="chevron.right" size={18} color="gray" />
+ </TouchableOpacity>
+ </View>
+ </View>
+ <Text className="mt-4 mx-auto text-sm text-gray-500">
+ Linkwarden for {Platform.OS === "ios" ? "iOS" : "Android"}{" "}
+ {nativeApplicationVersion}
+ </Text>
</ScrollView>
</View>
);
@@ -25,7 +84,5 @@ export default function SettingsScreen() {
const styles = StyleSheet.create({
container: {
flex: 1,
- justifyContent: "center",
- alignItems: "center",
},
});
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index 5d0d509b..1fc2691e 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -2,10 +2,13 @@ import { Stack } from "expo-router";
import { QueryClient } from "@tanstack/react-query";
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
import { mmkvPersister } from "@/lib/queryPersister";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import "../styles/global.css";
import { SheetProvider } from "react-native-actions-sheet";
import "@/components/ActionSheets/Sheets";
+import { useColorScheme } from "nativewind";
+import { lightTheme, darkTheme } from "../lib/theme";
+import { View } from "react-native";
const queryClient = new QueryClient({
defaultOptions: {
@@ -20,6 +23,8 @@ const queryClient = new QueryClient({
export default function RootLayout() {
const [isLoading, setIsLoading] = useState(true);
+ const { colorScheme, setColorScheme } = useColorScheme();
+ const themeStyle = colorScheme === "dark" ? darkTheme : lightTheme;
return (
<PersistQueryClientProvider
@@ -32,23 +37,23 @@ export default function RootLayout() {
>
<SheetProvider>
{!isLoading && (
- <Stack
- screenOptions={{
- headerShown: false,
- }}
- >
- {/* <Stack.Screen name="(tabs)" /> */}
- <Stack.Screen
- name="links/[id]"
- options={{
- headerBackTitle: "Back",
- headerShown: true,
- headerTitle: "",
- }}
- />
- <Stack.Screen name="login" />
- <Stack.Screen name="+not-found" />
- </Stack>
+ <View style={[{ flex: 1 }, themeStyle]}>
+ {!isLoading && (
+ <Stack screenOptions={{ headerShown: false }}>
+ {/* <Stack.Screen name="(tabs)" /> */}
+ <Stack.Screen
+ name="links/[id]"
+ options={{
+ headerShown: true,
+ headerBackTitle: "Back",
+ headerTitle: "",
+ }}
+ />
+ <Stack.Screen name="login" />
+ <Stack.Screen name="+not-found" />
+ </Stack>
+ )}
+ </View>
)}
</SheetProvider>
</PersistQueryClientProvider>
diff --git a/apps/mobile/components/ui/Button.tsx b/apps/mobile/components/ui/Button.tsx
index d9fde168..f2d3a2c0 100644
--- a/apps/mobile/components/ui/Button.tsx
+++ b/apps/mobile/components/ui/Button.tsx
@@ -16,7 +16,7 @@ const buttonVariants = cva(
variant: {
default: "bg-slate-500 text-white",
primary: "bg-primary text-primary-foreground",
- accent: "bg-violet-600 border border-violet-400 text-white",
+ accent: "bg-accent border border-violet-400 text-white",
destructive: "bg-destructive text-white",
outline: "border",
secondary: "bg-secondary text-secondary-foreground",
diff --git a/apps/mobile/ios/Podfile.lock b/apps/mobile/ios/Podfile.lock
index c519fdce..e3d9c50b 100644
--- a/apps/mobile/ios/Podfile.lock
+++ b/apps/mobile/ios/Podfile.lock
@@ -6,6 +6,8 @@ PODS:
- DGSwiftUtilities (~> 0.29)
- DGSwiftUtilities (0.46.4)
- DoubleConversion (1.1.6)
+ - EXApplication (6.0.2):
+ - ExpoModulesCore
- EXConstants (17.0.8):
- ExpoModulesCore
- EXJSONUtils (0.14.0)
@@ -2169,6 +2171,7 @@ PODS:
DEPENDENCIES:
- boost (from `../../../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
+ - EXApplication (from `../../../node_modules/expo-application/ios`)
- EXConstants (from `../../../node_modules/expo-constants/ios`)
- EXJSONUtils (from `../../../node_modules/expo-json-utils/ios`)
- EXManifests (from `../../../node_modules/expo-manifests/ios`)
@@ -2280,6 +2283,8 @@ EXTERNAL SOURCES:
:podspec: "../../../node_modules/react-native/third-party-podspecs/boost.podspec"
DoubleConversion:
:podspec: "../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
+ EXApplication:
+ :path: "../../../node_modules/expo-application/ios"
EXConstants:
:path: "../../../node_modules/expo-constants/ios"
EXJSONUtils:
@@ -2480,6 +2485,7 @@ SPEC CHECKSUMS:
ContextMenuAuxiliaryPreview: 20be0be795b783b68f8792732eed4bed9f202c1c
DGSwiftUtilities: 536456ae3d0e5083ac42e06b6b720921601864b5
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
+ EXApplication: 27a524f5c3e671c6218220fba04752629466a1a9
EXConstants: a1f35b9aabbb3c6791f8e67722579b1ffcdd3f18
EXJSONUtils: 01fc7492b66c234e395dcffdd5f53439c5c29c93
EXManifests: 77e77c283c4c53a50b9bddebed25abe93f0b48f1
diff --git a/apps/mobile/ios/mobileapp.xcodeproj/project.pbxproj b/apps/mobile/ios/mobileapp.xcodeproj/project.pbxproj
index d27e21ac..344eb705 100644
--- a/apps/mobile/ios/mobileapp.xcodeproj/project.pbxproj
+++ b/apps/mobile/ios/mobileapp.xcodeproj/project.pbxproj
@@ -291,6 +291,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-mobileapp/Pods-mobileapp-resources.sh",
+ "${PODS_CONFIGURATION_BUILD_DIR}/EXApplication/ExpoApplication_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle",
@@ -305,6 +306,7 @@
);
name = "[CP] Copy Pods Resources";
outputPaths = (
+ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoApplication_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle",
diff --git a/apps/mobile/ios/mobileapp/PrivacyInfo.xcprivacy b/apps/mobile/ios/mobileapp/PrivacyInfo.xcprivacy
index 5bb83c5d..49b8ded2 100644
--- a/apps/mobile/ios/mobileapp/PrivacyInfo.xcprivacy
+++ b/apps/mobile/ios/mobileapp/PrivacyInfo.xcprivacy
@@ -6,20 +6,20 @@
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
- <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
+ <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
- <string>CA92.1</string>
+ <string>C617.1</string>
+ <string>0A2A.1</string>
+ <string>3B52.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
- <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
- <string>0A2A.1</string>
- <string>3B52.1</string>
- <string>C617.1</string>
+ <string>CA92.1</string>
</array>
</dict>
<dict>
diff --git a/apps/mobile/lib/theme.ts b/apps/mobile/lib/theme.ts
new file mode 100644
index 00000000..c4c7fe66
--- /dev/null
+++ b/apps/mobile/lib/theme.ts
@@ -0,0 +1,32 @@
+// theme.ts
+import { vars } from "nativewind";
+
+export const lightTheme = vars({
+ "--color-primary": "3 105 161",
+ "--color-secondary": "8 145 178",
+ "--color-accent": "109 40 217",
+ "--color-neutral": "107 114 128",
+ "--color-neutral-content": "209 213 219",
+ "--color-base-100": "255 255 255",
+ "--color-base-200": "243 244 246",
+ "--color-base-content": "10 10 10",
+ "--color-info": "165 243 252",
+ "--color-success": "34 197 94",
+ "--color-warning": "250 204 21",
+ "--color-error": "220 38 38",
+});
+
+export const darkTheme = vars({
+ "--color-primary": "125 211 252",
+ "--color-secondary": "34 211 238",
+ "--color-accent": "109 40 217",
+ "--color-neutral": "156 163 175",
+ "--color-neutral-content": "64 64 64",
+ "--color-base-100": "23 23 23",
+ "--color-base-200": "38 38 38",
+ "--color-base-content": "250 250 250",
+ "--color-info": "0 158 228",
+ "--color-success": "0 177 125",
+ "--color-warning": "234 199 0",
+ "--color-error": "241 41 60",
+});
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 55cb68cf..b66e876f 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -28,6 +28,7 @@
"@tanstack/react-query-persist-client": "^5.51.15",
"class-variance-authority": "^0.7.1",
"expo": "~52.0.18",
+ "expo-application": "~6.0.2",
"expo-blur": "~14.0.1",
"expo-clipboard": "~7.0.1",
"expo-constants": "~17.0.3",
diff --git a/apps/mobile/tailwind.config.js b/apps/mobile/tailwind.config.js
index 62882191..3c7072d1 100644
--- a/apps/mobile/tailwind.config.js
+++ b/apps/mobile/tailwind.config.js
@@ -3,7 +3,22 @@ module.exports = {
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
presets: [require("nativewind/preset")],
theme: {
- extend: {},
+ extend: {
+ colors: {
+ // map each color key to a CSS var that Tailwind will resolve
+ primary: "rgb(var(--color-primary) / <alpha-value>)",
+ secondary: "rgb(var(--color-secondary) / <alpha-value>)",
+ accent: "rgb(var(--color-accent) / <alpha-value>)",
+ neutral: "rgb(var(--color-neutral) / <alpha-value>)",
+ "neutral-content": "rgb(var(--color-neutral-content) / <alpha-value>)",
+ "base-100": "rgb(var(--color-base-100) / <alpha-value>)",
+ "base-200": "rgb(var(--color-base-200) / <alpha-value>)",
+ "base-content": "rgb(var(--color-base-content)/ <alpha-value>)",
+ info: "rgb(var(--color-info) / <alpha-value>)",
+ success: "rgb(var(--color-success) / <alpha-value>)",
+ warning: "rgb(var(--color-warning) / <alpha-value>)",
+ error: "rgb(var(--color-error) / <alpha-value>)",
+ },
+ },
},
- plugins: [],
};
diff --git a/yarn.lock b/yarn.lock
index 59271655..d12f5607 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7111,6 +7111,11 @@ expect@^29.0.0, expect@^29.7.0:
jest-message-util "^29.7.0"
jest-util "^29.7.0"
+expo-application@~6.0.2:
+ version "6.0.2"
+ resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-6.0.2.tgz#4384299f0518958e2fb18b8b029af5583c642479"
+ integrity sha512-qcj6kGq3mc7x5yIb5KxESurFTJCoEKwNEL34RdPEvTB/xhl7SeVZlu05sZBqxB1V4Ryzq/LsCb7NHNfBbb3L7A==
+
expo-asset@~11.0.5:
version "11.0.5"
resolved "https://registry.yarnpkg.com/expo-asset/-/expo-asset-11.0.5.tgz#9d0ad28da3af220d25c001cd6e4a80cc669ee18b"