Skip to content

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

feat(mobile): better UX

daniel31x139b5d400032c6
diff --git a/apps/mobile/app/(tabs)/collections/_layout.tsx b/apps/mobile/app/(tabs)/collections/_layout.tsx
index c28880b1..a4cad6c9 100644
--- a/apps/mobile/app/(tabs)/collections/_layout.tsx
+++ b/apps/mobile/app/(tabs)/collections/_layout.tsx
@@ -1,7 +1,9 @@
import { Stack, useRouter } from "expo-router";
+import { Plus } from "lucide-react-native";
import { useColorScheme } from "nativewind";
import { rawTheme, ThemeName } from "@/lib/colors";
-import { Platform } from "react-native";
+import { Platform, TouchableOpacity } from "react-native";
+import { SheetManager } from "react-native-actions-sheet";
import TabBarSafeArea from "@/components/TabBarSafeArea";
export default function Layout() {
@@ -54,7 +56,23 @@ export default function Layout() {
: "white",
},
}}
- />
+ >
+ <Stack.Screen
+ name="index"
+ options={{
+ headerRight: () => (
+ <TouchableOpacity
+ onPress={() => SheetManager.show("new-collection-sheet")}
+ >
+ <Plus
+ size={21}
+ color={rawTheme[colorScheme as ThemeName].primary}
+ />
+ </TouchableOpacity>
+ ),
+ }}
+ />
+ </Stack>
</TabBarSafeArea>
);
}
diff --git a/apps/mobile/app/(tabs)/links/_layout.tsx b/apps/mobile/app/(tabs)/links/_layout.tsx
index 9e9893e3..37d2a1dc 100644
--- a/apps/mobile/app/(tabs)/links/_layout.tsx
+++ b/apps/mobile/app/(tabs)/links/_layout.tsx
@@ -1,7 +1,9 @@
import { Stack, useRouter } from "expo-router";
+import { Plus } from "lucide-react-native";
import { useColorScheme } from "nativewind";
import { rawTheme, ThemeName } from "@/lib/colors";
-import { Platform } from "react-native";
+import { Platform, TouchableOpacity } from "react-native";
+import { SheetManager } from "react-native-actions-sheet";
import TabBarSafeArea from "@/components/TabBarSafeArea";
export default function Layout() {
@@ -53,7 +55,23 @@ export default function Layout() {
: "white",
},
}}
- />
+ >
+ <Stack.Screen
+ name="index"
+ options={{
+ headerRight: () => (
+ <TouchableOpacity
+ onPress={() => SheetManager.show("add-link-sheet")}
+ >
+ <Plus
+ size={21}
+ color={rawTheme[colorScheme as ThemeName].primary}
+ />
+ </TouchableOpacity>
+ ),
+ }}
+ />
+ </Stack>
</TabBarSafeArea>
);
}
diff --git a/apps/mobile/app/(tabs)/settings/index.tsx b/apps/mobile/app/(tabs)/settings/index.tsx
index cad0093b..dfb4f0c4 100644
--- a/apps/mobile/app/(tabs)/settings/index.tsx
+++ b/apps/mobile/app/(tabs)/settings/index.tsx
@@ -10,6 +10,7 @@ import {
Alert,
Switch,
ActivityIndicator,
+ Linking,
} from "react-native";
import { nativeApplicationVersion } from "expo-application";
import { useColorScheme } from "nativewind";
@@ -30,7 +31,9 @@ import {
Smartphone,
Sun,
Trash2,
+ UserX,
} from "lucide-react-native";
+import { SheetManager } from "react-native-actions-sheet";
import { clearCache } from "@/lib/cache";
import {
formatBytes,
@@ -383,6 +386,21 @@ export default function SettingsScreen() {
</View>
</View>
+ <View>
+ <Text className="mb-4 mx-4 text-neutral">Account Deletion</Text>
+ <View className="bg-base-200 rounded-xl flex-col">
+ <TouchableOpacity
+ className="flex-row gap-2 items-center justify-between py-3 px-4"
+ onPress={() => SheetManager.show("delete-account-sheet")}
+ >
+ <View className="flex-row items-center gap-2">
+ <UserX size={20} color="red" />
+ <Text className="text-red-500">Delete Account</Text>
+ </View>
+ </TouchableOpacity>
+ </View>
+ </View>
+
<Text className="mx-auto text-sm text-neutral">
Linkwarden for {Platform.OS === "ios" ? "iOS" : "Android"}{" "}
{nativeApplicationVersion}
diff --git a/apps/mobile/app/(tabs)/tags/_layout.tsx b/apps/mobile/app/(tabs)/tags/_layout.tsx
index 03e84f05..bd3bb5f7 100644
--- a/apps/mobile/app/(tabs)/tags/_layout.tsx
+++ b/apps/mobile/app/(tabs)/tags/_layout.tsx
@@ -1,7 +1,9 @@
import { Stack, useRouter } from "expo-router";
+import { Plus } from "lucide-react-native";
import { useColorScheme } from "nativewind";
import { rawTheme, ThemeName } from "@/lib/colors";
-import { Platform } from "react-native";
+import { Platform, TouchableOpacity } from "react-native";
+import { SheetManager } from "react-native-actions-sheet";
import TabBarSafeArea from "@/components/TabBarSafeArea";
export default function Layout() {
@@ -52,7 +54,21 @@ export default function Layout() {
: "white",
},
}}
- />
+ >
+ <Stack.Screen
+ name="index"
+ options={{
+ headerRight: () => (
+ <TouchableOpacity onPress={() => SheetManager.show("add-tag-sheet")}>
+ <Plus
+ size={21}
+ color={rawTheme[colorScheme as ThemeName].primary}
+ />
+ </TouchableOpacity>
+ ),
+ }}
+ />
+ </Stack>
</TabBarSafeArea>
);
}
diff --git a/apps/mobile/components/ActionSheets/AddTagSheet.tsx b/apps/mobile/components/ActionSheets/AddTagSheet.tsx
new file mode 100644
index 00000000..0479dc9a
--- /dev/null
+++ b/apps/mobile/components/ActionSheets/AddTagSheet.tsx
@@ -0,0 +1,75 @@
+import { Alert, Text, View } from "react-native";
+import { useRef, useState } from "react";
+import ActionSheet, { ActionSheetRef } from "react-native-actions-sheet";
+import Input from "@/components/ui/Input";
+import { Button } from "@/components/ui/Button";
+import useAuthStore from "@/store/auth";
+import { rawTheme, ThemeName } from "@/lib/colors";
+import { useColorScheme } from "nativewind";
+import { useUpsertTags } from "@linkwarden/router/tags";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import SheetHeader from "./SheetHeader";
+
+export default function AddTagSheet() {
+ const actionSheetRef = useRef<ActionSheetRef>(null);
+ const { auth } = useAuthStore();
+ const upsertTags = useUpsertTags(auth);
+ const [name, setName] = useState("");
+ const { colorScheme } = useColorScheme();
+
+ const insets = useSafeAreaInsets();
+
+ const closeSheet = () => {
+ actionSheetRef.current?.hide();
+ setName("");
+ };
+
+ return (
+ <ActionSheet
+ ref={actionSheetRef}
+ gestureEnabled
+ indicatorStyle={{
+ display: "none",
+ }}
+ containerStyle={{
+ backgroundColor: rawTheme[colorScheme as ThemeName]["base-200"],
+ }}
+ safeAreaInsets={insets}
+ onClose={() => {
+ setName("");
+ }}
+ >
+ <SheetHeader title="New Tag" onClose={closeSheet} />
+
+ <View className="px-8 pb-5">
+ <Input
+ placeholder="Name"
+ className="mb-4 bg-base-100"
+ autoCapitalize="none"
+ value={name}
+ onChangeText={setName}
+ />
+
+ <Button
+ onPress={() =>
+ upsertTags.mutate([{ label: name.trim() }], {
+ onSuccess: () => {
+ actionSheetRef.current?.hide();
+ setName("");
+ },
+ onError: (error) => {
+ Alert.alert("Error", "There was an error creating the tag.");
+ console.error("Error creating tag:", error);
+ },
+ })
+ }
+ disabled={name.trim().length === 0}
+ isLoading={upsertTags.isPending}
+ variant="accent"
+ >
+ <Text className="text-white">Save Tag</Text>
+ </Button>
+ </View>
+ </ActionSheet>
+ );
+}
diff --git a/apps/mobile/components/ActionSheets/DeleteAccountSheet.tsx b/apps/mobile/components/ActionSheets/DeleteAccountSheet.tsx
index 993ce089..29ada4f2 100644
--- a/apps/mobile/components/ActionSheets/DeleteAccountSheet.tsx
+++ b/apps/mobile/components/ActionSheets/DeleteAccountSheet.tsx
@@ -116,11 +116,11 @@ export default function DeleteAccountSheet() {
{user?.subscription?.active &&
user.subscription.provider === "APPLE" ? (
- <View className="border border-neutral-content p-3 rounded-md mt-5">
+ <View className="mt-3">
<Text className="text-base-content">
- Deleting your account won't cancel your App Store subscription. To
- stop future charges, cancel it from your Apple ID's subscription
- settings.
+ Note: Deleting your account will not cancel your App Store
+ subscription. To avoid future charges, cancel the subscription in
+ your Apple ID settings or use the following link:
</Text>
<TouchableOpacity
activeOpacity={0.7}
@@ -129,7 +129,7 @@ export default function DeleteAccountSheet() {
}
>
<Text className="text-primary font-semibold mt-2">
- Manage subscriptions
+ https://apps.apple.com/account/subscriptions
</Text>
</TouchableOpacity>
</View>
diff --git a/apps/mobile/components/ActionSheets/Sheets.tsx b/apps/mobile/components/ActionSheets/Sheets.tsx
index 2119642b..c6008ad2 100644
--- a/apps/mobile/components/ActionSheets/Sheets.tsx
+++ b/apps/mobile/components/ActionSheets/Sheets.tsx
@@ -7,6 +7,7 @@ import SupportSheet from "./SupportSheet";
import AddLinkSheet from "./AddLinkSheet";
import EditLinkSheet from "./EditLinkSheet";
import NewCollectionSheet from "./NewCollectionSheet";
+import AddTagSheet from "./AddTagSheet";
import LinkDetailsSheet from "./LinkDetailsSheet";
import ReadableHighlightSheet, {
ReadableHighlightDraft,
@@ -28,6 +29,7 @@ registerSheet("add-link-sheet", AddLinkSheet);
registerSheet("link-details-sheet", LinkDetailsSheet);
registerSheet("edit-link-sheet", EditLinkSheet);
registerSheet("new-collection-sheet", NewCollectionSheet);
+registerSheet("add-tag-sheet", AddTagSheet);
registerSheet("readable-highlight-sheet", ReadableHighlightSheet);
registerSheet("readable-highlights-sheet", ReadableHighlightsSheet);
registerSheet("reader-settings-sheet", ReaderSettingsSheet);
@@ -63,6 +65,7 @@ declare module "react-native-actions-sheet" {
};
}>;
"new-collection-sheet": SheetDefinition;
+ "add-tag-sheet": SheetDefinition;
"readable-highlight-sheet": SheetDefinition<{
payload: {
draft: ReadableHighlightDraft;
diff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.json
index 91407bd9..02726873 100644
--- a/apps/web/public/locales/en/common.json
+++ b/apps/web/public/locales/en/common.json
@@ -133,7 +133,7 @@
"fill_required_fields": "Please fill the required fields.",
"deleting_message": "Deleting everything, please wait...",
"delete_warning": "This will permanently delete all the Links, Collections, Tags, and archived data you own. It will also log you out. This action is irreversible!",
- "delete_account_apple_subscription_notice": "Note: Deleting your account will not cancel your App Store subscription. To avoid future charges, cancel the subscription in your Apple ID settings or use the following link.",
+ "delete_account_apple_subscription_notice": "Note: Deleting your account will not cancel your App Store subscription. To avoid future charges, cancel the subscription in your Apple ID settings or use the following link:",
"delete_account_google_subscription_notice": "Your Google Play subscription's auto-renewal will be cancelled automatically when your account is deleted.",
"optional": "Optional",
"feedback_help": "(but it really helps us improve!)",
diff --git a/packages/router/tags.tsx b/packages/router/tags.tsx
index d7342077..693303d6 100644
--- a/packages/router/tags.tsx
+++ b/packages/router/tags.tsx
@@ -319,18 +319,24 @@ const useUpdateTag = () => {
});
};
-const useUpsertTags = () => {
+const useUpsertTags = (auth?: MobileAuth) => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async (tags: ArchivalTagOption[]) => {
- const response = await fetch("/api/v1/tags", {
- body: JSON.stringify({ tags }),
- headers: {
- "Content-Type": "application/json",
- },
- method: "POST",
- });
+ const response = await fetch(
+ (auth?.instance ? auth.instance : "") + "/api/v1/tags",
+ {
+ body: JSON.stringify({ tags }),
+ headers: {
+ "Content-Type": "application/json",
+ ...(auth?.session
+ ? { Authorization: `Bearer ${auth.session}` }
+ : {}),
+ },
+ method: "POST",
+ }
+ );
const data = await response.json();
if (!response.ok) throw new Error(data.response);