Skip to content

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

prettier lint

AykutSarac05869e63db03
diff --git a/src/components/Modal/styles.tsx b/src/components/Modal/styles.tsx
index d021efee..e76e9601 100644
--- a/src/components/Modal/styles.tsx
+++ b/src/components/Modal/styles.tsx
@@ -24,7 +24,8 @@ export const ModalWrapper = styled.div`
export const ModalInnerWrapper = styled.div<{ size: "sm" | "md" | "lg" }>`
min-width: 440px;
- max-width: ${({ size }) => (size === "sm" ? "490px" : size === "md" ? "50%" : "90%")};
+ max-width: ${({ size }) =>
+ size === "sm" ? "490px" : size === "md" ? "50%" : "90%"};
width: fit-content;
animation: ${appearAnimation} 220ms ease-in-out;
line-height: 20px;
diff --git a/src/components/MonacoEditor/index.tsx b/src/components/MonacoEditor/index.tsx
index 4b1049cb..c6f9d0bd 100644
--- a/src/components/MonacoEditor/index.tsx
+++ b/src/components/MonacoEditor/index.tsx
@@ -52,10 +52,11 @@ export const MonacoEditor = () => {
);
const debouncedSetJson = React.useMemo(
- () => debounce(value => {
- if (hasError) return;
- setJson(value || "[]");
- }, 1200),
+ () =>
+ debounce(value => {
+ if (hasError) return;
+ setJson(value || "[]");
+ }, 1200),
[hasError, setJson]
);
diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx
index 236d6fc0..bdbee177 100644
--- a/src/components/Sidebar/index.tsx
+++ b/src/components/Sidebar/index.tsx
@@ -20,10 +20,10 @@ import {
} from "react-icons/vsc";
import { Tooltip } from "src/components/Tooltip";
import useGraph from "src/store/useGraph";
+import useJson from "src/store/useJson";
import useModal from "src/store/useModal";
import { getNextDirection } from "src/utils/getNextDirection";
import styled from "styled-components";
-import useJson from "src/store/useJson";
const StyledSidebar = styled.div`
display: flex;
@@ -142,7 +142,7 @@ export const Sidebar: React.FC = () => {
const setVisible = useModal(state => state.setVisible);
const setDirection = useGraph(state => state.setDirection);
const getJson = useJson(state => state.getJson);
-
+
const collapseGraph = useGraph(state => state.collapseGraph);
const expandGraph = useGraph(state => state.expandGraph);
const centerView = useGraph(state => state.centerView);
diff --git a/src/components/Spinner/index.tsx b/src/components/Spinner/index.tsx
index 94fa14b8..844293ac 100644
--- a/src/components/Spinner/index.tsx
+++ b/src/components/Spinner/index.tsx
@@ -1,28 +1,28 @@
-import React from 'react'
-import { CgSpinner } from 'react-icons/cg'
-import styled, { keyframes } from 'styled-components'
+import React from "react";
+import { CgSpinner } from "react-icons/cg";
+import styled, { keyframes } from "styled-components";
const rotateAnimation = keyframes`
to { transform: rotate(360deg); }
`;
const StyledSpinnerWrapper = styled.div`
- display: flex;
- align-items: center;
- padding: 25px;
- justify-content: center;
- width: 100%;
- height: 100%;
-
- svg {
- animation: ${rotateAnimation} 1s linear infinite;
- }
+ display: flex;
+ align-items: center;
+ padding: 25px;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+
+ svg {
+ animation: ${rotateAnimation} 1s linear infinite;
+ }
`;
export const Spinner = () => {
return (
<StyledSpinnerWrapper>
- <CgSpinner size={40} />
+ <CgSpinner size={40} />
</StyledSpinnerWrapper>
- )
-}
+ );
+};
diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx
index ce3b5f2e..f03a6ef3 100644
--- a/src/components/Tooltip/index.tsx
+++ b/src/components/Tooltip/index.tsx
@@ -23,7 +23,7 @@ const StyledTooltip = styled.div<{ visible: boolean }>`
padding: 6px 8px;
display: ${({ visible }) => (visible ? "initial" : "none")};
white-space: nowrap;
- font-family: 'Mona Sans';
+ font-family: "Mona Sans";
font-size: 16px;
user-select: none;
font-weight: 500;
diff --git a/src/containers/Editor/BottomBar.tsx b/src/containers/Editor/BottomBar.tsx
index c4aa7471..3370e330 100644
--- a/src/containers/Editor/BottomBar.tsx
+++ b/src/containers/Editor/BottomBar.tsx
@@ -10,11 +10,11 @@ import {
} from "react-icons/ai";
import { VscAccount } from "react-icons/vsc";
import { saveJson, updateJson } from "src/services/db/json";
+import useJson from "src/store/useJson";
import useModal from "src/store/useModal";
import useStored from "src/store/useStored";
import useUser from "src/store/useUser";
import styled from "styled-components";
-import useJson from "src/store/useJson";
const StyledBottomBar = styled.div`
display: flex;
@@ -69,12 +69,12 @@ export const BottomBar = () => {
const user = useUser(state => state.user);
const lightmode = useStored(state => state.lightmode);
const hasChanges = useJson(state => state.hasChanges);
-
+
const getJson = useJson(state => state.getJson);
const setVisible = useModal(state => state.setVisible);
const setHasChanges = useJson(state => state.setHasChanges);
const [isPrivate, setIsPrivate] = React.useState(false);
-
+
React.useEffect(() => {
setIsPrivate(data?.private ?? false);
}, [data]);
diff --git a/src/containers/Editor/JsonEditor/index.tsx b/src/containers/Editor/JsonEditor/index.tsx
index 7be10800..2ab987d7 100644
--- a/src/containers/Editor/JsonEditor/index.tsx
+++ b/src/containers/Editor/JsonEditor/index.tsx
@@ -11,7 +11,6 @@ const StyledEditorWrapper = styled.div`
user-select: none;
`;
export const JsonEditor: React.FC = () => {
-
return (
<StyledEditorWrapper>
<ErrorContainer />
diff --git a/src/containers/Editor/Panes.tsx b/src/containers/Editor/Panes.tsx
index 75d2ee33..f3a30222 100644
--- a/src/containers/Editor/Panes.tsx
+++ b/src/containers/Editor/Panes.tsx
@@ -3,8 +3,8 @@ import dynamic from "next/dynamic";
import { Allotment } from "allotment";
import "allotment/dist/style.css";
import { JsonEditor } from "src/containers/Editor/JsonEditor";
-import styled from "styled-components";
import useGraph from "src/store/useGraph";
+import styled from "styled-components";
export const StyledEditor = styled(Allotment)`
position: relative !important;
diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx
index 7e96b808..ac49f8cb 100644
--- a/src/containers/Home/index.tsx
+++ b/src/containers/Home/index.tsx
@@ -291,7 +291,7 @@ const Footer = () => (
<Styles.StyledFooterText>
<img width="120" src="assets/icon.png" alt="icon" loading="lazy" />
<span>
- © {new Date().getFullYear()} JSON Crack - {pkg.version}
+ © {new Date().getFullYear()} JSON Crack - {pkg.version}
</span>
</Styles.StyledFooterText>
<Styles.StyledIconLinks>
diff --git a/src/containers/Modals/CloudModal/index.tsx b/src/containers/Modals/CloudModal/index.tsx
index 0518d831..94d5d4b3 100644
--- a/src/containers/Modals/CloudModal/index.tsx
+++ b/src/containers/Modals/CloudModal/index.tsx
@@ -27,7 +27,8 @@ const StyledModalContent = styled.div`
const StyledJsonCard = styled.a<{ active?: boolean }>`
display: block;
background: ${({ theme }) => theme.BLACK_SECONDARY};
- border: 2px solid ${({ theme, active }) => active ? theme.SEAGREEN : theme.BLACK_SECONDARY};
+ border: 2px solid
+ ${({ theme, active }) => (active ? theme.SEAGREEN : theme.BLACK_SECONDARY)};
border-radius: 5px;
overflow: hidden;
flex: 1;
@@ -87,7 +88,7 @@ const StyledNameInput = styled.input`
font-weight: 600;
`;
-const GraphCard: React.FC<{ data: any; refetch: () => void, active: boolean }> = ({
+const GraphCard: React.FC<{ data: any; refetch: () => void; active: boolean }> = ({
data,
refetch,
active,
@@ -178,7 +179,12 @@ export const CloudModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
<>
<CreateCard />
{data?.data?.result?.map(json => (
- <GraphCard data={json} key={json._id} refetch={refetch} active={query.json === json._id} />
+ <GraphCard
+ data={json}
+ key={json._id}
+ refetch={refetch}
+ active={query.json === json._id}
+ />
))}
</>
)}
diff --git a/src/containers/Modals/DownloadModal/index.tsx b/src/containers/Modals/DownloadModal/index.tsx
index b795ee2a..0bc77f7c 100644
--- a/src/containers/Modals/DownloadModal/index.tsx
+++ b/src/containers/Modals/DownloadModal/index.tsx
@@ -7,8 +7,8 @@ import { FiCopy, FiDownload } from "react-icons/fi";
import { Button } from "src/components/Button";
import { Input } from "src/components/Input";
import { Modal, ModalProps } from "src/components/Modal";
-import styled from "styled-components";
import useGraph from "src/store/useGraph";
+import styled from "styled-components";
const ColorPickerStyles: Partial<TwitterPickerStylesProps> = {
card: {
diff --git a/src/pages/widget.tsx b/src/pages/widget.tsx
index 8e0c4333..5b22793a 100644
--- a/src/pages/widget.tsx
+++ b/src/pages/widget.tsx
@@ -108,7 +108,7 @@ const WidgetPage = () => {
if (options.theme === "light" || options.theme === "dark")
setTheme(options.theme);
- setNodeEdges(nodes, edges);
+ setNodeEdges(nodes, edges);
} catch (error) {
console.error(error);
toast.error("Invalid JSON!");
diff --git a/src/services/db/json.tsx b/src/services/db/json.tsx
index 7cebbde2..39de95b9 100644
--- a/src/services/db/json.tsx
+++ b/src/services/db/json.tsx
@@ -27,9 +27,6 @@ const saveJson = async ({ id, data }): Promise<{ data: { _id: string } }> => {
const getAllJson = async (): Promise<{ data: JSON[] }> =>
await altogic.endpoint.get(`json`);
-const getJson = async (id: string): Promise<{ data: JSON }> =>
- await altogic.endpoint.get(`json/${id}`)
-
const updateJson = async (id: string, data: object) =>
await altogic.endpoint.put(`json/${id}`, {
...data,
@@ -37,4 +34,4 @@ const updateJson = async (id: string, data: object) =>
const deleteJson = async (id: string) => await altogic.endpoint.delete(`json/${id}`);
-export { saveJson, getJson, getAllJson, updateJson, deleteJson };
+export { saveJson, getAllJson, updateJson, deleteJson };
diff --git a/src/store/useGraph.tsx b/src/store/useGraph.tsx
index 1f4aa935..e6a02b60 100644
--- a/src/store/useGraph.tsx
+++ b/src/store/useGraph.tsx
@@ -53,7 +53,7 @@ const useGraph = create<Graph & GraphActions>((set, get) => ({
collapsedNodes: [],
collapsedEdges: [],
graphCollapsed: false,
- loading: true
+ loading: true,
});
},
setDirection: direction => set({ direction }),
@@ -65,7 +65,7 @@ const useGraph = create<Graph & GraphActions>((set, get) => ({
collapsedNodes: [],
collapsedEdges: [],
graphCollapsed: false,
- loading: true
+ loading: true,
}),
setLoading: loading => set({ loading }),
expandNodes: nodeId => {
diff --git a/src/store/useModal.tsx b/src/store/useModal.tsx
index 2777b18b..ef01b4d5 100644
--- a/src/store/useModal.tsx
+++ b/src/store/useModal.tsx
@@ -15,7 +15,7 @@ const initialStates = {
node: false,
settings: false,
share: false,
- login: false
+ login: false,
};
type ModalType = keyof typeof initialStates;
diff --git a/src/utils/getOutgoers.ts b/src/utils/getOutgoers.ts
index e1d58d4a..c4501135 100644
--- a/src/utils/getOutgoers.ts
+++ b/src/utils/getOutgoers.ts
@@ -19,7 +19,7 @@ export const getOutgoers = (
matchingNodes.push(n.id);
return outgoerIds.includes(n.id) && !parent.includes(n.id);
});
-
+
outgoerNodes.push(...nodeList);
nodeList.forEach(node => runner(node.id));
};