From 64fb87d0ceb591a49aacad39bf5e885cab7decfa Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 19 Mar 2024 12:41:06 +0000
Subject: feature(web): Add support for demo mode

---
 apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx')

diff --git a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
index 3656a435..692d7d78 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
@@ -9,6 +9,7 @@ import {
   DropdownMenuTrigger,
 } from "@/components/ui/dropdown-menu";
 import { useToast } from "@/components/ui/use-toast";
+import { useClientConfig } from "@/lib/clientConfig";
 import { api } from "@/lib/trpc";
 import {
   Archive,
@@ -32,6 +33,8 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
   const { toast } = useToast();
   const linkId = bookmark.id;
 
+  const demoMode = useClientConfig().demoMode;
+
   const { setOpen: setTagModalIsOpen, content: tagModal } =
     useTagModel(bookmark);
   const { setOpen: setAddToListModalOpen, content: addToListModal } =
@@ -115,6 +118,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
             </DropdownMenuItem>
           )}
           <DropdownMenuItem
+            disabled={demoMode}
             onClick={() =>
               updateBookmarkMutator.mutate({
                 bookmarkId: linkId,
@@ -126,6 +130,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
             <span>{bookmark.favourited ? "Un-favourite" : "Favourite"}</span>
           </DropdownMenuItem>
           <DropdownMenuItem
+            disabled={demoMode}
             onClick={() =>
               updateBookmarkMutator.mutate({
                 bookmarkId: linkId,
@@ -163,6 +168,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
 
           {bookmark.content.type === "link" && (
             <DropdownMenuItem
+              disabled={demoMode}
               onClick={() =>
                 crawlBookmarkMutator.mutate({ bookmarkId: bookmark.id })
               }
@@ -172,6 +178,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
             </DropdownMenuItem>
           )}
           <DropdownMenuItem
+            disabled={demoMode}
             className="text-destructive"
             onClick={() =>
               deleteBookmarkMutator.mutate({ bookmarkId: bookmark.id })
-- 
cgit v1.2.3-70-g09d2

