⚡️⚡️⚡️ 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): improved theme colors
daniel31x132c01013eb3df
diff --git a/apps/mobile/app/(tabs)/dashboard/_layout.tsx b/apps/mobile/app/(tabs)/dashboard/_layout.tsxindex 5bdb311e..1016739e 100644--- a/apps/mobile/app/(tabs)/dashboard/_layout.tsx+++ b/apps/mobile/app/(tabs)/dashboard/_layout.tsx@@ -31,7 +31,11 @@ export default function RootLayout() {<DropdownMenu.Root><DropdownMenu.Trigger><TouchableOpacity>- <IconSymbol size={20} name="plus" color={"#3478f6"} />+ <IconSymbol+ size={20}+ name="plus"+ color={rawTheme[colorScheme as ThemeName].primary}+ /></TouchableOpacity></DropdownMenu.Trigger>diff --git a/apps/mobile/app/(tabs)/dashboard/index.tsx b/apps/mobile/app/(tabs)/dashboard/index.tsxindex 07c89c5a..5a482579 100644--- a/apps/mobile/app/(tabs)/dashboard/index.tsx+++ b/apps/mobile/app/(tabs)/dashboard/index.tsx@@ -22,6 +22,8 @@ import DashboardItem from "@/components/DashboardItem";import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";import LinkListing from "@/components/LinkListing";import { useRouter } from "expo-router";+import { rawTheme, ThemeName } from "@/lib/colors";+import { colorScheme, useColorScheme } from "nativewind";export default function DashboardScreen() {const { auth } = useAuthStore();@@ -35,6 +37,8 @@ export default function DashboardScreen() {const { data: collections = [] } = useCollections(auth);const { data: tags = [] } = useTags(auth);+ const { colorScheme } = useColorScheme();+const [dashboardSections, setDashboardSections] = useState<DashboardSection[]>(user?.dashboardSections || []);@@ -63,6 +67,278 @@ export default function DashboardScreen() {});}, [dashboardSections]);+ interface SectionProps {+ sectionData: { type: DashboardSectionType };+ collection?: any;+ links?: any[];+ tagsLength: number;+ numberOfLinks: number;+ collectionsLength: number;+ numberOfPinnedLinks: number;+ dashboardData: { isLoading: boolean };+ collectionLinks?: any[];+ }++ const Section: React.FC<SectionProps> = ({+ sectionData,+ collection,+ links = [],+ tagsLength,+ numberOfLinks,+ collectionsLength,+ numberOfPinnedLinks,+ dashboardData,+ collectionLinks = [],+ }) => {+ const router = useRouter();++ switch (sectionData.type) {+ case DashboardSectionType.STATS:+ return (+ <View className="flex-col gap-4 max-w-full px-5">+ <View className="flex-row gap-4">+ <DashboardItem+ name={numberOfLinks === 1 ? "Link" : "Links"}+ value={numberOfLinks}+ icon="link.circle.fill"+ color="#9c00cc"+ />+ <DashboardItem+ name={collectionsLength === 1 ? "Collection" : "Collections"}+ value={collectionsLength}+ icon="folder.circle.fill"+ color="#0096cc"+ />+ </View>+ <View className="flex-row gap-4">+ <DashboardItem+ name={tagsLength === 1 ? "Tag" : "Tags"}+ value={tagsLength}+ icon="tag.circle.fill"+ color="#00cc99"+ />+ <DashboardItem+ name={"Pinned Links"}+ value={numberOfPinnedLinks}+ icon="pin.circle.fill"+ color="#cc6d00"+ />+ </View>+ </View>+ );++ case DashboardSectionType.RECENT_LINKS:+ return (+ <>+ <View className="flex-row justify-between items-center px-5">+ <View className="flex-row gap-2 items-center">+ <View className={"flex-row items-center gap-2"}>+ <IconSymbol+ size={30}+ name="clock"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ <Text className="text-2xl capitalize text-base-content">+ Recent Links+ </Text>+ </View>+ </View>+ <TouchableOpacity+ className="flex-row items-center text-sm gap-1"+ onPress={() =>+ router.navigate("/(tabs)/dashboard/recent-links")+ }+ >+ <Text className="text-primary">View All</Text>+ <IconSymbol+ size={15}+ name="chevron.right"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ </TouchableOpacity>+ </View>++ {dashboardData.isLoading ||+ (links.length > 0 && !dashboardData.isLoading) ? (+ <FlatList+ horizontal+ showsHorizontalScrollIndicator={false}+ directionalLockEnabled+ data={links || []}+ refreshing={dashboardData.isLoading}+ initialNumToRender={2}+ keyExtractor={(item) => item.id?.toString() || ""}+ renderItem={({ item }) => (+ <RenderItem item={item} key={item.id?.toString()} />+ )}+ ItemSeparatorComponent={() => <View style={{ width: 10 }} />}+ contentContainerStyle={{+ paddingHorizontal: 20,+ }}+ />+ ) : (+ <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={rawTheme[colorScheme as ThemeName].primary}+ />+ <Text className="text-center text-xl text-neutral">+ No Recent Links+ </Text>++ {/* <View className="text-center w-full mt-4 flex-row flex-wrap gap-4 justify-center">+ <Button onPress={() => setNewLinkModal(true)} variant="accent">+ <Icon name="bi-plus-lg" className="text-xl" />+ <Text>{t("add_link")}</Text>+ </Button>+ <ImportDropdown />+ </View> */}+ </View>+ )}+ </>+ );++ case DashboardSectionType.PINNED_LINKS:+ return (+ <>+ <View className="flex-row justify-between items-center px-5">+ <View className="flex-row gap-2 items-center">+ <View className={"flex-row items-center gap-2"}>+ <IconSymbol+ size={30}+ name="pin"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ <Text className="text-2xl capitalize text-base-content">+ Pinned Links+ </Text>+ </View>+ </View>+ <TouchableOpacity+ className="flex-row items-center text-sm gap-1"+ onPress={() =>+ router.navigate("/(tabs)/dashboard/pinned-links")+ }+ >+ <Text className="text-primary">View All</Text>+ <IconSymbol+ size={15}+ name="chevron.right"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ </TouchableOpacity>+ </View>++ {dashboardData.isLoading ||+ links?.some((e: any) => e.pinnedBy && e.pinnedBy[0]) ? (+ <FlatList+ horizontal+ showsHorizontalScrollIndicator={false}+ data={+ links.filter((e: any) => e.pinnedBy && e.pinnedBy[0]) || []+ }+ // onRefresh={() => data.refetch()}+ refreshing={dashboardData.isLoading}+ initialNumToRender={2}+ keyExtractor={(item) => item.id?.toString() || ""}+ renderItem={({ item }) => (+ <RenderItem item={item} key={item.id?.toString()} />+ )}+ ItemSeparatorComponent={() => <View style={{ width: 10 }} />}+ contentContainerStyle={{+ paddingHorizontal: 20,+ }}+ />+ ) : (+ <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={rawTheme[colorScheme as ThemeName].primary}+ />+ <Text className="text-center text-xl text-neutral">+ No Pinned Links+ </Text>+ </View>+ )}+ </>+ );++ case DashboardSectionType.COLLECTION:+ return collection?.id ? (+ <>+ <View className="flex-row justify-between items-center px-5">+ <View className="flex-row gap-2 items-center max-w-[60%]">+ <View className={clsx("flex-row items-center gap-2")}>+ <IconSymbol+ size={30}+ name="folder.fill"+ color={collection.color || "#0ea5e9"}+ />+ <Text+ className="text-2xl capitalize w-full text-base-content"+ numberOfLines={1}+ >+ {collection.name}+ </Text>+ </View>+ </View>+ <TouchableOpacity+ className="flex-row items-center text-sm gap-1 whitespace-nowrap"+ onPress={() =>+ router.navigate(+ `/(tabs)/dashboard/collection?collectionId=${collection.id}`+ )+ }+ >+ <Text className="text-primary">View All</Text>+ <IconSymbol+ size={15}+ name="chevron.right"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ </TouchableOpacity>+ </View>++ {dashboardData.isLoading || collectionLinks.length > 0 ? (+ <FlatList+ horizontal+ showsHorizontalScrollIndicator={false}+ data={collectionLinks || []}+ // onRefresh={() => data.refetch()}+ refreshing={dashboardData.isLoading}+ initialNumToRender={2}+ keyExtractor={(item) => item.id?.toString() || ""}+ renderItem={({ item }) => (+ <RenderItem item={item} key={item.id?.toString()} />+ )}+ ItemSeparatorComponent={() => <View style={{ width: 10 }} />}+ contentContainerStyle={{+ paddingHorizontal: 20,+ }}+ />+ ) : (+ <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 mx-5">+ <Text className="text-center text-xl text-neutral">+ Empty Collection+ </Text>+ </View>+ )}+ </>+ ) : null;++ default:+ return null;+ }+ };++ const RenderItem = React.memo(+ ({ item }: { item: LinkIncludingShortenedCollectionAndTags }) => {+ return <LinkListing link={item} dashboard />;+ }+ );+return (<SafeAreaViewstyle={styles.container}@@ -114,244 +390,6 @@ export default function DashboardScreen() {);}-interface SectionProps {- sectionData: { type: DashboardSectionType };- collection?: any;- links?: any[];- tagsLength: number;- numberOfLinks: number;- collectionsLength: number;- numberOfPinnedLinks: number;- dashboardData: { isLoading: boolean };- collectionLinks?: any[];-}--const Section: React.FC<SectionProps> = ({- sectionData,- collection,- links = [],- tagsLength,- numberOfLinks,- collectionsLength,- numberOfPinnedLinks,- dashboardData,- collectionLinks = [],-}) => {- const router = useRouter();-- switch (sectionData.type) {- case DashboardSectionType.STATS:- return (- <View className="flex-col gap-4 max-w-full px-5">- <View className="flex-row gap-4">- <DashboardItem- name={numberOfLinks === 1 ? "Link" : "Links"}- value={numberOfLinks}- icon="link.circle.fill"- color="#9c00cc"- />- <DashboardItem- name={collectionsLength === 1 ? "Collection" : "Collections"}- value={collectionsLength}- icon="folder.circle.fill"- color="#0096cc"- />- </View>- <View className="flex-row gap-4">- <DashboardItem- name={tagsLength === 1 ? "Tag" : "Tags"}- value={tagsLength}- icon="tag.circle.fill"- color="#00cc99"- />- <DashboardItem- name={"Pinned Links"}- value={numberOfPinnedLinks}- icon="pin.circle.fill"- color="#cc6d00"- />- </View>- </View>- );-- case DashboardSectionType.RECENT_LINKS:- return (- <>- <View className="flex-row justify-between items-center px-5">- <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 text-base-content">- Recent Links- </Text>- </View>- </View>- <TouchableOpacity- className="flex-row items-center text-sm gap-1"- onPress={() => router.navigate("/(tabs)/dashboard/recent-links")}- >- <Text className="text-[#3478f6]">View All</Text>- <IconSymbol size={15} name="chevron.right" color={"#3478f6"} />- </TouchableOpacity>- </View>-- {dashboardData.isLoading ||- (links.length > 0 && !dashboardData.isLoading) ? (- <FlatList- horizontal- showsHorizontalScrollIndicator={false}- directionalLockEnabled- data={links || []}- refreshing={dashboardData.isLoading}- initialNumToRender={2}- keyExtractor={(item) => item.id?.toString() || ""}- renderItem={({ item }) => (- <RenderItem item={item} key={item.id?.toString()} />- )}- ItemSeparatorComponent={() => <View style={{ width: 10 }} />}- contentContainerStyle={{- paddingHorizontal: 20,- }}- />- ) : (- <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-neutral">- No Recent Links- </Text>-- {/* <View className="text-center w-full mt-4 flex-row flex-wrap gap-4 justify-center">- <Button onPress={() => setNewLinkModal(true)} variant="accent">- <Icon name="bi-plus-lg" className="text-xl" />- <Text>{t("add_link")}</Text>- </Button>- <ImportDropdown />- </View> */}- </View>- )}- </>- );-- case DashboardSectionType.PINNED_LINKS:- return (- <>- <View className="flex-row justify-between items-center px-5">- <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 text-base-content">- Pinned Links- </Text>- </View>- </View>- <TouchableOpacity- className="flex-row items-center text-sm gap-1"- onPress={() => router.navigate("/(tabs)/dashboard/pinned-links")}- >- <Text className="text-[#3478f6]">View All</Text>- <IconSymbol size={15} name="chevron.right" color={"#3478f6"} />- </TouchableOpacity>- </View>-- {dashboardData.isLoading ||- links?.some((e: any) => e.pinnedBy && e.pinnedBy[0]) ? (- <FlatList- horizontal- showsHorizontalScrollIndicator={false}- data={links.filter((e: any) => e.pinnedBy && e.pinnedBy[0]) || []}- // onRefresh={() => data.refetch()}- refreshing={dashboardData.isLoading}- initialNumToRender={2}- keyExtractor={(item) => item.id?.toString() || ""}- renderItem={({ item }) => (- <RenderItem item={item} key={item.id?.toString()} />- )}- ItemSeparatorComponent={() => <View style={{ width: 10 }} />}- contentContainerStyle={{- paddingHorizontal: 20,- }}- />- ) : (- <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-neutral">- No Pinned Links- </Text>- </View>- )}- </>- );-- case DashboardSectionType.COLLECTION:- return collection?.id ? (- <>- <View className="flex-row justify-between items-center px-5">- <View className="flex-row gap-2 items-center max-w-[60%]">- <View className={clsx("flex-row items-center gap-2")}>- <IconSymbol- size={30}- name="folder.fill"- color={collection.color || "#0ea5e9"}- />- <Text- className="text-2xl capitalize w-full text-base-content"- numberOfLines={1}- >- {collection.name}- </Text>- </View>- </View>- <TouchableOpacity- className="flex-row items-center text-sm gap-1 whitespace-nowrap"- onPress={() =>- router.navigate(- `/(tabs)/dashboard/collection?collectionId=${collection.id}`- )- }- >- <Text className="text-[#3478f6]">View All</Text>- <IconSymbol size={15} name="chevron.right" color={"#3478f6"} />- </TouchableOpacity>- </View>-- {dashboardData.isLoading || collectionLinks.length > 0 ? (- <FlatList- horizontal- showsHorizontalScrollIndicator={false}- data={collectionLinks || []}- // onRefresh={() => data.refetch()}- refreshing={dashboardData.isLoading}- initialNumToRender={2}- keyExtractor={(item) => item.id?.toString() || ""}- renderItem={({ item }) => (- <RenderItem item={item} key={item.id?.toString()} />- )}- ItemSeparatorComponent={() => <View style={{ width: 10 }} />}- contentContainerStyle={{- paddingHorizontal: 20,- }}- />- ) : (- <View className="flex-col gap-2 justify-center items-center h-40 p-10 rounded-xl bg-base-200 bg-white mx-5">- <Text className="text-center text-xl text-gray-500">- Empty Collection- </Text>- </View>- )}- </>- ) : null;-- default:- return null;- }-};--const RenderItem = React.memo(- ({ item }: { item: LinkIncludingShortenedCollectionAndTags }) => {- return <LinkListing link={item} dashboard />;- }-);-const styles = StyleSheet.create({container: Platform.select({ios: {diff --git a/apps/mobile/app/(tabs)/settings/index.tsx b/apps/mobile/app/(tabs)/settings/index.tsxindex 29275e3e..bcd46b33 100644--- a/apps/mobile/app/(tabs)/settings/index.tsx+++ b/apps/mobile/app/(tabs)/settings/index.tsx@@ -13,6 +13,7 @@ import {} from "react-native";import { nativeApplicationVersion } from "expo-application";import { useColorScheme } from "nativewind";+import { rawTheme, ThemeName } from "@/lib/colors";export default function SettingsScreen() {const { signOut, auth } = useAuthStore();@@ -86,7 +87,11 @@ export default function SettingsScreen() {<Text className="text-orange-500">Light</Text></View>{colorScheme === "light" ? (- <IconSymbol name="checkmark" size={20} color="#3478f6" />+ <IconSymbol+ name="checkmark"+ size={20}+ color={rawTheme[colorScheme as ThemeName].primary}+ />) : null}</TouchableOpacity><View className="h-px bg-neutral-content ml-12" />@@ -99,7 +104,11 @@ export default function SettingsScreen() {<Text className="text-blue-600">Dark</Text></View>{colorScheme === "dark" ? (- <IconSymbol name="checkmark" size={20} color="#3478f6" />+ <IconSymbol+ name="checkmark"+ size={20}+ color={rawTheme[colorScheme as ThemeName].primary}+ />) : null}</TouchableOpacity></View>diff --git a/apps/mobile/components/ActionSheets/AddLinkSheet.tsx b/apps/mobile/components/ActionSheets/AddLinkSheet.tsxindex 07881b04..78a9eca4 100644--- a/apps/mobile/components/ActionSheets/AddLinkSheet.tsx+++ b/apps/mobile/components/ActionSheets/AddLinkSheet.tsx@@ -5,15 +5,24 @@ import Input from "@/components/ui/Input";import { Button } from "@/components/ui/Button";import { useAddLink } from "@linkwarden/router/links";import useAuthStore from "@/store/auth";+import { rawTheme, ThemeName } from "@/lib/colors";+import { useColorScheme } from "nativewind";export default function AddLinkSheet() {const actionSheetRef = useRef<ActionSheetRef>(null);const { auth } = useAuthStore();const addLink = useAddLink(auth);const [link, setLink] = useState("");+ const { colorScheme } = useColorScheme();return (- <ActionSheet ref={actionSheetRef} gestureEnabled>+ <ActionSheet+ ref={actionSheetRef}+ gestureEnabled+ containerStyle={{+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-100"],+ }}+ ><View className="px-8 py-5"><Inputplaceholder="e.g. https://example.com"@@ -51,7 +60,7 @@ export default function AddLinkSheet() {variant="outline"className="mb-2">- <Text>Cancel</Text>+ <Text className="text-base-content">Cancel</Text></Button></View></ActionSheet>diff --git a/apps/mobile/components/ActionSheets/EditLinkSheet.tsx b/apps/mobile/components/ActionSheets/EditLinkSheet.tsxindex 637bb75d..aa7f7708 100644--- a/apps/mobile/components/ActionSheets/EditLinkSheet.tsx+++ b/apps/mobile/components/ActionSheets/EditLinkSheet.tsx@@ -18,6 +18,8 @@ import {} from "@linkwarden/types";import { IconSymbol } from "../ui/IconSymbol";import { useCollections } from "@linkwarden/router/collections";+import { rawTheme, ThemeName } from "@/lib/colors";+import { useColorScheme } from "nativewind";const Main = (props: SheetProps<"edit-link-sheet">) => {const { auth } = useAuthStore();@@ -29,6 +31,7 @@ const Main = (props: SheetProps<"edit-link-sheet">) => {>(props.payload?.link);const editLink = useUpdateLink(auth);const router = useSheetRouter("edit-link-sheet");+ const { colorScheme } = useColorScheme();useEffect(() => {if (params?.link) {@@ -65,11 +68,15 @@ const Main = (props: SheetProps<"edit-link-sheet">) => {name="folder.fill"color={link?.collection.color || "gray"}/>- <Text numberOfLines={1} className="w-[90%]">+ <Text numberOfLines={1} className="w-[90%] text-base-content">{link?.collection.name}</Text></View>- <IconSymbol size={16} name="chevron.right" color={"gray"} />+ <IconSymbol+ size={16}+ name="chevron.right"+ color={rawTheme[colorScheme as ThemeName]["neutral"]}+ /></Button>{/* <Button variant="input" className="mb-4 h-auto">@@ -124,7 +131,7 @@ const Main = (props: SheetProps<"edit-link-sheet">) => {variant="outline"className="mb-2">- <Text>Cancel</Text>+ <Text className="text-base-content">Cancel</Text></Button></View>);@@ -141,6 +148,7 @@ const Collections = () => {>("edit-link-sheet", "collections");const params = useSheetRouteParams("edit-link-sheet", "collections");const collections = useCollections(auth);+ const { colorScheme } = useColorScheme();const filteredCollections = useMemo(() => {if (!collections.data) return [];@@ -175,15 +183,19 @@ const Collections = () => {name="folder.fill"color={collection.color || "gray"}/>- <Text numberOfLines={1} className="w-full">+ <Text numberOfLines={1} className="w-full text-base-content">{collection.name}</Text></View><View className="flex-row items-center gap-2">{params.link?.collection.id === collection.id && (- <IconSymbol size={16} name="checkmark" color="" />+ <IconSymbol+ size={16}+ name="checkmark"+ color={rawTheme[colorScheme as ThemeName].primary}+ />)}- <Text className="text-gray-600">+ <Text className="text-neutral">{collection._count?.links ?? 0}</Text></View>@@ -207,7 +219,10 @@ const Collections = () => {keyExtractor={(e, i) => i.toString()}renderItem={renderItem}ListEmptyComponent={- <Text style={{ textAlign: "center", color: "#666", marginTop: 20 }}>+ <Text+ style={{ textAlign: "center", marginTop: 20 }}+ className="text-neutral"+ >No collections match “{searchQuery}”</Text>}@@ -229,12 +244,17 @@ const routes: Route[] = [];export default function EditLinkSheet() {+ const { colorScheme } = useColorScheme();+return (<ActionSheetgestureEnabledenableRouterBackNavigation={true}routes={routes}initialRoute="main"+ containerStyle={{+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-100"],+ }}/>);}diff --git a/apps/mobile/components/ui/Button.tsx b/apps/mobile/components/ui/Button.tsxindex ddb4677f..89929326 100644--- a/apps/mobile/components/ui/Button.tsx+++ b/apps/mobile/components/ui/Button.tsx@@ -18,10 +18,10 @@ const buttonVariants = cva(primary: "bg-primary text-base-content",accent: "bg-accent border border-violet-400 text-white",destructive: "bg-destructive text-white",- outline: "border",+ outline: "border border-base-content",secondary: "bg-secondary text-secondary-foreground",input:- "bg-gray-100 rounded-lg px-4 justify-between flex-row font-normal",+ "bg-base-200 rounded-lg px-4 justify-between flex-row font-normal",metal: "bg-neutral-content text-base-content border border-neutral/30",ghost: "",simple: "bg-base-200",diff --git a/apps/mobile/components/ui/Input.tsx b/apps/mobile/components/ui/Input.tsxindex ba75c55a..d79fac4b 100644--- a/apps/mobile/components/ui/Input.tsx+++ b/apps/mobile/components/ui/Input.tsx@@ -8,7 +8,7 @@ const Input = forwardRef<TextInput, TextInputProps>(<TextInputref={ref}className={cn(- "bg-neutral-content text-base-content rounded-lg px-4 py-2",+ "bg-base-200 text-base-content rounded-lg px-4 py-2",className)}{...props}