✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
feat: display external host warning
AykutSaracc477a679e441
diff --git a/src/components/DevMode/index.tsx b/src/components/DevMode/index.tsxnew file mode 100644index 00000000..7d170293--- /dev/null+++ b/src/components/DevMode/index.tsx@@ -0,0 +1,86 @@+import React from "react";+import styled from "styled-components";+import { Anchor, Button, Group, Modal, Text } from "@mantine/core";+import { VscCode } from "react-icons/vsc";++const StyledAlert = styled.div`+ position: fixed;+ bottom: 60px;+ right: 20px;+ background: rgba(255, 255, 255, 0.2);+ border-radius: 16px;+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);+ backdrop-filter: blur(5px);+ -webkit-backdrop-filter: blur(5px);+ border: 1px solid rgba(255, 255, 255, 0.3);+ font-weight: 500;+ overflow: hidden;+`;++const StyledTitle = styled.div`+ display: flex;+ align-items: center;+ color: ${({ theme }) => theme.TEXT_POSITIVE};+ flex: 1;+ font-weight: 700;++ &::after {+ background: ${({ theme }) => theme.TEXT_POSITIVE};+ height: 1px;++ content: "";+ -webkit-box-flex: 1;+ -ms-flex: 1 1 auto;+ flex: 1 1 auto;+ margin-left: 4px;+ opacity: 0.6;+ }+`;++const isExternal = () => {+ if (window.location.pathname.includes("widget")) return false;+ if (window.location.host !== "jsoncrack.com") return true;+ return false;+};++export const ExternalMode = () => {+ const [isOpen, setOpen] = React.useState(false);+ if (!isExternal()) return null;++ const closeModal = () => setOpen(false);++ return (+ <StyledAlert>+ <Button+ onClick={() => setOpen(true)}+ color="red"+ variant="subtle"+ leftIcon={<VscCode size="1.2rem" />}+ >+ External Host+ </Button>+ <Modal title="External Host of JSON Crack" opened={isOpen} onClose={closeModal} centered>+ <Group>+ <StyledTitle>Hi! Did you like the editor?</StyledTitle>+ <Text>+ You are currently using the external release of the{" "}+ <Anchor href="https://jsoncrack.com">JSON Crack</Anchor>. Please consider supporting by+ one time or monthly sponsorship ✨+ </Text>+ </Group>+ <Group pt="lg" position="right">+ <Button+ onClick={closeModal}+ component="a"+ href="https://github.com/sponsors/AykutSarac"+ target="_blank"+ variant="light"+ color="red"+ >+ Donate+ </Button>+ </Group>+ </Modal>+ </StyledAlert>+ );+};diff --git a/src/pages/_app.tsx b/src/pages/_app.tsxindex 61a42fc9..64d5e364 100644--- a/src/pages/_app.tsx+++ b/src/pages/_app.tsx@@ -6,6 +6,7 @@ import { MantineProvider } from "@mantine/core";import { init } from "@sentry/nextjs";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { Toaster } from "react-hot-toast";+import { ExternalMode } from "src/components/DevMode";import { GoogleAnalytics } from "src/components/GoogleAnalytics";import GlobalStyle from "src/constants/globalStyle";import { darkTheme, lightTheme } from "src/constants/theme";@@ -50,7 +51,6 @@ function JsonCrack({ Component, pageProps }: AppProps) {<GoogleAnalytics /><ThemeProvider theme={lightmode ? lightTheme : darkTheme}><GlobalStyle />- {}<MantineProviderwithGlobalStyleswithNormalizeCSS@@ -105,6 +105,7 @@ function JsonCrack({ Component, pageProps }: AppProps) {},}}/>+ <ExternalMode /></MantineProvider></ThemeProvider></QueryClientProvider>