diff options
| author | Nicole Li <40200356+lexafaxine@users.noreply.github.com> | 2024-12-31 19:33:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-31 12:33:41 +0200 |
| commit | f476fca758bb039f9605488b61ba35fc097d6cfc (patch) | |
| tree | 2e76f354641708474323ed1d44c1fa5cd37c2b6f /apps/mobile | |
| parent | b6d5556561698579361db9158d1ad70c5a8d48a4 (diff) | |
| download | karakeep-f476fca758bb039f9605488b61ba35fc097d6cfc.tar.zst | |
feat: Add delete bookmark confirmation dialog. Fixes #776 (#787)
Diffstat (limited to 'apps/mobile')
| -rw-r--r-- | apps/mobile/components/bookmarks/BookmarkCard.tsx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx index 13d639c9..ce294a6f 100644 --- a/apps/mobile/components/bookmarks/BookmarkCard.tsx +++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx @@ -1,5 +1,6 @@ import { ActivityIndicator, + Alert, Image, Platform, Pressable, @@ -70,6 +71,20 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) { onError, }); + const deleteBookmarkAlert = () => + Alert.alert( + "Delete bookmark?", + "Are you sure you want to delete this bookmark?", + [ + { text: "Cancel", style: "cancel" }, + { + text: "Delete", + onPress: () => deleteBookmark({ bookmarkId: bookmark.id }), + style: "destructive", + }, + ], + ); + return ( <View className="flex flex-row gap-4"> {(isArchivePending || isDeletionPending) && <ActivityIndicator />} @@ -93,9 +108,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) { onPressAction={({ nativeEvent }) => { Haptics.selectionAsync(); if (nativeEvent.event === "delete") { - deleteBookmark({ - bookmarkId: bookmark.id, - }); + deleteBookmarkAlert(); } else if (nativeEvent.event === "archive") { archiveBookmark({ bookmarkId: bookmark.id, |
