diff --git a/public/assets/hp-dark.png b/public/assets/hp-dark.png new file mode 100644 index 0000000..fb5606b Binary files /dev/null and b/public/assets/hp-dark.png differ diff --git a/public/assets/hp-light.png b/public/assets/hp-light.png new file mode 100644 index 0000000..55c214e Binary files /dev/null and b/public/assets/hp-light.png differ diff --git a/src/features/modals/UpgradeModal/index.tsx b/src/features/modals/UpgradeModal/index.tsx index 796d354..a7dfccb 100644 --- a/src/features/modals/UpgradeModal/index.tsx +++ b/src/features/modals/UpgradeModal/index.tsx @@ -10,15 +10,26 @@ import { ThemeIcon, CloseButton, FocusTrap, + Image, + Divider, } from "@mantine/core"; +import Cookie from "js-cookie"; import { LuCrown, LuTrendingUp } from "react-icons/lu"; +import useConfig from "src/store/useConfig"; export const UpgradeModal = ({ opened, onClose }: ModalProps) => { + const darkmodeEnabled = useConfig(state => state.darkmodeEnabled); + + const handleCloseModal = () => { + Cookie.set("upgrade_shown", "true", { expires: 3 }); + onClose(); + }; + return ( { > + diagram + Upgrade to unlock all features - + @@ -41,10 +60,10 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => { - New diagram structure + Load up to 4 MBs - 50% less size, faster & customizable! + We made it easy to visualize, format, and explore JSON data, faster than ever. @@ -54,7 +73,7 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => { - Powerful + Powerful, colorful editor Modify data, preview images, inspect nodes, and more! @@ -73,7 +92,7 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => { > Try premium for free, no registration - diff --git a/src/layout/Landing/HeroSection.tsx b/src/layout/Landing/HeroSection.tsx index d70c398..ead42c1 100644 --- a/src/layout/Landing/HeroSection.tsx +++ b/src/layout/Landing/HeroSection.tsx @@ -136,18 +136,6 @@ export const HeroSection = () => { > Go to Editor - - diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx index 563eb3d..adbf392 100644 --- a/src/pages/editor.tsx +++ b/src/pages/editor.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import { useEffect } from "react"; import dynamic from "next/dynamic"; import { useRouter } from "next/router"; import { useMantineColorScheme } from "@mantine/core"; @@ -7,6 +7,7 @@ import styled, { ThemeProvider } from "styled-components"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { Allotment } from "allotment"; import "allotment/dist/style.css"; +import Cookie from "js-cookie"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; import { darkTheme, lightTheme } from "src/constants/theme"; @@ -16,6 +17,7 @@ import { Toolbar } from "src/features/editor/Toolbar"; import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import useFile from "src/store/useFile"; +import useModal from "src/store/useModal"; const ModalController = dynamic(() => import("src/features/modals/ModalController")); const ExternalMode = dynamic(() => import("src/features/editor/ExternalMode")); @@ -69,12 +71,18 @@ const EditorPage = () => { const checkEditorSession = useFile(state => state.checkEditorSession); const darkmodeEnabled = useConfig(state => state.darkmodeEnabled); const fullscreen = useGraph(state => state.fullscreen); + const setVisible = useModal(state => state.setVisible); - React.useEffect(() => { + useEffect(() => { + const isUpgradeShown = Cookie.get("upgrade_shown"); + if (!isUpgradeShown) setVisible("UpgradeModal", true); + }, [setVisible]); + + useEffect(() => { if (isReady) checkEditorSession(query?.json); }, [checkEditorSession, isReady, query]); - React.useEffect(() => { + useEffect(() => { setColorScheme(darkmodeEnabled ? "dark" : "light"); }, [darkmodeEnabled, setColorScheme]);