⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
feat(mobile): completed implementing dark mode
daniel31x13a36af7d673a1
diff --git a/apps/mobile/app/(tabs)/_layout.tsx b/apps/mobile/app/(tabs)/_layout.tsxindex e78b5e3a..74d557b8 100644--- a/apps/mobile/app/(tabs)/_layout.tsx+++ b/apps/mobile/app/(tabs)/_layout.tsx@@ -1,13 +1,14 @@import { Tabs } from "expo-router";import React from "react";-import { Platform, TouchableOpacity, useColorScheme } from "react-native";+import { Platform, TouchableOpacity } from "react-native";import HapticTab from "@/components/HapticTab";import { IconSymbol } from "@/components/ui/IconSymbol";// import "react-native-reanimated";import TabBarBackground from "@/components/ui/TabBarBackground";+import { useColorScheme } from "nativewind";export default function TabLayout() {- const colorScheme = useColorScheme();+ const { colorScheme } = useColorScheme();return (<Tabs@@ -19,8 +20,13 @@ export default function TabLayout() {tabBarStyle: Platform.select({ios: {position: "absolute",+ borderTopWidth: 0,+ elevation: 0,+ },+ default: {+ borderTopWidth: 0,+ elevation: 0,},- default: {},}),}}>diff --git a/apps/mobile/app/(tabs)/dashboard/[section].tsx b/apps/mobile/app/(tabs)/dashboard/[section].tsxindex 73d35584..43f63f81 100644--- a/apps/mobile/app/(tabs)/dashboard/[section].tsx+++ b/apps/mobile/app/(tabs)/dashboard/[section].tsx@@ -49,7 +49,12 @@ export default function LinksScreen() {);return (- <View style={styles.container} className="h-full">+ <View+ style={styles.container}+ className="h-full bg-base-100"+ collapsable={false}+ collapsableChildren={false}+ ><FlatListcontentInsetAdjustmentBehavior="automatic"ListHeaderComponent={() => <></>}@@ -63,9 +68,7 @@ export default function LinksScreen() {)}onEndReached={() => data.fetchNextPage()}onEndReachedThreshold={0.5}- ItemSeparatorComponent={() => (- <View className="bg-[#eee] h-[1px] w-[100px]" />- )}+ ItemSeparatorComponent={() => <View className="bg-base-200 h-px" />}/></View>);diff --git a/apps/mobile/app/(tabs)/dashboard/_layout.tsx b/apps/mobile/app/(tabs)/dashboard/_layout.tsxindex 61b29f33..5bdb311e 100644--- a/apps/mobile/app/(tabs)/dashboard/_layout.tsx+++ b/apps/mobile/app/(tabs)/dashboard/_layout.tsx@@ -1,27 +1,32 @@import { IconSymbol } from "@/components/ui/IconSymbol";+import { rawTheme, ThemeName } from "@/lib/colors";import { Stack, useRouter } from "expo-router";+import { useColorScheme } from "nativewind";import { TouchableOpacity } from "react-native";import { SheetManager } from "react-native-actions-sheet";import * as DropdownMenu from "zeego/dropdown-menu";export default function RootLayout() {const router = useRouter();+ const { colorScheme } = useColorScheme();return (<StackscreenOptions={{headerLargeTitle: true,headerTransparent: true,- headerBlurEffect: "systemUltraThinMaterial",+ headerBlurEffect:+ colorScheme === "dark" ? "systemMaterialDark" : "systemMaterial",+ headerTintColor: colorScheme === "dark" ? "white" : "black",+ headerLargeStyle: {+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-100"],+ },}}><Stack.Screenname="index"options={{headerTitle: "Dashboard",- headerLargeStyle: {- backgroundColor: "#f2f2f2",- },headerRight: () => (<DropdownMenu.Root><DropdownMenu.Trigger>@@ -61,9 +66,6 @@ export default function RootLayout() {options={{headerTitle: "Links",headerBackTitle: "Back",- headerLargeStyle: {- backgroundColor: "white",- },headerSearchBarOptions: {placeholder: "Search",autoCapitalize: "none",diff --git a/apps/mobile/app/(tabs)/dashboard/index.tsx b/apps/mobile/app/(tabs)/dashboard/index.tsxindex cd049587..07c89c5a 100644--- a/apps/mobile/app/(tabs)/dashboard/index.tsx+++ b/apps/mobile/app/(tabs)/dashboard/index.tsx@@ -64,7 +64,12 @@ export default function DashboardScreen() {}, [dashboardSections]);return (- <SafeAreaView style={styles.container}>+ <SafeAreaView+ style={styles.container}+ collapsable={false}+ collapsableChildren={false}+ className="bg-base-100"+ ><ScrollViewrefreshControl={<RefreshControl@@ -77,6 +82,7 @@ export default function DashboardScreen() {gap: 15,paddingVertical: 20,}}+ className="bg-base-100"contentInsetAdjustmentBehavior="automatic">{orderedSections.map((sectionData) => {@@ -175,7 +181,9 @@ const Section: React.FC<SectionProps> = ({<View className="flex-row gap-2 items-center"><View className={"flex-row items-center gap-2"}><IconSymbol size={30} name="clock" color={""} />- <Text className="text-2xl capitalize">Recent Links</Text>+ <Text className="text-2xl capitalize text-base-content">+ Recent Links+ </Text></View></View><TouchableOpacity@@ -206,9 +214,9 @@ const Section: React.FC<SectionProps> = ({}}/>) : (- <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 bg-white mx-5">+ <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 mx-5"><IconSymbol size={40} name="clock" color={""} />- <Text className="text-center text-xl text-gray-500">+ <Text className="text-center text-xl text-neutral">No Recent Links</Text>@@ -231,7 +239,9 @@ const Section: React.FC<SectionProps> = ({<View className="flex-row gap-2 items-center"><View className={"flex-row items-center gap-2"}><IconSymbol size={30} name="pin" color={""} />- <Text className="text-2xl capitalize">Pinned Links</Text>+ <Text className="text-2xl capitalize text-base-content">+ Pinned Links+ </Text></View></View><TouchableOpacity@@ -262,9 +272,9 @@ const Section: React.FC<SectionProps> = ({}}/>) : (- <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 bg-white mx-5">+ <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 mx-5"><IconSymbol size={40} name="pin" color={""} />- <Text className="text-center text-xl text-gray-500">+ <Text className="text-center text-xl text-neutral">No Pinned Links</Text></View>@@ -283,7 +293,10 @@ const Section: React.FC<SectionProps> = ({name="folder.fill"color={collection.color || "#0ea5e9"}/>- <Text className="text-2xl capitalize w-full" numberOfLines={1}>+ <Text+ className="text-2xl capitalize w-full text-base-content"+ numberOfLines={1}+ >{collection.name}</Text></View>diff --git a/apps/mobile/app/(tabs)/links/_layout.tsx b/apps/mobile/app/(tabs)/links/_layout.tsxindex efae05f5..19d9a17a 100644--- a/apps/mobile/app/(tabs)/links/_layout.tsx+++ b/apps/mobile/app/(tabs)/links/_layout.tsx@@ -1,7 +1,10 @@import { Stack, useRouter } from "expo-router";+import { useColorScheme } from "nativewind";+import { rawTheme, ThemeName } from "@/lib/colors";export default function RootLayout() {const router = useRouter();+ const { colorScheme } = useColorScheme();return (<Stack@@ -9,7 +12,9 @@ export default function RootLayout() {headerTitle: "Links",headerLargeTitle: true,headerTransparent: true,- headerBlurEffect: "systemUltraThinMaterial",+ headerBlurEffect:+ colorScheme === "dark" ? "systemMaterialDark" : "systemMaterial",+ headerTintColor: colorScheme === "dark" ? "white" : "black",headerSearchBarOptions: {placeholder: "Search",autoCapitalize: "none",@@ -20,7 +25,7 @@ export default function RootLayout() {},},headerLargeStyle: {- backgroundColor: "white",+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-100"],},}}/>diff --git a/apps/mobile/app/(tabs)/links/index.tsx b/apps/mobile/app/(tabs)/links/index.tsxindex fe4bcd9a..f8e9aa52 100644--- a/apps/mobile/app/(tabs)/links/index.tsx+++ b/apps/mobile/app/(tabs)/links/index.tsx@@ -5,7 +5,6 @@ import LinkListing from "@/components/LinkListing";import { useLocalSearchParams } from "expo-router";import React from "react";import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";-import { useHeaderHeight } from "@react-navigation/elements";const RenderItem = React.memo(({ item }: { item: LinkIncludingShortenedCollectionAndTags }) => {@@ -16,7 +15,6 @@ const RenderItem = React.memo(export default function LinksScreen() {const { auth } = useAuthStore();const { search } = useLocalSearchParams<{ search?: string }>();- const headerHeight = useHeaderHeight();const { links, data } = useLinks({@@ -27,7 +25,12 @@ export default function LinksScreen() {);return (- <View style={styles.container} className="h-full">+ <View+ style={styles.container}+ className="h-full bg-base-100"+ collapsable={false}+ collapsableChildren={false}+ ><FlatListcontentInsetAdjustmentBehavior="automatic"ListHeaderComponent={() => <></>}@@ -42,7 +45,7 @@ export default function LinksScreen() {onEndReached={() => data.fetchNextPage()}onEndReachedThreshold={0.5}ItemSeparatorComponent={() => (- <View className="bg-[#eee] h-[1px] w-[100px]" />+ <View className="bg-neutral-content h-px" />)}/></View>diff --git a/apps/mobile/app/(tabs)/settings/_layout.tsx b/apps/mobile/app/(tabs)/settings/_layout.tsxindex 22c24931..4f962610 100644--- a/apps/mobile/app/(tabs)/settings/_layout.tsx+++ b/apps/mobile/app/(tabs)/settings/_layout.tsx@@ -1,7 +1,9 @@-import { Stack, useRouter } from "expo-router";+import { Stack } from "expo-router";+import { useColorScheme } from "nativewind";+import { rawTheme, ThemeName } from "@/lib/colors";export default function RootLayout() {- const router = useRouter();+ const { colorScheme } = useColorScheme();return (<Stack@@ -9,9 +11,11 @@ export default function RootLayout() {headerTitle: "Settings",headerLargeTitle: true,headerTransparent: true,- headerBlurEffect: "systemUltraThinMaterial",+ headerBlurEffect:+ colorScheme === "dark" ? "systemMaterialDark" : "systemMaterial",+ headerTintColor: colorScheme === "dark" ? "white" : "black",headerLargeStyle: {- backgroundColor: "#f2f2f2",+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-100"],},}}/>diff --git a/apps/mobile/app/(tabs)/settings/index.tsx b/apps/mobile/app/(tabs)/settings/index.tsxindex 16e4346b..29275e3e 100644--- a/apps/mobile/app/(tabs)/settings/index.tsx+++ b/apps/mobile/app/(tabs)/settings/index.tsx@@ -12,27 +12,36 @@ import {Alert,} from "react-native";import { nativeApplicationVersion } from "expo-application";+import { useColorScheme } from "nativewind";export default function SettingsScreen() {const { signOut, auth } = useAuthStore();const { data: user } = useUser(auth);+ const { colorScheme, setColorScheme } = useColorScheme();return (- <View style={styles.container}>+ <View+ style={styles.container}+ collapsable={false}+ collapsableChildren={false}+ className="bg-base-100"+ ><ScrollViewcontentContainerStyle={{padding: 20,}}contentInsetAdjustmentBehavior="automatic">- <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">+ <View className="bg-base-200 rounded-xl px-4 py-3">+ <Text className="font-semibold text-xl text-base-content">+ Your account+ </Text>+ <Text className="text-neutral mt-2 mb-3">{user?.email || "@" + user?.username}</Text>- <View className="h-px bg-gray-300 -mr-4" />+ <View className="h-px bg-neutral-content -mr-4" /><TouchableOpacity- className="flex-row items-center mt-3 bg-white"+ className="flex-row items-center mt-3"onPress={() =>Alert.alert("Sign Out", "Are you sure you want to sign out?", [{@@ -59,20 +68,43 @@ export default function SettingsScreen() {</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" />+ <Text className="mb-4 mx-4 mt-6 text-neutral">Theme</Text>+ <View className="bg-base-200 rounded-xl flex-col">+ <TouchableOpacity className="flex-row gap-2 items-center justify-between py-3 px-4">+ <View className="flex-row items-center gap-2">+ <IconSymbol name="iphone" size={20} color="gray" />+ <Text className="text-neutral">System Defaults</Text>+ </View>+ </TouchableOpacity>+ <View className="h-px bg-neutral-content ml-12" />+ <TouchableOpacity+ className="flex-row gap-2 items-center justify-between py-3 px-4"+ onPress={() => setColorScheme("light")}+ >+ <View className="flex-row items-center gap-2">+ <IconSymbol name="sun.max.fill" size={20} color="orange" />+ <Text className="text-orange-500">Light</Text>+ </View>+ {colorScheme === "light" ? (+ <IconSymbol name="checkmark" size={20} color="#3478f6" />+ ) : null}</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" />+ <View className="h-px bg-neutral-content ml-12" />+ <TouchableOpacity+ className="flex-row gap-2 items-center justify-between py-3 px-4"+ onPress={() => setColorScheme("dark")}+ >+ <View className="flex-row items-center gap-2">+ <IconSymbol name="moon.fill" size={20} color="royalblue" />+ <Text className="text-blue-600">Dark</Text>+ </View>+ {colorScheme === "dark" ? (+ <IconSymbol name="checkmark" size={20} color="#3478f6" />+ ) : null}</TouchableOpacity></View></View>- <Text className="mt-4 mx-auto text-sm text-gray-500">+ <Text className="mt-4 mx-auto text-sm text-neutral">Linkwarden for {Platform.OS === "ios" ? "iOS" : "Android"}{" "}{nativeApplicationVersion}</Text>diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 1fc2691e..431090dd 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -2,13 +2,14 @@ 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 { useEffect, useState } from "react";+import { 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";+import { rawTheme, ThemeName } from "@/lib/colors";const queryClient = new QueryClient({defaultOptions: {@@ -23,8 +24,7 @@ const queryClient = new QueryClient({export default function RootLayout() {const [isLoading, setIsLoading] = useState(true);- const { colorScheme, setColorScheme } = useColorScheme();- const themeStyle = colorScheme === "dark" ? darkTheme : lightTheme;+ const { colorScheme } = useColorScheme();return (<PersistQueryClientProvider@@ -35,27 +35,39 @@ export default function RootLayout() {}}onSuccess={() => setIsLoading(false)}>- <SheetProvider>- {!isLoading && (- <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>+ <View+ style={[{ flex: 1 }, colorScheme === "dark" ? darkTheme : lightTheme]}+ >+ <SheetProvider>+ {!isLoading && (+ <Stack+ screenOptions={{+ headerShown: false,+ headerStyle: {+ backgroundColor:+ rawTheme[colorScheme as ThemeName]["base-200"],+ },+ contentStyle: {+ backgroundColor:+ rawTheme[colorScheme as ThemeName]["base-100"],+ },+ }}+ >+ {/* <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>+ )}+ </SheetProvider>+ </View></PersistQueryClientProvider>);}diff --git a/apps/mobile/app/links/[id].tsx b/apps/mobile/app/links/[id].tsxindex a3bc6d0d..21c9eaeb 100644--- a/apps/mobile/app/links/[id].tsx+++ b/apps/mobile/app/links/[id].tsx@@ -19,6 +19,8 @@ import ElementNotSupported from "@/components/ElementNotSupported";import { decode } from "html-entities";import { IconSymbol } from "@/components/ui/IconSymbol";import { useLinks } from "@linkwarden/router/links";+import { useColorScheme } from "nativewind";+import { rawTheme, ThemeName } from "@/lib/colors";const CACHE_DIR = FileSystem.documentDirectory + "archivedData/readable/";const htmlPath = (id: string) => `${CACHE_DIR}link_${id}.html`;@@ -39,6 +41,8 @@ export default function LinkScreen() {const [isLoading, setIsLoading] = useState(true);const { width } = useWindowDimensions();const router = useRouter();+ const { colorScheme } = useColorScheme();+const { links } = useLinks({sort: 0,@@ -105,11 +109,11 @@ export default function LinkScreen() {<>{format === "3" && htmlContent ? (<ScrollView- className="flex-1 bg-white"+ className="flex-1 bg-base-100"contentContainerClassName="p-4"nestedScrollEnabled>- <Text className="text-2xl font-bold mb-2.5">+ <Text className="text-2xl font-bold mb-2.5 text-base-content">{decode(link?.name || link?.description || link?.url || "")}</Text>@@ -117,15 +121,23 @@ export default function LinkScreen() {className="flex-row items-center gap-1 mb-2.5 pr-5"onPress={() => router.replace(`/links/${id}`)}>- <IconSymbol name="link" size={16} color="gray" />- <Text className="text-base text-gray-500 flex-1" numberOfLines={1}>+ <IconSymbol+ name="link"+ size={16}+ color={rawTheme[colorScheme as ThemeName]["neutral"]}+ />+ <Text className="text-base text-neutral flex-1" numberOfLines={1}>{link?.url}</Text></TouchableOpacity><View className="flex-row items-center gap-1 mb-2.5">- <IconSymbol name="calendar" size={16} color="gray" />- <Text className="text-base text-gray-500">+ <IconSymbol+ name="calendar"+ size={16}+ color={rawTheme[colorScheme as ThemeName]["neutral"]}+ />+ <Text className="text-base text-neutral">{new Date((link?.importDate || link?.createdAt) as string).toLocaleString("en-US", {@@ -136,7 +148,7 @@ export default function LinkScreen() {</Text></View>- <View className="border-t border-gray-200 mt-2.5 mb-5" />+ <View className="border-t border-neutral-content mt-2.5 mb-5" /><RenderHtmlcontentWidth={width}@@ -151,10 +163,13 @@ export default function LinkScreen() {tagsStyles={{p: { fontSize: 16, lineHeight: 24, marginVertical: 10 },}}+ baseStyle={{+ color: rawTheme[colorScheme as ThemeName]["base-content"],+ }}/></ScrollView>) : (- <View className="flex-1 bg-white">+ <View className="flex-1 bg-base-100">{url && (<WebViewclassName={isLoading ? "opacity-0" : "flex-1"}@@ -169,9 +184,9 @@ export default function LinkScreen() {)}{isLoading && (- <View className="absolute inset-0 flex-1 justify-center items-center bg-white p-5">+ <View className="absolute inset-0 flex-1 justify-center items-center bg-base-100 p-5"><ActivityIndicator size="large" color="gray" />- <Text className="text-base mt-2.5 text-gray-500">Loading...</Text>+ <Text className="text-base mt-2.5 text-neutral">Loading...</Text></View>)}</>diff --git a/apps/mobile/app/login.tsx b/apps/mobile/app/login.tsxindex 4c1c171f..5a33cbe6 100644--- a/apps/mobile/app/login.tsx+++ b/apps/mobile/app/login.tsx@@ -14,7 +14,7 @@ export default function HomeScreen() {return (<View style={styles.container}>- <Text>Login</Text>+ <Text className="text-base-content">Login</Text><Viewstyle={{flexDirection: "column",@@ -58,6 +58,5 @@ const styles = StyleSheet.create({flex: 1,justifyContent: "center",alignItems: "center",- backgroundColor: "#ffffff",},});diff --git a/apps/mobile/components/ActionSheets/Sheets.tsx b/apps/mobile/components/ActionSheets/Sheets.tsxindex 56af9d6c..2e5b30eb 100644--- a/apps/mobile/components/ActionSheets/Sheets.tsx+++ b/apps/mobile/components/ActionSheets/Sheets.tsx@@ -5,10 +5,7 @@ import {} from "react-native-actions-sheet";import AddLinkSheet from "./AddLinkSheet";import EditLinkSheet from "./EditLinkSheet";-import {- CollectionIncludingMembersAndLinkCount,- LinkIncludingShortenedCollectionAndTags,-} from "@linkwarden/types";+import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";registerSheet("add-link-sheet", AddLinkSheet);registerSheet("edit-link-sheet", EditLinkSheet);diff --git a/apps/mobile/components/DashboardItem.tsx b/apps/mobile/components/DashboardItem.tsxindex 00297048..cf005c1c 100644--- a/apps/mobile/components/DashboardItem.tsx+++ b/apps/mobile/components/DashboardItem.tsx@@ -14,19 +14,19 @@ export default function DashboardItem({color: string;}) {return (- <View className="flex-1 flex-col gap-2 rounded-xl bg-white p-3">+ <View className="flex-1 flex-col gap-2 rounded-xl bg-base-200 p-3"><View className="flex-row justify-between"><View className="flex-col gap-2 items-start"><IconSymbol name={icon} size={40} color={color} /></View><Text- className="text-4xl text-primary mt-0.5 text-right max-w-[75%]"+ className="text-4xl text-base-content mt-0.5 text-right max-w-[75%]"numberOfLines={1}>{value || 0}</Text></View>- <Text className="font-semibold text-gray-500">{name}</Text>+ <Text className="font-semibold text-neutral">{name}</Text></View>);}diff --git a/apps/mobile/components/ElementNotSupported.tsx b/apps/mobile/components/ElementNotSupported.tsxindex c30720c4..e0b507cb 100644--- a/apps/mobile/components/ElementNotSupported.tsx+++ b/apps/mobile/components/ElementNotSupported.tsx@@ -10,8 +10,8 @@ export default function ElementNotSupported({onPress: () => void;}) {return (- <View className="border-y border-gray-200 my-2 py-5 flex justify-center items-center">- <Text>{message}</Text>+ <View className="border-y border-neutral-content my-2 py-5 flex justify-center items-center">+ <Text className="text-neutral">{message}</Text><Button onPress={onPress} title={buttonTitle} /></View>);diff --git a/apps/mobile/components/LinkListing.tsx b/apps/mobile/components/LinkListing.tsxindex 9c5aa1ed..e8c34ae0 100644--- a/apps/mobile/components/LinkListing.tsx+++ b/apps/mobile/components/LinkListing.tsx@@ -15,6 +15,8 @@ import { SheetManager } from "react-native-actions-sheet";import * as Clipboard from "expo-clipboard";import { cn } from "@linkwarden/lib/utils";import { useUser } from "@linkwarden/router/user";+import { rawTheme, ThemeName } from "@/lib/colors";+import { useColorScheme } from "nativewind";type Props = {link: LinkIncludingShortenedCollectionAndTags;@@ -26,6 +28,7 @@ const LinkListing = ({ link, dashboard }: Props) => {const router = useRouter();const updateLink = useUpdateLink(auth);const { data: user } = useUser(auth);+ const { colorScheme } = useColorScheme();const deleteLink = useDeleteLink(auth);@@ -44,10 +47,9 @@ const LinkListing = ({ link, dashboard }: Props) => {<ContextMenu.Trigger asChild><PressableclassName={cn(- "p-5 flex-row justify-between bg-white",- Platform.OS === "android"- ? "active:bg-white"- : "active:bg-gray-200",+ "p-5 flex-row justify-between",+ dashboard ? "bg-base-200" : "bg-base-100",+ Platform.OS !== "android" && "active:bg-base-200/50",dashboard && "rounded-xl")}onPress={() => router.push(`/links/${link.id}`)}@@ -60,12 +62,18 @@ const LinkListing = ({ link, dashboard }: Props) => {)}><View className="w-[65%] flex-col justify-between">- <Text numberOfLines={2} className="font-medium text-lg">+ <Text+ numberOfLines={2}+ className="font-medium text-lg text-base-content"+ >{decode(link.name || link.description || link.url)}</Text>{shortendURL && (- <Text numberOfLines={1} className="mt-1.5 font-light text-sm">+ <Text+ numberOfLines={1}+ className="mt-1.5 font-light text-sm text-base-content"+ >{shortendURL}</Text>)}@@ -76,7 +84,10 @@ const LinkListing = ({ link, dashboard }: Props) => {size={16}color={link.collection.color || ""}/>- <Text numberOfLines={1} className="font-light text-xs">+ <Text+ numberOfLines={1}+ className="font-light text-xs text-base-content"+ >{link.collection.name}</Text></View>@@ -99,8 +110,15 @@ const LinkListing = ({ link, dashboard }: Props) => {)}</View><View className="flex flex-row gap-1 items-center mt-5 self-start">- <IconSymbol name="calendar" size={16} color="gray" />- <Text numberOfLines={1} className="font-light text-xs">+ <IconSymbol+ name="calendar"+ size={16}+ color={rawTheme[colorScheme as ThemeName]["neutral"]}+ />+ <Text+ numberOfLines={1}+ className="font-light text-xs text-base-content"+ >{new Date(link.createdAt as string).toLocaleString("en-US", {year: "numeric",month: "short",diff --git a/apps/mobile/components/ui/Button.tsx b/apps/mobile/components/ui/Button.tsxindex f2d3a2c0..ddb4677f 100644--- a/apps/mobile/components/ui/Button.tsx+++ b/apps/mobile/components/ui/Button.tsx@@ -15,7 +15,7 @@ const buttonVariants = cva(variants: {variant: {default: "bg-slate-500 text-white",- primary: "bg-primary text-primary-foreground",+ primary: "bg-primary text-base-content",accent: "bg-accent border border-violet-400 text-white",destructive: "bg-destructive text-white",outline: "border",diff --git a/apps/mobile/components/ui/Input.tsx b/apps/mobile/components/ui/Input.tsxindex e020fa74..ba75c55a 100644--- a/apps/mobile/components/ui/Input.tsx+++ b/apps/mobile/components/ui/Input.tsx@@ -7,7 +7,10 @@ const Input = forwardRef<TextInput, TextInputProps>(return (<TextInputref={ref}- className={cn("bg-gray-100 rounded-lg px-4 py-2", className)}+ className={cn(+ "bg-neutral-content text-base-content rounded-lg px-4 py-2",+ className+ )}{...props}/>);diff --git a/apps/mobile/lib/colors.ts b/apps/mobile/lib/colors.tsnew file mode 100644index 00000000..fd3ad13a--- /dev/null+++ b/apps/mobile/lib/colors.ts@@ -0,0 +1,33 @@+// lib/theme/colors.ts+export type ThemeName = "light" | "dark";++export const rawTheme = {+ light: {+ primary: "#0369A1",+ secondary: "#0891B2",+ accent: "#6D28D9",+ neutral: "#6B7280",+ "neutral-content": "#D1D5DB",+ "base-100": "#FFFFFF",+ "base-200": "#F3F4F6",+ "base-content": "#0A0A0A",+ info: "#A5F3FC",+ success: "#22C55E",+ warning: "#FACC15",+ error: "#DC2626",+ },+ dark: {+ primary: "#7DD3FC",+ secondary: "#22D3EE",+ accent: "#6D28D9",+ neutral: "#9CA3AF",+ "neutral-content": "#404040",+ "base-100": "#171717",+ "base-200": "#262626",+ "base-content": "#FAFAFA",+ info: "#009EE4",+ success: "#00B17D",+ warning: "#EAC700",+ error: "#F1293C",+ },+};diff --git a/apps/mobile/lib/theme.ts b/apps/mobile/lib/theme.tsindex c4c7fe66..ce48219a 100644--- a/apps/mobile/lib/theme.ts+++ b/apps/mobile/lib/theme.ts@@ -1,32 +1,23 @@-// theme.tsimport { vars } from "nativewind";+import { rawTheme, ThemeName } from "./colors";-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",-});+const hexToRgb = (hex: string) => {+ const [r, g, b] = hex+ .replace(/^#/, "")+ .match(/.{2}/g)!+ .map((h) => parseInt(h, 16));+ return `${r} ${g} ${b}`;+};-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",-});+const makeVars = (scheme: ThemeName) =>+ vars(+ Object.fromEntries(+ Object.entries(rawTheme[scheme]).map(([key, hex]) => [+ `--color-${key}`,+ hexToRgb(hex),+ ])+ ) as Record<string, string>+ );++export const lightTheme = makeVars("light");+export const darkTheme = makeVars("dark");diff --git a/apps/mobile/tailwind.config.js b/apps/mobile/tailwind.config.jsindex 3c7072d1..52136092 100644--- a/apps/mobile/tailwind.config.js+++ b/apps/mobile/tailwind.config.js@@ -1,24 +1,38 @@/** @type {import('tailwindcss').Config} */++const { rawTheme } = require("./lib/colors");++const hexToRgb = (hex) => {+ const [r, g, b] = hex+ .replace(/^#/, "")+ .match(/.{2}/g)+ .map((h) => parseInt(h, 16));+ return `${r} ${g} ${b}`;+};+module.exports = {content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],presets: [require("nativewind/preset")],theme: {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>)",- },+ colors: Object.fromEntries(+ Object.keys(rawTheme.light).map((key) => [+ key,+ `rgb(var(--color-${key}) / <alpha-value>)`,+ ])+ ),},},+ plugins: [+ ({ addBase }) => {+ addBase({+ ":root": Object.fromEntries(+ Object.entries(rawTheme.light).map(([key, hex]) => [+ `--color-${key}`,+ hexToRgb(hex),+ ])+ ),+ });+ },+ ],};