From 71c146e1962d8e2d2cce9c29a301bc7d3d9485e8 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Fri, 15 May 2020 00:35:20 +0500 Subject: [PATCH] feat: impl menu item feature locks for non-pro users --- apps/web/src/components/menu/index.js | 20 +++++++++++++++++++- apps/web/src/components/note/index.js | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.js index 67887166c..7fb344488 100644 --- a/apps/web/src/components/menu/index.js +++ b/apps/web/src/components/menu/index.js @@ -1,7 +1,10 @@ import React from "react"; import { Flex, Box, Text } from "rebass"; +import { useStore as useUserStore } from "../../stores/user-store"; function Menu(props) { + const isPremium = useUserStore((store) => store.isPremium); + return ( )} + {item.onlyPro && !isPremium && ( + + Pro + + )} ) )} diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.js index d0439bc7b..8bccfe942 100644 --- a/apps/web/src/components/note/index.js +++ b/apps/web/src/components/note/index.js @@ -27,10 +27,12 @@ function menuItems(note, context) { { title: note.pinned ? "Unpin" : "Pin", onClick: () => store.pin(note), + onlyPro: true, }, { title: note.favorite ? "Unfavorite" : "Favorite", onClick: () => store.favorite(note), + onlyPro: true, }, { title: "Edit", onClick: () => editorStore.openSession(note) }, { @@ -43,6 +45,7 @@ function menuItems(note, context) { unlock(note.id); } }, + onlyPro: true, }, { visible: context ? (context.type === "topic" ? true : false) : false,