Skip to content

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

replace herowand ads to news modal

AykutSarace10cfa6e14f4
diff --git a/src/components/MonacoEditor/index.tsx b/src/components/MonacoEditor/index.tsx
index b36b27e5..c8096651 100644
--- a/src/components/MonacoEditor/index.tsx
+++ b/src/components/MonacoEditor/index.tsx
@@ -1,6 +1,5 @@
import React from "react";
import styled from "styled-components";
-import { Anchor, Paper, Text } from "@mantine/core";
import Editor, { loader, Monaco } from "@monaco-editor/react";
import debounce from "lodash.debounce";
import { Loading } from "src/components/Loading";
@@ -107,14 +106,8 @@ export const MonacoEditor = () => {
loading={<Loading message="Loading Editor..." />}
beforeMount={handleEditorWillMount}
defaultLanguage="json"
- height="82vh"
+ height="100%"
/>
- <Anchor href="https://editor.herowand.com">
- <Paper p="sm" h="80px" shadow="md" withBorder>
- <Text align="center">Visualize other data formats now...</Text>
- <Text align="center">Herowand Editor</Text>
- </Paper>
- </Anchor>
</StyledWrapper>
);
};
diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx
index 2c7022c4..0d4d9d1a 100644
--- a/src/containers/Home/index.tsx
+++ b/src/containers/Home/index.tsx
@@ -3,7 +3,7 @@ import dynamic from "next/dynamic";
import Head from "next/head";
import Link from "next/link";
import Script from "next/script";
-import { Anchor, Button, Image, Paper } from "@mantine/core";
+import { Button } from "@mantine/core";
import { AiOutlineRight, AiTwotoneStar } from "react-icons/ai";
import {
HiCursorClick,
@@ -55,11 +55,6 @@ const HeroSection = () => (
</Button>
</Link>
</Styles.StyledButtonWrapper>
- <Anchor href="https://editor.herowand.com/?ref=jsoncrack" target="_blank">
- <Paper shadow="xs" withBorder>
- <Image src="assets/herowand_banner.webp" width={420} height={100} alt="herowand" />
- </Paper>
- </Anchor>
</Styles.StyledHeroSection>
);
diff --git a/src/containers/Modals/HerowandModal/index.tsx b/src/containers/Modals/HerowandModal/index.tsx
new file mode 100644
index 00000000..2e1d0941
--- /dev/null
+++ b/src/containers/Modals/HerowandModal/index.tsx
@@ -0,0 +1,55 @@
+import React from "react";
+import { Modal, Group, Button, MantineProvider, Image, Text, Paper } from "@mantine/core";
+import { useDebouncedState, useSessionStorage } from "@mantine/hooks";
+
+export const HerowandModal = () => {
+ const [opened, setOpened] = useDebouncedState(false, 600);
+ const [isNewsVisible, setNewsVisible] = useSessionStorage<boolean>({
+ key: "news",
+ defaultValue: true,
+ getInitialValueInEffect: true,
+ });
+
+ React.useEffect(() => {
+ if (isNewsVisible) setOpened(true);
+ else setOpened(false);
+ }, [isNewsVisible, setOpened]);
+
+ const onClose = () => {
+ setNewsVisible(false);
+ setOpened(false);
+ };
+
+ return (
+ <MantineProvider theme={{ colorScheme: "dark" }}>
+ <Modal title="What's New?" opened={opened} onClose={onClose} centered>
+ <Group>
+ <Paper withBorder>
+ <Image
+ radius="md"
+ mx="auto"
+ src="assets/herowand_banner.webp"
+ width={400}
+ alt="herowand"
+ />
+ </Paper>
+ </Group>
+ <Text pt="lg">
+ Introducing you something new...
+ <hr />
+ Herowand Editor - the ultimate tool for visualizing, editing, and sharing data in graph
+ format. Import JSON, YAML, TOML, XML and manipulate data on the graph. Save to cloud,
+ share, download as image, search through graph, accessibility features. Try it now!
+ </Text>
+ <Group pt="lg" position="right">
+ <Button color="red" onClick={onClose}>
+ Dismiss
+ </Button>
+ <Button component="a" href="https://editor.herowand.com/?ref=jsoncrack">
+ Show me!
+ </Button>
+ </Group>
+ </Modal>
+ </MantineProvider>
+ );
+};
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 303ee8ac..d483ebe9 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -10,6 +10,7 @@ import { GoogleAnalytics } from "src/components/GoogleAnalytics";
import GlobalStyle from "src/constants/globalStyle";
import { darkTheme, lightTheme } from "src/constants/theme";
import { ModalController } from "src/containers/ModalController";
+import { HerowandModal } from "src/containers/Modals/HerowandModal";
import useStored from "src/store/useStored";
if (process.env.NODE_ENV !== "development") {
@@ -50,6 +51,7 @@ function JsonCrack({ Component, pageProps }: AppProps) {
<GoogleAnalytics />
<ThemeProvider theme={lightmode ? lightTheme : darkTheme}>
<GlobalStyle />
+ <HerowandModal />
<MantineProvider
withGlobalStyles
withNormalizeCSS
diff --git a/src/store/useModal.tsx b/src/store/useModal.tsx
index b878d2c0..9bbe4ba1 100644
--- a/src/store/useModal.tsx
+++ b/src/store/useModal.tsx
@@ -17,6 +17,7 @@ const initialStates = {
share: false,
login: false,
premium: false,
+ herowand: false,
};
type ModalType = keyof typeof initialStates;