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 victorbrambati/main

AykutSarac8ce24767c1fe
diff --cc package.json
index fcf85d33,827a9c2a..3ce22044
--- a/package.json
+++ b/package.json
@@@ -12,9 -12,9 +12,10 @@@
"deploy": "gh-pages -d out -t true"
},
"dependencies": {
- "@monaco-editor/react": "^4.4.4",
- "allotment": "^1.12.1",
+ "js-base64": "^3.7.2",
+ "@monaco-editor/react": "^4.4.5",
+ "@sentry/nextjs": "^7.1.1",
+ "allotment": "^1.14.2",
"next": "^12.1.5",
"next-transpile-modules": "^9.0.0",
"parse-json": "^6.0.2",
diff --cc src/components/Sidebar/index.tsx
index 996784c4,3be72612..16dfeeb0
--- a/src/components/Sidebar/index.tsx
+++ b/src/components/Sidebar/index.tsx
@@@ -21,7 -24,7 +25,8 @@@ import { useConfig } from "src/hocs/con
import { useRouter } from "next/router";
import { ImportModal } from "src/containers/ImportModal";
import { ClearModal } from "src/containers/ClearModal";
+import { ShareModal } from "src/containers/ShareModal";
+ import { IoAlertCircleSharp } from "react-icons/io5";
const StyledSidebar = styled.div`
display: flex;
@@@ -108,11 -138,14 +140,15 @@@ export const Sidebar: React.FC = () =>
const router = useRouter();
const [uploadVisible, setUploadVisible] = React.useState(false);
const [clearVisible, setClearVisible] = React.useState(false);
+ const [shareVisible, setShareVisible] = React.useState(false);
const handleSave = () => {
- localStorage.setItem("json", json);
- toast.success("Saved JSON successfully!");
+ const a = document.createElement("a");
+ const file = new Blob([json], { type: "text/plain" });
+
+ a.href = window.URL.createObjectURL(file);
+ a.download = "jsonvisio.json";
+ a.click();
};
const toggleExpandCollapse = () => {
@@@ -161,11 -207,17 +210,22 @@@
<AiOutlineSave />
</StyledElement>
</Tooltip>
- <Tooltip title="Share Link">
++ <Tooltip title="Share">
+ <StyledElement onClick={() => setShareVisible(true)}>
+ <AiOutlineLink />
+ </StyledElement>
+ </Tooltip>
+ <Tooltip
+ title={`${
+ settings.performance ? "Disable" : "Enable"
+ } Performance Mode (Beta)`}
+ >
+ <StyledElement onClick={togglePerformance} beta>
+ <CgPerformance
+ color={settings.performance ? "#0073FF" : undefined}
+ />
+ </StyledElement>
+ </Tooltip>
</StyledTopWrapper>
<StyledBottomWrapper>
<StyledElement>
diff --cc src/hocs/config.tsx
index dfdf540e,0879f57d..cb273c8c
--- a/src/hocs/config.tsx
+++ b/src/hocs/config.tsx
@@@ -45,20 -42,9 +45,21 @@@ const WithConfig: ReactComponent = ({ c
settings: states.settings,
};
+ const router = useRouter();
+ const { json } = router.query;
+
React.useEffect(() => {
+ const jsonStored = localStorage.getItem("json");
+ const jsonDecode = decode(String(json));
+
+ if (isValidJson(jsonDecode)) {
+ dispatch({ type: ConfigActionType.SET_JSON, payload: jsonDecode });
+ } else if (jsonStored) {
+ dispatch({ type: ConfigActionType.SET_JSON, payload: jsonStored });
+ }
+
const configStored = localStorage.getItem("config");
+
if (configStored) {
dispatch({
type: ConfigActionType.SET_CONFIG,