Skip to content

Commit 8a933f1

Browse files
committed
feat: update modal UI
1 parent 3e9d2f5 commit 8a933f1

File tree

4 files changed

+105
-49
lines changed

4 files changed

+105
-49
lines changed

src/features/editor/Toolbar/index.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Flex, Group, Select, Button } from "@mantine/core";
44
import styled from "styled-components";
55
import toast from "react-hot-toast";
66
import { AiOutlineFullscreen } from "react-icons/ai";
7-
import { FaGithub } from "react-icons/fa6";
7+
import { FaBolt, FaGithub } from "react-icons/fa6";
88
import { type FileFormat, formats } from "../../../enums/file.enum";
99
import { JSONCrackLogo } from "../../../layout/JsonCrackLogo";
1010
import useFile from "../../../store/useFile";
@@ -71,18 +71,19 @@ export const Toolbar = () => {
7171
<ViewMenu />
7272
<ToolsMenu />
7373
<Button
74-
color="teal"
7574
autoContrast
75+
variant="outline"
76+
color="gray"
7677
size="compact-sm"
7778
fz="12"
7879
fw="600"
7980
onClick={() => setVisible("UpgradeModal", true)}
80-
leftSection={"⚡️"}
81+
leftSection={<FaBolt />}
8182
>
82-
Try New Editor
83+
JSON Crack v2.0
8384
</Button>
8485
</Group>
85-
<Group gap="6" justify="right" w="100%" style={{ flexWrap: "nowrap" }}>
86+
<Group gap="xs" justify="right" w="100%" style={{ flexWrap: "nowrap" }}>
8687
<Link href="https://github.com/AykutSarac/jsoncrack.com" rel="noopener" target="_blank">
8788
<StyledToolElement title="GitHub">
8889
<FaGithub size="18" />

src/features/editor/views/GraphView/NotSupported.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import Link from "next/link";
33
import { Button, Text } from "@mantine/core";
44
import styled from "styled-components";
5-
import { LuZap } from "react-icons/lu";
65
import { UpgradeContent } from "../../../modals/UpgradeModal";
76

87
const StyledNotSupported = styled.div`
@@ -145,7 +144,7 @@ export const NotSupported = () => {
145144
return (
146145
<StyledNotSupported>
147146
<StyledContent>
148-
<UpgradeContent direction="column-reverse" />
147+
<UpgradeContent direction="column-reverse" maw="550" />
149148
<Text c="dimmed" maw="400" my="lg" ta="center">
150149
JSON Crack is unable to support data of this size. <br />
151150
Try the new editor for better performance.
@@ -156,8 +155,8 @@ export const NotSupported = () => {
156155
target="_blank"
157156
passHref
158157
>
159-
<Button size="lg" color="teal" leftSection={<LuZap />} radius="xl">
160-
Try new editor &rarr;
158+
<Button size="lg" color="teal" radius="xl">
159+
Upgrade now
161160
</Button>
162161
</Link>
163162
</StyledContent>

src/features/modals/UpgradeModal/index.tsx

+91-35
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,31 @@ import {
1515
Box,
1616
CloseButton,
1717
FocusTrap,
18+
Stack,
19+
Paper,
1820
} from "@mantine/core";
1921
import Cookie from "js-cookie";
20-
import { LuCheck, LuZap } from "react-icons/lu";
22+
import { GoDependabot } from "react-icons/go";
23+
import {
24+
LuCheck,
25+
LuChevronRight,
26+
LuGitCompareArrows,
27+
LuInfinity,
28+
LuPencilRuler,
29+
} from "react-icons/lu";
2130
import useConfig from "../../../store/useConfig";
2231

2332
export const UpgradeContent = (props: FlexProps) => {
2433
const darkmodeEnabled = useConfig(state => state.darkmodeEnabled);
2534

2635
return (
2736
<Flex direction="column" gap="0" {...props}>
28-
<Flex justify="center" gap="60" px="sm">
37+
<Flex justify="space-between" gap="4" px="sm" wrap="wrap">
2938
<List
3039
center
3140
c="bright"
3241
fz="lg"
33-
spacing="xs"
42+
spacing="4"
3443
icon={
3544
<ThemeIcon color="green" variant="transparent">
3645
<LuCheck size="18" />
@@ -45,7 +54,7 @@ export const UpgradeContent = (props: FlexProps) => {
4554
center
4655
c="bright"
4756
fz="lg"
48-
spacing="xs"
57+
spacing="4"
4958
icon={
5059
<ThemeIcon color="green" variant="transparent">
5160
<LuCheck size="18" />
@@ -71,7 +80,6 @@ export const UpgradeContent = (props: FlexProps) => {
7180
<Image
7281
src={`/assets/diagram-${darkmodeEnabled ? "dark" : "light"}.png`}
7382
alt="diagram"
74-
mah="120"
7583
fit="cover"
7684
mx="auto"
7785
width="auto"
@@ -86,6 +94,26 @@ export const UpgradeContent = (props: FlexProps) => {
8694
);
8795
};
8896

97+
const FeatureCard = (props: { title: string; description: string; icon: React.ReactNode }) => {
98+
return (
99+
<Paper withBorder p="xs" radius="md">
100+
<Flex gap="md" align="flex-start">
101+
<ThemeIcon variant="light" color="teal" radius="xl" size="36">
102+
{props.icon}
103+
</ThemeIcon>
104+
<Stack gap="4">
105+
<Text fz="md" fw="600" c="bright">
106+
{props.title}
107+
</Text>
108+
<Text fz="sm" c="gray" opacity={0.8}>
109+
{props.description}
110+
</Text>
111+
</Stack>
112+
</Flex>
113+
</Paper>
114+
);
115+
};
116+
89117
export const UpgradeModal = ({ opened, onClose }: ModalProps) => {
90118
const handleCloseModal = () => {
91119
Cookie.set("upgrade_shown", "true", { expires: 3 });
@@ -94,46 +122,74 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => {
94122

95123
return (
96124
<Modal
97-
size="lg"
125+
size="xl"
98126
opened={opened}
99127
onClose={handleCloseModal}
100128
zIndex={1001}
101129
centered
102130
radius="md"
103131
overlayProps={{ blur: 2 }}
104132
withCloseButton={false}
105-
closeOnClickOutside={false}
106133
>
107134
<FocusTrap.InitialFocus />
108-
<Flex justify="center" align="center" gap="xs">
109-
<Image
110-
ml="auto"
111-
pl="28"
112-
src="https://todiagram.com/logo-64x64.png"
113-
alt="todiagram"
114-
width={30}
115-
height={30}
116-
/>
117-
<Text fz="24" fw="600" c="bright">
118-
Try JSON Crack 2.0
119-
</Text>
120-
<CloseButton ml="auto" onClick={handleCloseModal} />
135+
<Flex>
136+
<Stack>
137+
<FeatureCard
138+
title="No File Size Limits"
139+
description="Load and edit even the largest data files without restrictions."
140+
icon={<LuInfinity size={20} />}
141+
/>
142+
<FeatureCard
143+
title="Visual Data Editing"
144+
description="Edit JSON, YAML, CSV, and XML directly on the diagram."
145+
icon={<LuPencilRuler size={20} />}
146+
/>
147+
<FeatureCard
148+
title="Live JSON Schema Validation"
149+
description="Instantly see invalid fields highlighted in red on the diagram."
150+
icon={<LuGitCompareArrows size={20} />}
151+
/>
152+
<FeatureCard
153+
title="AI Assistant"
154+
description="Use AI to filter and transform data based on your needs."
155+
icon={<GoDependabot size={20} />}
156+
/>
157+
</Stack>
158+
<Divider orientation="vertical" mx="md" />
159+
<Box>
160+
<Flex justify="center" align="center" gap="xs">
161+
<Image
162+
ml="auto"
163+
pl="28"
164+
src="https://todiagram.com/logo-64x64.png"
165+
alt="todiagram"
166+
width={30}
167+
height={30}
168+
/>
169+
<Text fz="24" fw="600" c="bright">
170+
JSON Crack 2.0
171+
</Text>
172+
<CloseButton ml="auto" onClick={handleCloseModal} />
173+
</Flex>
174+
<UpgradeContent direction="column-reverse" maw="400" />
175+
<Group justify="center" gap="xs" mt="md">
176+
<Button
177+
component={Link}
178+
href="https://todiagram.com/editor?utm_source=jsoncrack&utm_medium=upgrade_modal"
179+
rel="noopener"
180+
target="_blank"
181+
fz="lg"
182+
fw="600"
183+
size="md"
184+
rightSection={<LuChevronRight />}
185+
color="green"
186+
fullWidth
187+
>
188+
Try now
189+
</Button>
190+
</Group>
191+
</Box>
121192
</Flex>
122-
<UpgradeContent direction="column-reverse" />
123-
<Group justify="center" gap="lg" mt="xl">
124-
<Button size="md" onClick={handleCloseModal} color="gray" variant="light">
125-
Maybe later
126-
</Button>
127-
<Link
128-
href="https://todiagram.com/editor?utm_source=jsoncrack&utm_medium=upgrade_modal"
129-
rel="noopener"
130-
target="_blank"
131-
>
132-
<Button size="md" onClick={handleCloseModal} leftSection={<LuZap />} color="teal">
133-
Try for free &rarr;
134-
</Button>
135-
</Link>
136-
</Group>
137193
</Modal>
138194
);
139195
};

src/pages/editor.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import styled, { ThemeProvider } from "styled-components";
77
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
88
import { Allotment } from "allotment";
99
import "allotment/dist/style.css";
10-
import Cookie from "js-cookie";
10+
// import Cookie from "js-cookie";
1111
import { NextSeo } from "next-seo";
1212
import { SEO } from "../constants/seo";
1313
import { darkTheme, lightTheme } from "../constants/theme";
@@ -74,10 +74,10 @@ const EditorPage = () => {
7474
const setVisible = useModal(state => state.setVisible);
7575

7676
useEffect(() => {
77-
const isUpgradeShown = Cookie.get("upgrade_shown");
78-
if (!isUpgradeShown) {
79-
setTimeout(() => setVisible("UpgradeModal", true), 30_000);
80-
}
77+
// const isUpgradeShown = Cookie.get("upgrade_shown");
78+
// if (!isUpgradeShown) {
79+
setTimeout(() => setVisible("UpgradeModal", true), 3_000);
80+
// }
8181
}, [setVisible]);
8282

8383
useEffect(() => {

0 commit comments

Comments
 (0)