diff --git a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx index 16202a62d..4f8ebe4de 100644 --- a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx +++ b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx @@ -62,6 +62,8 @@ import { PresetId } from "../../common/toolbar-config"; import { showToast } from "../../utils/toast"; +import { isUserPremium } from "../../hooks/use-is-user-premium"; +import { Pro } from "../icons"; export type ToolbarConfigDialogProps = { onClose: Perform; }; @@ -126,12 +128,24 @@ export default function ToolbarConfigDialog(props: ToolbarConfigDialogProps) { name="preset" value={preset.id} checked={preset.id === currentPreset.id} + disabled={preset.id === "custom" && !isUserPremium()} onChange={(e) => { const { value } = e.target; + if (preset.id === "custom" && !isUserPremium()) { + showToast( + "info", + "You need to be Pro to use the custom preset." + ); + return; + } + setCurrentPreset(getPreset(value as PresetId)); }} /> {preset.title} + {preset.id === "custom" && !isUserPremium() ? ( + + ) : null} ))} @@ -159,6 +173,11 @@ export default function ToolbarConfigDialog(props: ToolbarConfigDialogProps) { sensors={sensors} collisionDetection={closestCenter} onDragStart={(event) => { + if (!isUserPremium()) { + showToast("info", "You need to be Pro to customize the toolbar."); + return; + } + if (currentPreset.id !== "custom") { setCurrentPreset((c) => ({ ...getPreset("custom"), diff --git a/apps/web/src/utils/toast.tsx b/apps/web/src/utils/toast.tsx index 5d2aefd3b..234c09da2 100644 --- a/apps/web/src/utils/toast.tsx +++ b/apps/web/src/utils/toast.tsx @@ -19,7 +19,7 @@ along with this program. If not, see . import { Button, Flex, Text } from "@theme-ui/components"; import ThemeProvider from "../components/theme-provider"; -import { Error, Warn, Success } from "../components/icons"; +import { Error, Warn, Success, Info } from "../components/icons"; import { store as appstore } from "../stores/app-store"; import toast from "react-hot-toast"; import { Theme } from "@notesnook/theme"; @@ -40,10 +40,16 @@ function showToast( if (appstore.get().isFocusMode) return { hide: () => {} }; // TODO const IconComponent = - type === "error" ? Error : type === "success" ? Success : Warn; + type === "error" + ? Error + : type === "success" + ? Success + : type === "warn" + ? Warn + : Info; const RenderedIcon = () => ( - + ); const id = toast(, { diff --git a/packages/theme/src/theme/colorscheme/static.ts b/packages/theme/src/theme/colorscheme/static.ts index 977707f3c..3db5d2795 100644 --- a/packages/theme/src/theme/colorscheme/static.ts +++ b/packages/theme/src/theme/colorscheme/static.ts @@ -30,6 +30,8 @@ export type StaticColors = { success: string; warn: string; warnBg: string; + info: string; + infoBg: string; favorite: string; codeBg: string; @@ -52,6 +54,8 @@ export function getStaticColors(accent: string): StaticColors { success: "#4F8A10", warn: "#FF5722", warnBg: "#FF572220", + info: "#17a2b8", + infoBg: "#17a2b820", favorite: "#ffd700", // dracula colors