Skip to content

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

Merge branch 'main' into mona-sans

AykutSarac5da20fa5bee8
diff --cc src/containers/Home/index.tsx
index c987cd5e,8c183e7c..563ae0a9
--- a/src/containers/Home/index.tsx
+++ b/src/containers/Home/index.tsx
@@@ -208,18 -194,16 +207,25 @@@ const EmbedSection = () =>
<Styles.StyledSectionArea>
<Styles.StyledSubTitle>Embed Into Your Website</Styles.StyledSubTitle>
<Styles.StyledMinorTitle>
- Easily embed the JSON Crack graph into your website to showcase your
- visitors, blog readers or anybody else!
+ JSON Crack provides users with the necessary code to embed the app into a
+ website easily using an iframe. This code can be easily copied and pasted
+ into the desired location on the website, allowing users to quickly and
+ easily integrate JSON Crack into existing workflows.
+ <br />
+ <br /> Once the app is embedded, users can use it to view and analyze JSON
+ data directly on the website. This can be useful for a variety of purposes,
+ such as quickly checking the structure of a JSON file or verifying the data
+ contained within it. JSON Crack&apos;s intuitive interface makes it easy to
+ navigate and understand even complex JSON data, making it a valuable tool for
+ anyone working with JSON.
</Styles.StyledMinorTitle>
+ <Styles.StyledButton
+ href="https://jsoncrack.com/embed"
+ status="SECONDARY"
+ link
+ >
+ LEARN TO EMBED
+ </Styles.StyledButton>
</Styles.StyledSectionArea>
<div>
<Styles.StyledIframge
diff --cc src/pages/widget.tsx
index 53256df7,98bf1cf8..8e0c4333
--- a/src/pages/widget.tsx
+++ b/src/pages/widget.tsx
@@@ -66,7 -68,7 +68,8 @@@ const WidgetPage = () =>
const collapsedNodes = useGraph(state => state.collapsedNodes);
const collapsedEdges = useGraph(state => state.collapsedEdges);
const loading = useGraph(state => state.loading);
- const setGraphValue = useGraph(state => state.setGraphValue);
+ const setNodeEdges = useGraph(state => state.setNodeEdges);
++ const setDirection = useGraph(state => state.setDirection);
const openModal = React.useCallback(() => setModalVisible(true), []);
@@@ -92,9 -94,21 +95,20 @@@
const handler = (event: EmbedMessage) => {
try {
if (!event.data?.json) return;
+
const { nodes, edges } = parser(event.data.json);
- setNodeEdges(nodes, edges);
+ const options = {
+ direction: "RIGHT",
+ theme,
+ ...event.data.options,
+ };
+
- setGraphValue("direction", options.direction);
++ setDirection(options.direction);
+ if (options.theme === "light" || options.theme === "dark")
+ setTheme(options.theme);
+
- setGraphValue("nodes", nodes);
- setGraphValue("edges", edges);
++ setNodeEdges(nodes, edges);
} catch (error) {
console.error(error);
toast.error("Invalid JSON!");
@@@ -103,7 -117,7 +117,7 @@@
window.addEventListener("message", handler);
return () => window.removeEventListener("message", handler);
- }, [setNodeEdges]);
- }, [setGraphValue, theme]);
++ }, [setDirection, setNodeEdges, theme]);
if (query.json)
return (