Skip to content

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

feat: remove low traction tools and unused components

AykutSaracc64de4521f86
diff --git a/src/enums/file.enum.ts b/src/enums/file.enum.ts
index 06441ef0..58850b5c 100644
--- a/src/enums/file.enum.ts
+++ b/src/enums/file.enum.ts
@@ -2,7 +2,6 @@ export enum FileFormat {
"JSON" = "json",
"YAML" = "yaml",
"XML" = "xml",
- "TOML" = "toml",
"CSV" = "csv",
}
diff --git a/src/features/editor/Toolbar/ToolsMenu.tsx b/src/features/editor/Toolbar/ToolsMenu.tsx
index 07d48140..754b4f79 100644
--- a/src/features/editor/Toolbar/ToolsMenu.tsx
+++ b/src/features/editor/Toolbar/ToolsMenu.tsx
@@ -1,48 +1,14 @@
import React from "react";
import { Menu, Flex } from "@mantine/core";
-import { JSONSchemaFaker } from "json-schema-faker";
import { event as gaEvent } from "nextjs-google-analytics";
-import toast from "react-hot-toast";
import { CgChevronDown } from "react-icons/cg";
-import { FaRandom } from "react-icons/fa";
import { MdFilterListAlt } from "react-icons/md";
-import { SiJsonwebtokens } from "react-icons/si";
import { VscSearchFuzzy, VscJson, VscGroupByRefType } from "react-icons/vsc";
-import { jsonToContent } from "../../../lib/utils/jsonAdapter";
-import useFile from "../../../store/useFile";
-import useJson from "../../../store/useJson";
import { useModal } from "../../../store/useModal";
import { StyledToolElement } from "./styles";
export const ToolsMenu = () => {
const setVisible = useModal(state => state.setVisible);
- const getJson = useJson(state => state.getJson);
- const setContents = useFile(state => state.setContents);
- const getFormat = useFile(state => state.getFormat);
-
- const randomizeData = async () => {
- try {
- // generate json schema
- const { run } = await import("json_typegen_wasm");
- const jsonSchema = run(
- "Root",
- getJson(),
- JSON.stringify({
- output_mode: "json_schema",
- })
- );
-
- // generate random data
- const randomJson = JSONSchemaFaker.generate(JSON.parse(jsonSchema));
- const contents = await jsonToContent(JSON.stringify(randomJson, null, 2), getFormat());
- setContents({ contents });
-
- gaEvent("randomize_data");
- } catch (error) {
- console.error(error);
- toast.error("Failed to generate mock data");
- }
- };
return (
<Menu shadow="md" withArrow>
@@ -64,16 +30,6 @@ export const ToolsMenu = () => {
>
JSON Query (jq)
</Menu.Item>
- <Menu.Item
- fz={12}
- leftSection={<VscJson />}
- onClick={() => {
- setVisible("SchemaModal", true);
- gaEvent("open_schema_modal");
- }}
- >
- JSON Schema
- </Menu.Item>
<Menu.Item
fz={12}
leftSection={<MdFilterListAlt />}
@@ -84,17 +40,17 @@ export const ToolsMenu = () => {
>
JSON Path
</Menu.Item>
- <Menu.Divider />
<Menu.Item
fz={12}
- leftSection={<SiJsonwebtokens />}
+ leftSection={<VscJson />}
onClick={() => {
- setVisible("JWTModal", true);
- gaEvent("open_jwt_modal");
+ setVisible("SchemaModal", true);
+ gaEvent("open_schema_modal");
}}
>
- Decode JWT
+ JSON Schema
</Menu.Item>
+ <Menu.Divider />
<Menu.Item
fz={12}
leftSection={<VscGroupByRefType />}
@@ -105,9 +61,6 @@ export const ToolsMenu = () => {
>
Generate Type
</Menu.Item>
- <Menu.Item fz={12} leftSection={<FaRandom />} onClick={randomizeData}>
- Randomize Data
- </Menu.Item>
</Menu.Dropdown>
</Menu>
);
diff --git a/src/features/modals/JWTModal/index.tsx b/src/features/modals/JWTModal/index.tsx
deleted file mode 100644
index 66598d36..00000000
--- a/src/features/modals/JWTModal/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import React from "react";
-import type { ModalProps } from "@mantine/core";
-import { Modal, Button, Textarea, Group } from "@mantine/core";
-import { decode } from "jsonwebtoken";
-import { event as gaEvent } from "nextjs-google-analytics";
-import useFile from "../../../store/useFile";
-
-export const JWTModal = ({ opened, onClose }: ModalProps) => {
- const setContents = useFile(state => state.setContents);
- const [token, setToken] = React.useState("");
-
- const resolve = () => {
- if (!token) return;
- const json = decode(token);
- setContents({ contents: JSON.stringify(json, null, 2) });
-
- gaEvent("resolve_jwt");
- setToken("");
- onClose();
- };
-
- return (
- <Modal title="Decode JSON Web Token" opened={opened} onClose={onClose} centered>
- <Textarea
- placeholder="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikhlcm93YW5kIiwidXJsIjoiaHR0cHM6Ly9oZXJvd2FuZC5jb20iLCJpYXQiOjE1MTYyMzkwMjJ9.Tmm3Miq6KWCF_QRn3iERhhXThJzv4LQPKYwBhYUld88"
- value={token}
- onChange={e => setToken(e.target.value)}
- autosize
- minRows={5}
- data-autofocus
- />
- <Group mt="xs" justify="right">
- <Button onClick={resolve} disabled={!token}>
- Resolve
- </Button>
- </Group>
- </Modal>
- );
-};
diff --git a/src/features/modals/SchemaModal/index.tsx b/src/features/modals/SchemaModal/index.tsx
index f3f87736..57333a06 100644
--- a/src/features/modals/SchemaModal/index.tsx
+++ b/src/features/modals/SchemaModal/index.tsx
@@ -1,17 +1,14 @@
import React from "react";
import type { ModalProps } from "@mantine/core";
-import { Stack, Modal, Button, Text, Anchor, Menu, Group, Paper } from "@mantine/core";
+import { Stack, Modal, Button, Text, Anchor, Group, Paper } from "@mantine/core";
import Editor from "@monaco-editor/react";
import { event as gaEvent } from "nextjs-google-analytics";
import { toast } from "react-hot-toast";
-import { FaChevronDown } from "react-icons/fa";
import { VscLinkExternal } from "react-icons/vsc";
-import { FileFormat } from "../../../enums/file.enum";
import useConfig from "../../../store/useConfig";
import useFile from "../../../store/useFile";
export const SchemaModal = ({ opened, onClose }: ModalProps) => {
- const setContents = useFile(state => state.setContents);
const setJsonSchema = useFile(state => state.setJsonSchema);
const darkmodeEnabled = useConfig(state => (state.darkmodeEnabled ? "vs-dark" : "light"));
const [schema, setSchema] = React.useState(
@@ -54,20 +51,6 @@ export const SchemaModal = ({ opened, onClose }: ModalProps) => {
onClose();
};
- const generateMockData = async () => {
- try {
- const { JSONSchemaFaker } = await import("json-schema-faker");
- const data = JSONSchemaFaker.generate(JSON.parse(schema));
- setContents({ contents: JSON.stringify(data, null, 2), format: FileFormat.JSON });
-
- gaEvent("generate_schema_mock_data");
- onClose();
- } catch (error) {
- console.error(error);
- toast.error("Invalid Schema");
- }
- };
-
return (
<Modal title="JSON Schema" size="lg" opened={opened} onClose={onClose} centered>
<Stack>
@@ -101,21 +84,9 @@ export const SchemaModal = ({ opened, onClose }: ModalProps) => {
<Button variant="subtle" color="gray" onClick={onClear} disabled={!schema}>
Clear
</Button>
- <Button.Group>
- <Button variant="default" onClick={onApply} disabled={!schema}>
- Apply
- </Button>
- <Menu>
- <Menu.Target>
- <Button variant="default" color="blue" px="xs" disabled={!schema}>
- <FaChevronDown />
- </Button>
- </Menu.Target>
- <Menu.Dropdown>
- <Menu.Item onClick={generateMockData}>Generate Mock Data</Menu.Item>
- </Menu.Dropdown>
- </Menu>
- </Button.Group>
+ <Button variant="default" onClick={onApply} disabled={!schema}>
+ Apply
+ </Button>
</Group>
</Stack>
</Modal>
diff --git a/src/features/modals/index.ts b/src/features/modals/index.ts
index be818c22..f2e1a506 100644
--- a/src/features/modals/index.ts
+++ b/src/features/modals/index.ts
@@ -1,7 +1,6 @@
export { DownloadModal } from "./DownloadModal";
export { ImportModal } from "./ImportModal";
export { NodeModal } from "./NodeModal";
-export { JWTModal } from "./JWTModal";
export { SchemaModal } from "./SchemaModal";
export { JQModal } from "./JQModal";
export { TypeModal } from "./TypeModal";
diff --git a/src/layout/Landing/LovedBy.tsx b/src/layout/Landing/LovedBy.tsx
deleted file mode 100644
index b59f21cf..00000000
--- a/src/layout/Landing/LovedBy.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-import React from "react";
-import { Button, Container, Flex, Text } from "@mantine/core";
-import styled from "styled-components";
-import CountUp from "react-countup";
-import { FaGithub, FaHackerNews, FaLinkedin, FaProductHunt, FaXTwitter } from "react-icons/fa6";
-
-interface LovedByProps {
- stars: number;
-}
-
-const StyledFeaturedItem = styled.a`
- display: flex;
- gap: 6px;
- align-items: center;
- white-space: nowrap;
- filter: grayscale(1) contrast(0.2);
- transition: filter 0.2s;
-
- &:hover {
- filter: none;
- }
-`;
-
-const Featured = ({ stars }: LovedByProps) => {
- return (
- <Flex align="center" justify="center" gap="lg" wrap="wrap">
- <StyledFeaturedItem
- href="https://github.com/AykutSarac/jsoncrack.com"
- target="_blank"
- rel="noopener"
- >
- <FaGithub color="black" size={28} />
- <Text fz="md" fw={600} c="gray.8">
- <CountUp startVal={0} end={stars} enableScrollSpy scrollSpyOnce scrollSpyDelay={200} />{" "}
- Stars
- </Text>
- </StyledFeaturedItem>
- <StyledFeaturedItem
- href="https://news.ycombinator.com/item?id=32626873"
- target="_blank"
- rel="noopener"
- >
- <FaHackerNews color="#FF6600" size={28} />
- <Text fz="md" fw={600} c="gray.8">
- Hacker News
- </Text>
- </StyledFeaturedItem>
- <StyledFeaturedItem
- href="https://www.producthunt.com/products/JSON-Crack"
- target="_blank"
- rel="noopener"
- >
- <FaProductHunt color="#DA552F" size={28} />
- <Text fz="md" fw={600} c="gray.8">
- Product Hunt
- </Text>
- </StyledFeaturedItem>
- </Flex>
- );
-};
-
-export const LovedBy = ({ stars }: LovedByProps) => {
- return (
- <Container pos="relative" mx="auto" pb="20" pt={60}>
- <Featured stars={stars} />
- <Flex wrap="wrap" justify="center" gap="md" mt="md">
- <Button
- component="a"
- href="https://twitter.com/intent/post?text=Looking%20to%20understand%20or%20explore%20some%20JSON%3F%20Just%20paste%20or%20upload%20to%20visualize%20it%20as%20a%20graph%20with%20https%3A%2F%2Fjsoncrack.com%20%F0%9F%98%8D%20"
- target="_blank"
- color="black"
- leftSection={<FaXTwitter />}
- rel="noopener"
- >
- Share on X
- </Button>
- <Button
- component="a"
- href="https://www.linkedin.com/feed/?shareActive=true&text=Looking%20to%20understand%20or%20explore%20some%20JSON%3F%20Just%20paste%20or%20upload%20to%20visualize%20it%20as%20a%20graph%20with%20https%3A%2F%2Fjsoncrack.com%20%F0%9F%98%8D%20"
- target="_blank"
- color="#0077B5"
- leftSection={<FaLinkedin />}
- rel="noopener"
- >
- Share on LinkedIn
- </Button>
- </Flex>
- </Container>
- );
-};
-
-// interface TweetCardProps {
-// username: string;
-// handle: string;
-// profileImage: string;
-// tweet: string;
-// tweetId: string;
-// verified?: "company" | "individual";
-// }
-//
-// const TweetCard = ({
-// profileImage,
-// handle,
-// tweetId,
-// tweet,
-// username,
-// verified,
-// }: TweetCardProps) => {
-// return (
-// <Paper p="sm" w="fit-content" withBorder radius="md" bg="gray.0" miw={300} maw={450}>
-// <Flex justify="space-between">
-// <Link href={`https://twitter.com/${handle}`} target="_blank">
-// <Flex align="flex-start" gap="sm" direction="row">
-// <Avatar src={profileImage} w={40} h={40} alt={handle} />
-// <Stack gap={0}>
-// <Flex align="center" gap={2}>
-// <Text c="dark" fz="sm" fw={500}>
-// {username}
-// </Text>
-// {verified && (
-// <VscVerifiedFilled color={verified === "company" ? "#ECCC4B" : "#1D9BF0"} />
-// )}
-// </Flex>
-// <Text fz="xs" c="gray.6">
-// @{handle}
-// </Text>
-// </Stack>
-// </Flex>
-// </Link>
-// <Link title="twitter" target="_blank" href={`https://x.com/${handle}/status/${tweetId}`}>
-// <FaTwitter color="#1EA1F1" size={20} />
-// </Link>
-// </Flex>
-// <Text fz="sm" c="gray.8" mt="lg">
-// {tweet}
-// </Text>
-// </Paper>
-// );
-// };
diff --git a/src/layout/PageLayout/Footer.tsx b/src/layout/PageLayout/Footer.tsx
index 88545bd2..d4ce1ba1 100644
--- a/src/layout/PageLayout/Footer.tsx
+++ b/src/layout/PageLayout/Footer.tsx
@@ -1,7 +1,6 @@
import React from "react";
import Link from "next/link";
import { Anchor, Container, Divider, Flex, Stack, Text, ThemeIcon } from "@mantine/core";
-import dayjs from "dayjs";
import { FaDiscord, FaGithub, FaLinkedin } from "react-icons/fa";
import { FaXTwitter } from "react-icons/fa6";
import { JSONCrackLogo } from "../JsonCrackLogo";
@@ -105,7 +104,7 @@ export const Footer = () => {
</Flex>
<Flex gap="xl">
<Text fz="sm" c="dimmed">
- © {dayjs().get("year")} JSON Crack
+ © {new Date().getFullYear()} JSON Crack
</Text>
<Anchor component={Link} prefetch={false} fz="sm" c="dimmed" href="/legal/terms">
<Text fz="sm" c="dimmed">
diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx
index 4ecf259b..726115f6 100644
--- a/src/pages/editor.tsx
+++ b/src/pages/editor.tsx
@@ -4,10 +4,8 @@ import { useRouter } from "next/router";
import { useMantineColorScheme } from "@mantine/core";
import "@mantine/dropzone/styles.css";
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 "../constants/seo";
import { darkTheme, lightTheme } from "../constants/theme";
@@ -22,15 +20,6 @@ import useFile from "../store/useFile";
const ModalController = dynamic(() => import("../features/modals/ModalController"));
const ExternalMode = dynamic(() => import("../features/editor/ExternalMode"));
-const queryClient = new QueryClient({
- defaultOptions: {
- queries: {
- refetchOnWindowFocus: false,
- retry: false,
- },
- },
-});
-
export const StyledPageWrapper = styled.div`
display: flex;
flex-direction: column;
@@ -97,35 +86,33 @@ const EditorPage = () => {
canonical="https://jsoncrack.com/editor"
/>
<ThemeProvider theme={darkmodeEnabled ? darkTheme : lightTheme}>
- <QueryClientProvider client={queryClient}>
- <ExternalMode />
- <ModalController />
- <StyledEditorWrapper>
- <StyledPageWrapper>
- {process.env.NEXT_PUBLIC_DISABLE_EXTERNAL_MODE === "true" ? null : <Banner />}
- <Toolbar />
- <StyledEditorWrapper>
- <StyledEditor proportionalLayout={false}>
- <Allotment.Pane
- preferredSize={450}
- minSize={fullscreen ? 0 : 300}
- maxSize={800}
- visible={!fullscreen}
- >
- <StyledTextEditor>
- <TextEditor />
- <BottomBar />
- </StyledTextEditor>
- </Allotment.Pane>
- <Allotment.Pane minSize={0}>
- <LiveEditor />
- </Allotment.Pane>
- </StyledEditor>
- <FullscreenDropzone />
- </StyledEditorWrapper>
- </StyledPageWrapper>
- </StyledEditorWrapper>
- </QueryClientProvider>
+ <ExternalMode />
+ <ModalController />
+ <StyledEditorWrapper>
+ <StyledPageWrapper>
+ {process.env.NEXT_PUBLIC_DISABLE_EXTERNAL_MODE === "true" ? null : <Banner />}
+ <Toolbar />
+ <StyledEditorWrapper>
+ <StyledEditor proportionalLayout={false}>
+ <Allotment.Pane
+ preferredSize={450}
+ minSize={fullscreen ? 0 : 300}
+ maxSize={800}
+ visible={!fullscreen}
+ >
+ <StyledTextEditor>
+ <TextEditor />
+ <BottomBar />
+ </StyledTextEditor>
+ </Allotment.Pane>
+ <Allotment.Pane minSize={0}>
+ <LiveEditor />
+ </Allotment.Pane>
+ </StyledEditor>
+ <FullscreenDropzone />
+ </StyledEditorWrapper>
+ </StyledPageWrapper>
+ </StyledEditorWrapper>
</ThemeProvider>
</>
);