Skip to content

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

update folder structure

AykutSaraca8167f53d60d
diff --git a/next.config.js b/next.config.js
index 975f4292..250508a2 100644
--- a/next.config.js
+++ b/next.config.js
@@ -10,12 +10,6 @@ const withPWA = require("next-pwa")({
*/
const nextConfig = {
reactStrictMode: true,
- exportPathMap: async () => ({
- "/": { page: "/" },
- "/editor": { page: "/Editor" },
- "/widget": { page: "/Widget" },
- "/embed": { page: "/Embed" },
- }),
};
module.exports = withPWA(nextConfig);
diff --git a/src/pages/Editor/index.tsx b/src/pages/editor.tsx
similarity index 100%
rename from src/pages/Editor/index.tsx
rename to src/pages/editor.tsx
diff --git a/src/pages/Embed/index.tsx b/src/pages/embed.tsx
similarity index 100%
rename from src/pages/Embed/index.tsx
rename to src/pages/embed.tsx
diff --git a/src/pages/Widget/index.tsx b/src/pages/widget.tsx
similarity index 97%
rename from src/pages/Widget/index.tsx
rename to src/pages/widget.tsx
index 7b646855..98bf1cf8 100644
--- a/src/pages/Widget/index.tsx
+++ b/src/pages/widget.tsx
@@ -3,11 +3,11 @@ import dynamic from "next/dynamic";
import { useRouter } from "next/router";
import toast from "react-hot-toast";
import { baseURL } from "src/constants/data";
+import { darkTheme, lightTheme } from "src/constants/theme";
import { NodeModal } from "src/containers/Modals/NodeModal";
import useGraph from "src/store/useGraph";
import { parser } from "src/utils/jsonParser";
import styled, { ThemeProvider } from "styled-components";
-import { darkTheme, lightTheme } from "src/constants/theme";
const Graph = dynamic<any>(() => import("src/components/Graph").then(c => c.Graph), {
ssr: false,
@@ -90,21 +90,22 @@ const WidgetPage = () => {
if (!inIframe()) push("/");
}, [collapsedNodes, collapsedEdges, loading, push]);
-
React.useEffect(() => {
const handler = (event: EmbedMessage) => {
try {
if (!event.data?.json) return;
-
+
const { nodes, edges } = parser(event.data.json);
const options = {
direction: "RIGHT",
- ...event.data.options
+ theme,
+ ...event.data.options,
};
setGraphValue("direction", options.direction);
- if (options.theme === "light" || options.theme === "dark") setTheme(options.theme);
+ if (options.theme === "light" || options.theme === "dark")
+ setTheme(options.theme);
setGraphValue("nodes", nodes);
setGraphValue("edges", edges);
@@ -116,7 +117,7 @@ const WidgetPage = () => {
window.addEventListener("message", handler);
return () => window.removeEventListener("message", handler);
- }, [setGraphValue]);
+ }, [setGraphValue, theme]);
if (query.json)
return (