Skip to content

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

chore: refactor & remove graphcanvas

AykutSarac3ac2aed2fe9b
diff --git a/src/containers/Editor/LiveEditor/GraphCanvas.tsx b/src/containers/Editor/LiveEditor/GraphCanvas.tsx
deleted file mode 100644
index 232bca0e..00000000
--- a/src/containers/Editor/LiveEditor/GraphCanvas.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from "react";
-import { Graph } from "src/components/Graph";
-
-export const GraphCanvas: React.FC<{ isWidget?: boolean }> = ({ isWidget = false }) => {
- return <Graph isWidget={isWidget} />;
-};
-
-export type GraphCanvasType = typeof GraphCanvas;
diff --git a/src/containers/Editor/LiveEditor/index.tsx b/src/containers/Editor/LiveEditor/index.tsx
index 99ab766d..a01ffe96 100644
--- a/src/containers/Editor/LiveEditor/index.tsx
+++ b/src/containers/Editor/LiveEditor/index.tsx
@@ -1,6 +1,6 @@
import React from "react";
import styled from "styled-components";
-import { GraphCanvas } from "src/containers/Editor/LiveEditor/GraphCanvas";
+import { Graph } from "src/components/Graph";
const StyledLiveEditor = styled.div`
position: relative;
@@ -10,7 +10,7 @@ const StyledLiveEditor = styled.div`
const LiveEditor: React.FC = () => {
return (
<StyledLiveEditor>
- <GraphCanvas />
+ <Graph />
</StyledLiveEditor>
);
};
diff --git a/src/hooks/useFocusNode.tsx b/src/hooks/useFocusNode.ts
similarity index 100%
rename from src/hooks/useFocusNode.tsx
rename to src/hooks/useFocusNode.ts
diff --git a/src/pages/widget.tsx b/src/pages/widget.tsx
index a7f51beb..816feaec 100644
--- a/src/pages/widget.tsx
+++ b/src/pages/widget.tsx
@@ -4,18 +4,10 @@ import { useRouter } from "next/router";
import { ThemeProvider } from "styled-components";
import toast from "react-hot-toast";
import { darkTheme, lightTheme } from "src/constants/theme";
-import { GraphCanvasType } from "src/containers/Editor/LiveEditor/GraphCanvas";
import { Tools } from "src/containers/Editor/LiveEditor/Tools";
import useFile from "src/store/useFile";
import useGraph from "src/store/useGraph";
-const GraphCanvas = dynamic(
- () => import("src/containers/Editor/LiveEditor/GraphCanvas").then(c => c.GraphCanvas),
- {
- ssr: false,
- }
-) as GraphCanvasType;
-
interface EmbedMessage {
data: {
json?: string;
@@ -23,6 +15,10 @@ interface EmbedMessage {
};
}
+const Graph = dynamic(() => import("src/components/Graph").then(c => c.Graph), {
+ ssr: false,
+});
+
const WidgetPage = () => {
const { query, push, isReady } = useRouter();
const [theme, setTheme] = React.useState("dark");
@@ -60,7 +56,7 @@ const WidgetPage = () => {
return (
<ThemeProvider theme={theme === "dark" ? darkTheme : lightTheme}>
<Tools isWidget />
- <GraphCanvas isWidget />
+ <Graph isWidget />
</ThemeProvider>
);
};
diff --git a/src/store/useGraph.tsx b/src/store/useGraph.ts
similarity index 100%
rename from src/store/useGraph.tsx
rename to src/store/useGraph.ts
diff --git a/src/store/useJson.tsx b/src/store/useJson.ts
similarity index 100%
rename from src/store/useJson.tsx
rename to src/store/useJson.ts
diff --git a/src/store/useModal.tsx b/src/store/useModal.ts
similarity index 100%
rename from src/store/useModal.tsx
rename to src/store/useModal.ts
diff --git a/src/store/useStored.tsx b/src/store/useStored.ts
similarity index 100%
rename from src/store/useStored.tsx
rename to src/store/useStored.ts
diff --git a/src/store/useUser.tsx b/src/store/useUser.ts
similarity index 100%
rename from src/store/useUser.tsx
rename to src/store/useUser.ts