feat: ui updates

This commit is contained in:
AykutSarac 2024-04-26 23:26:49 +03:00
parent ebbfaf8ce6
commit f7c3ba1976
No known key found for this signature in database
6 changed files with 31 additions and 12 deletions

View File

@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { Modal, Stack, Button, Text, Title, ModalProps } from "@mantine/core"; import { Modal, Stack, Button, Text, ModalProps } from "@mantine/core";
export const LoginModal: React.FC<ModalProps> = ({ opened, onClose }) => { export const LoginModal: React.FC<ModalProps> = ({ opened, onClose }) => {
return ( return (
<Modal title="Sign In" opened={opened} onClose={onClose} centered> <Modal title="Sign In" opened={opened} onClose={onClose} centered>
<Stack py="sm"> <Stack py="sm">
<Title order={2}>Welcome Back!</Title>
<Text>Login to unlock full potential of JSON Crack!</Text> <Text>Login to unlock full potential of JSON Crack!</Text>
<Button component="a" href="https://app.jsoncrack.com/sign-in" size="md" fullWidth> <Button component="a" href="https://app.jsoncrack.com/sign-in" size="md" fullWidth>
Sign In Sign In

View File

@ -1,7 +1,9 @@
import React from "react"; import React from "react";
import { Modal, Stack, Text, ScrollArea, ModalProps } from "@mantine/core"; import { Modal, Stack, Text, ScrollArea, ModalProps, Button } from "@mantine/core";
import { CodeHighlight } from "@mantine/code-highlight"; import { CodeHighlight } from "@mantine/code-highlight";
import { VscLock } from "react-icons/vsc";
import useGraph from "src/store/useGraph"; import useGraph from "src/store/useGraph";
import useModal from "src/store/useModal";
const dataToString = (data: any) => { const dataToString = (data: any) => {
const text = Array.isArray(data) ? Object.fromEntries(data) : data; const text = Array.isArray(data) ? Object.fromEntries(data) : data;
@ -14,6 +16,7 @@ const dataToString = (data: any) => {
}; };
export const NodeModal: React.FC<ModalProps> = ({ opened, onClose }) => { export const NodeModal: React.FC<ModalProps> = ({ opened, onClose }) => {
const setVisible = useModal(state => state.setVisible);
const nodeData = useGraph(state => dataToString(state.selectedNode?.text)); const nodeData = useGraph(state => dataToString(state.selectedNode?.text));
const path = useGraph(state => state.selectedNode?.path || ""); const path = useGraph(state => state.selectedNode?.path || "");
@ -28,8 +31,14 @@ export const NodeModal: React.FC<ModalProps> = ({ opened, onClose }) => {
<CodeHighlight code={nodeData} miw={350} maw={600} language="json" withCopyButton /> <CodeHighlight code={nodeData} miw={350} maw={600} language="json" withCopyButton />
</ScrollArea.Autosize> </ScrollArea.Autosize>
</Stack> </Stack>
<Button
onClick={() => setVisible("premium")(true)}
rightSection={<VscLock strokeWidth={0.5} />}
>
Edit
</Button>
<Text fz="sm" fw={700}> <Text fz="sm" fw={700}>
Node Path JSON Path
</Text> </Text>
<ScrollArea.Autosize maw={600}> <ScrollArea.Autosize maw={600}>
<CodeHighlight <CodeHighlight

View File

@ -15,7 +15,7 @@ import { BsCheck } from "react-icons/bs";
export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => { export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
return ( return (
<Modal title="Your Plan" size="auto" opened={opened} onClose={onClose} centered zIndex={202}> <Modal title="Upgrade Plan" size="auto" opened={opened} onClose={onClose} centered zIndex={202}>
<Flex gap="lg" justify="center" px="md"> <Flex gap="lg" justify="center" px="md">
<Stack gap="xs"> <Stack gap="xs">
<Title order={3}>Free plan</Title> <Title order={3}>Free plan</Title>
@ -62,10 +62,10 @@ export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
</ThemeIcon> </ThemeIcon>
} }
> >
<List.Item>5X Faster visualizations, no freezing</List.Item> <List.Item>5X Faster visualizations, no lagging</List.Item>
<List.Item>Accurate and compact graphs</List.Item> <List.Item>Accurate and compact graphs</List.Item>
<List.Item>Edit data through visualizations</List.Item> <List.Item>Edit data through visualizations</List.Item>
<List.Item>Bigger data support</List.Item> <List.Item>Visualize data up to 5 MBs</List.Item>
<List.Item>Compare data on graphs</List.Item> <List.Item>Compare data on graphs</List.Item>
<List.Item>Save & share up to 200 files</List.Item> <List.Item>Save & share up to 200 files</List.Item>
</List> </List>

View File

@ -1,8 +1,9 @@
import React from "react"; import React from "react";
import { Menu, Flex } from "@mantine/core"; import { Menu, Flex } from "@mantine/core";
import { CgChevronDown } from "react-icons/cg"; import { CgChevronDown } from "react-icons/cg";
import { MdCompare } from "react-icons/md";
import { SiJsonwebtokens } from "react-icons/si"; import { SiJsonwebtokens } from "react-icons/si";
import { VscSearchFuzzy, VscJson, VscGroupByRefType } from "react-icons/vsc"; import { VscSearchFuzzy, VscJson, VscGroupByRefType, VscLock } from "react-icons/vsc";
import { gaEvent } from "src/lib/utils/gaEvent"; import { gaEvent } from "src/lib/utils/gaEvent";
import useModal from "src/store/useModal"; import useModal from "src/store/useModal";
import * as Styles from "./styles"; import * as Styles from "./styles";
@ -20,6 +21,14 @@ export const ToolsMenu = () => {
</Styles.StyledToolElement> </Styles.StyledToolElement>
</Menu.Target> </Menu.Target>
<Menu.Dropdown> <Menu.Dropdown>
<Menu.Item
fz={12}
leftSection={<MdCompare />}
rightSection={<VscLock />}
onClick={() => setVisible("premium")(true)}
>
Compare Data
</Menu.Item>
<Menu.Item fz={12} leftSection={<VscSearchFuzzy />} onClick={() => setVisible("jq")(true)}> <Menu.Item fz={12} leftSection={<VscSearchFuzzy />} onClick={() => setVisible("jq")(true)}>
JSON Query (jq) JSON Query (jq)
</Menu.Item> </Menu.Item>

View File

@ -138,10 +138,12 @@ const GraphCanvas = ({ isWidget }: GraphProps) => {
); );
}; };
const SUPPORTED_LIMIT = 600;
export const Graph = ({ isWidget = false }: GraphProps) => { export const Graph = ({ isWidget = false }: GraphProps) => {
const setViewPort = useGraph(state => state.setViewPort); const setViewPort = useGraph(state => state.setViewPort);
const viewPort = useGraph(state => state.viewPort); const viewPort = useGraph(state => state.viewPort);
const aboveSupportedLimit = useGraph(state => state.nodes.length > 800); const aboveSupportedLimit = useGraph(state => state.nodes.length > SUPPORTED_LIMIT);
const loading = useGraph(state => state.loading); const loading = useGraph(state => state.loading);
const gesturesEnabled = useConfig(state => state.gesturesEnabled); const gesturesEnabled = useConfig(state => state.gesturesEnabled);
const rulersEnabled = useConfig(state => state.rulersEnabled); const rulersEnabled = useConfig(state => state.rulersEnabled);

View File

@ -60,7 +60,7 @@ export const PricingCards = () => {
size="md" size="md"
data={["Monthly", "Yearly"]} data={["Monthly", "Yearly"]}
w={200} w={200}
radius="lg" radius="xl"
/> />
</Center> </Center>
<Flex gap="lg" wrap="wrap" justify="center" w="fit-content" p="lg" mx="auto" maw="100%"> <Flex gap="lg" wrap="wrap" justify="center" w="fit-content" p="lg" mx="auto" maw="100%">
@ -140,8 +140,8 @@ export const PricingCards = () => {
<StyledPaper> <StyledPaper>
<Flex justify="space-between"> <Flex justify="space-between">
<Stack gap="0"> <Stack gap="0">
<Badge mb="lg" size="lg" variant="outline" color="gray.3" c="dark" leftSection="✦"> <Badge mb="lg" size="lg" variant="filled" color="violet" c="white" leftSection="✦">
Premium Popular
</Badge> </Badge>
<Flex gap="xs" align="baseline"> <Flex gap="xs" align="baseline">