Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: create btn quota & cancel sub

AykutSarac650000790cff
diff --git a/src/containers/Modals/CancelPremiumModal/index.tsx b/src/containers/Modals/CancelPremiumModal/index.tsx
index e83434f2..7568c3f3 100644
--- a/src/containers/Modals/CancelPremiumModal/index.tsx
+++ b/src/containers/Modals/CancelPremiumModal/index.tsx
@@ -19,7 +19,12 @@ export const CancelPremiumModal: React.FC<ModalProps> = ({ opened, onClose }) =>
},
});
- if (error) return toast.error(error.message);
+ if (error) {
+ return toast.error(
+ "An error occured while cancelling subscription, please contact: [email protected]"
+ );
+ }
+
toast.success("Cancelled premium plan!");
} else {
toast.error("Couldn't fetch user details, please contact: [email protected]");
diff --git a/src/containers/Modals/CloudModal/index.tsx b/src/containers/Modals/CloudModal/index.tsx
index 5d0e2758..10a1df04 100644
--- a/src/containers/Modals/CloudModal/index.tsx
+++ b/src/containers/Modals/CloudModal/index.tsx
@@ -83,6 +83,7 @@ const UpdateNameModal: React.FC<{
export const CloudModal: React.FC<ModalProps> = ({ opened, onClose }) => {
const totalQuota = useUser(state => (state.premium ? 200 : 25));
+ const isPremium = useUser(state => state.premium);
const getContents = useFile(state => state.getContents);
const setHasChanges = useFile(state => state.setHasChanges);
const getFormat = useFile(state => state.getFormat);
@@ -92,6 +93,11 @@ export const CloudModal: React.FC<ModalProps> = ({ opened, onClose }) => {
enabled: isReady && opened,
});
+ const isCreateDisabled = React.useMemo(() => {
+ if (!data?.length) return false;
+ return isPremium ? data.length >= 200 : data.length >= 25;
+ }, [isPremium, data?.length]);
+
const onCreate = async () => {
try {
toast.loading("Saving document...", { id: "fileSave" });
@@ -225,7 +231,13 @@ export const CloudModal: React.FC<ModalProps> = ({ opened, onClose }) => {
</Group>
</Paper>
<Paper my="lg" withBorder radius="md" p="xs" w={250}>
- <UnstyledButton fw="bold" w="100%" h="100%" onClick={onCreate}>
+ <UnstyledButton
+ fw="bold"
+ w="100%"
+ h="100%"
+ onClick={onCreate}
+ disabled={isCreateDisabled}
+ >
<Text fz="md" align="center" color="blue">
<Flex align="center" justify="center">
<VscAdd size="24" />