From 8410a6d3c125cf27daa4e3abeb4c4a4d228e2cfd Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Mon, 26 Aug 2024 13:13:24 +0300
Subject: ui(mobile): Change the add/edit note editor dialogs to be bottom
 sheets

---
 apps/mobile/components/bookmarks/BookmarkCard.tsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'apps/mobile/components/bookmarks/BookmarkCard.tsx')

diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx
index ed6a3b2c..8c582d59 100644
--- a/apps/mobile/components/bookmarks/BookmarkCard.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx
@@ -35,6 +35,7 @@ import { useToast } from "../ui/Toast";
 import BookmarkAssetImage from "./BookmarkAssetImage";
 import BookmarkTextMarkdown from "./BookmarkTextMarkdown";
 import ListPickerModal from "./ListPickerModal";
+import NoteEditorModal from "./NewBookmarkModal";
 
 function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
   const { toast } = useToast();
@@ -74,6 +75,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
     });
 
   const manageListsSheetRef = useRef<BottomSheetModal>(null);
+  const editBookmarkModal = useRef<BottomSheetModal>(null);
 
   return (
     <View className="flex flex-row gap-4">
@@ -99,6 +101,13 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
         snapPoints={["50%", "90%"]}
         bookmarkId={bookmark.id}
       />
+      {bookmark.content.type === BookmarkTypes.TEXT && (
+        <NoteEditorModal
+          ref={editBookmarkModal}
+          bookmark={bookmark}
+          snapPoints={["90%", "60%"]}
+        />
+      )}
 
       <MenuView
         onPressAction={({ nativeEvent }) => {
@@ -115,7 +124,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {
           } else if (nativeEvent.event === "manage_list") {
             manageListsSheetRef?.current?.present();
           } else if (nativeEvent.event === "edit") {
-            router.push(`/dashboard/add-note?bookmarkId=${bookmark.id}`);
+            editBookmarkModal.current?.present();
           }
         }}
         actions={[
-- 
cgit v1.2.3-70-g09d2

