diff --git a/src/components/Graph/index.tsx b/src/components/Graph/index.tsx
index b93cd62..ed562bd 100644
--- a/src/components/Graph/index.tsx
+++ b/src/components/Graph/index.tsx
@@ -93,7 +93,7 @@ export const Graph = ({ isWidget = false }: GraphProps) => {
const changeRatio = Math.abs((areaSize * 100) / (paneWidth * paneHeight) - 100);
setPaneWidth(layout.width + 50);
- setPaneHeight(layout.height as number + 50);
+ setPaneHeight((layout.height as number) + 50);
setTimeout(() => {
setLoading(false);
diff --git a/src/containers/Editor/BottomBar.tsx b/src/containers/Editor/BottomBar.tsx
index e33f3f8..775db2f 100644
--- a/src/containers/Editor/BottomBar.tsx
+++ b/src/containers/Editor/BottomBar.tsx
@@ -12,7 +12,7 @@ import {
AiOutlineUnlock,
} from "react-icons/ai";
import { MdReportGmailerrorred, MdOutlineCheckCircleOutline } from "react-icons/md";
-import { VscAccount } from "react-icons/vsc";
+import { VscAccount, VscWorkspaceTrusted } from "react-icons/vsc";
import { saveJson, updateJson } from "src/services/db/json";
import useJson from "src/store/useJson";
import useModal from "src/store/useModal";
@@ -81,6 +81,7 @@ export const BottomBar = () => {
const data = useJson(state => state.data);
const hasError = useJson(state => state.hasError);
const user = useUser(state => state.user);
+ const premium = useUser(state => state.isPremium());
const lightmode = useStored(state => state.lightmode);
const hasChanges = useJson(state => state.hasChanges);
@@ -155,6 +156,12 @@ export const BottomBar = () => {
{user ? user.name : "Login"}
+ {!premium && (
+ setVisible("premium")(true)}>
+
+ Upgrade to Premium
+
+ )}
{hasError ? (
diff --git a/src/containers/Modals/AccountModal/index.tsx b/src/containers/Modals/AccountModal/index.tsx
index 7a3790c..765d675 100644
--- a/src/containers/Modals/AccountModal/index.tsx
+++ b/src/containers/Modals/AccountModal/index.tsx
@@ -1,8 +1,8 @@
import React from "react";
-import Link from "next/link";
import styled from "styled-components";
import { Modal, Group, Button, Badge, Avatar, Grid, Divider, ModalProps } from "@mantine/core";
import { IoRocketSharp } from "react-icons/io5";
+import useModal from "src/store/useModal";
import useUser from "src/store/useUser";
const StyledTitle = styled.div`
@@ -43,6 +43,7 @@ const StyledContainer = styled.div`
`;
export const AccountModal: React.FC = ({ opened, onClose }) => {
+ const setVisible = useModal(state => state.setVisible);
const user = useUser(state => state.user);
const isPremium = useUser(state => state.isPremium());
const logout = useUser(state => state.logout);
@@ -101,15 +102,14 @@ export const AccountModal: React.FC = ({ opened, onClose }) => {
Cancel Subscription
) : (
-
- }
- >
- UPGRADE TO PREMIUM!
-
-
+ }
+ onClick={() => setVisible("premium")(true)}
+ >
+ UPGRADE TO PREMIUM!
+
)}
);
};
diff --git a/src/store/useUser.tsx b/src/store/useUser.tsx
index affafaf..3389d7c 100644
--- a/src/store/useUser.tsx
+++ b/src/store/useUser.tsx
@@ -10,7 +10,6 @@ interface UserActions {
setUser: (key: keyof typeof initialStates, value: any) => void;
checkSession: () => void;
isPremium: () => boolean;
- validatePremium: (cb: () => void) => void;
}
const initialStates = {
@@ -55,14 +54,6 @@ const useUser = create()((set, get) => ({
}
}
},
- validatePremium: callback => {
- if (get().isAuthenticated) {
- if (!get().isPremium()) return useModal.getState().setVisible("premium")(true);
- return callback();
- } else {
- return useModal.getState().setVisible("account")(true);
- }
- },
}));
export default useUser;