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: display ads at editor

AykutSaracbde046a4f4ec
diff --git a/src/components/CarbonAds/index.tsx b/src/components/CarbonAds/index.tsx
index fafbc6f9..fe50f62b 100644
--- a/src/components/CarbonAds/index.tsx
+++ b/src/components/CarbonAds/index.tsx
@@ -1,15 +1,21 @@
import React from "react";
+import useUser from "src/store/useUser";
export const CarbonAds = () => {
const ref = React.useRef<HTMLDivElement>(null!);
+ const premium = useUser(state => state.isPremium());
React.useEffect(() => {
- ref.current.innerHTML = "";
- const s = document.createElement("script");
- s.id = "_carbonads_js";
- s.src = `//cdn.carbonads.com/carbon.js?serve=CE7IPKQL&placement=jsoncrackcom`;
- ref.current.appendChild(s);
- }, []);
+ if (!premium) {
+ ref.current.innerHTML = "";
+ const s = document.createElement("script");
+ s.id = "_carbonads_js";
+ s.src = `//cdn.carbonads.com/carbon.js?serve=CE7IPKQL&placement=jsoncrackcom`;
+ ref.current.appendChild(s);
+ }
+ }, [premium]);
+
+ if (premium) return null;
return <div ref={ref} className="carbon-outer" />;
};
diff --git a/src/components/DevMode/index.tsx b/src/components/DevMode/index.tsx
index 7d170293..bd99f68c 100644
--- a/src/components/DevMode/index.tsx
+++ b/src/components/DevMode/index.tsx
@@ -5,8 +5,8 @@ import { VscCode } from "react-icons/vsc";
const StyledAlert = styled.div`
position: fixed;
- bottom: 60px;
- right: 20px;
+ bottom: 36px;
+ right: 10px;
background: rgba(255, 255, 255, 0.2);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
diff --git a/src/components/Graph/PremiumView.tsx b/src/components/Graph/PremiumView.tsx
index f74a52b5..5b35b950 100644
--- a/src/components/Graph/PremiumView.tsx
+++ b/src/components/Graph/PremiumView.tsx
@@ -166,6 +166,7 @@ export const PremiumView = () => (
<List.Item>JSON Schema support</List.Item>
<List.Item>Visualize data at full capability</List.Item>
<List.Item>Save & share up to 200 files</List.Item>
+ <List.Item>No Ads</List.Item>
<List.Item
icon={
<ThemeIcon color="dark.4" size={20} radius="xl">
diff --git a/src/components/MonacoEditor/index.tsx b/src/components/MonacoEditor/index.tsx
index e19156ea..e295b5b0 100644
--- a/src/components/MonacoEditor/index.tsx
+++ b/src/components/MonacoEditor/index.tsx
@@ -4,6 +4,7 @@ import Editor, { loader, Monaco, useMonaco } from "@monaco-editor/react";
import { Loading } from "src/layout/Loading";
import useFile from "src/store/useFile";
import useStored from "src/store/useStored";
+import { CarbonAds } from "../CarbonAds";
loader.config({
paths: {
@@ -21,7 +22,7 @@ const editorOptions = {
const StyledWrapper = styled.div`
display: grid;
- height: calc(100vh - 36px);
+ height: calc(100vh - 63px);
grid-template-columns: 100%;
grid-template-rows: minmax(0, 1fr);
`;
@@ -92,6 +93,7 @@ export const MonacoEditor = () => {
language="json"
height="100%"
/>
+ <CarbonAds />
</StyledWrapper>
);
};
diff --git a/src/components/SupportButton/index.tsx b/src/components/SupportButton/index.tsx
deleted file mode 100644
index b36769ef..00000000
--- a/src/components/SupportButton/index.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import React from "react";
-import styled from "styled-components";
-import { HiHeart } from "react-icons/hi";
-
-const StyledText = styled.span`
- white-space: nowrap;
- opacity: 0;
- width: 0px;
- transition: 0.2s;
- font-weight: 600;
-`;
-
-const StyledSupportButton = styled.a`
- position: fixed;
- display: flex;
- justify-content: center;
- align-items: center;
- color: white;
- right: 15px;
- bottom: 15px;
- border-radius: 50%;
- width: 24px;
- padding: 8px;
- height: 24px;
- background: ${({ theme }) => theme.DANGER};
- transition: all 0.5s;
- overflow: hidden;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.07),
- 0 4px 8px rgba(0, 0, 0, 0.07), 0 8px 16px rgba(0, 0, 0, 0.07), 0 16px 32px rgba(0, 0, 0, 0.07),
- 0 32px 64px rgba(0, 0, 0, 0.07);
- opacity: 0.7;
- box-sizing: content-box !important;
-
- &:hover {
- width: 180px;
- border-radius: 6px;
-
- ${StyledText} {
- opacity: 1;
- width: fit-content;
- margin-right: 8px;
- }
- }
-`;
-
-export const SupportButton = () => {
- return (
- <StyledSupportButton href="https://github.com/sponsors/AykutSarac" target="_blank" rel="me">
- <StyledText>Support JSON Crack</StyledText>
- <HiHeart size={25} />
- </StyledSupportButton>
- );
-};
diff --git a/src/constants/globalStyle.ts b/src/constants/globalStyle.ts
index b96e9fa9..833029a9 100644
--- a/src/constants/globalStyle.ts
+++ b/src/constants/globalStyle.ts
@@ -62,12 +62,12 @@ const GlobalStyle = createGlobalStyle`
#carbonads {
--carbon-font-size: 16px;
--carbon-padding-size: 12px;
- border-radius: 4px;
- overflow: hidden;
}
#carbonads {
- display: inline-block;
+ width: 100%;
+ z-index: 100;
+ display: block;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue',
@@ -77,9 +77,8 @@ const GlobalStyle = createGlobalStyle`
#carbonads > span {
min-width: 18.75em;
- max-width: clamp(18.75em, 22.5em, 24.5em);
min-height: 100px;
- background-color: ${({ theme }) => theme.BACKGROUND_SECONDARY};
+ background-color: hsl(0, 0%, 10%);
box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.085),
0 0 2px hsl(0deg 0% 0% / 0.085),
0 0 4px hsl(0deg 0% 0% / 0.085),
@@ -88,11 +87,11 @@ const GlobalStyle = createGlobalStyle`
#carbonads a {
text-decoration: none;
- color: ${({ theme }) => theme.INTERACTIVE_NORMAL};
+ color: #ddd;
}
#carbonads a:hover {
- color: ${({ theme }) => theme.INTERACTIVE_HOVER};
+ color: #ddd;
}
#carbonads span {
@@ -125,8 +124,8 @@ const GlobalStyle = createGlobalStyle`
#carbonads .carbon-poweredby {
display: block;
padding: 6px 8px;
- color: ${({ theme }) => theme.TEXT_NORMAL};
- background: ${({ theme }) => theme.BACKGROUND_TERTIARY};
+ color: #aaa;
+ background: #1e2021;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.1ch;
@@ -138,6 +137,7 @@ const GlobalStyle = createGlobalStyle`
bottom: 0;
right: 0;
}
+
`;
export default GlobalStyle;
diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx
index be4efb57..05634c41 100644
--- a/src/containers/Home/index.tsx
+++ b/src/containers/Home/index.tsx
@@ -16,7 +16,6 @@ import { SiVisualstudiocode } from "react-icons/si";
import vscDarkPlus from "react-syntax-highlighter/dist/cjs/styles/prism/vsc-dark-plus";
import { CarbonAds } from "src/components/CarbonAds";
import { Sponsors } from "src/components/Sponsors";
-import { SupportButton } from "src/components/SupportButton";
import { baseURL } from "src/constants/data";
import { TABS } from "src/constants/previewSection";
import { Footer } from "src/layout/Footer";
@@ -302,7 +301,6 @@ const Home: React.FC = () => {
<GitHubSection />
<EmbedSection />
<SponsorSection />
- <SupportButton />
<Footer />
</Styles.StyledHome>
);
diff --git a/src/containers/Modals/PremiumModal/index.tsx b/src/containers/Modals/PremiumModal/index.tsx
index 2e81fd37..f48eba23 100644
--- a/src/containers/Modals/PremiumModal/index.tsx
+++ b/src/containers/Modals/PremiumModal/index.tsx
@@ -72,7 +72,8 @@ export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
>
<List.Item>JSON Schema support</List.Item>
<List.Item>Visualize data at full capability</List.Item>
- <List.Item>Save up to 200 files</List.Item>
+ <List.Item>Save & share up to 200 files</List.Item>
+ <List.Item>No Ads</List.Item>
<List.Item
icon={
<ThemeIcon color="dark.5" size={20} radius="xl">