From b797fedced2e58d70aa84cb2971b8404c5632a02 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Wed, 11 Sep 2024 19:59:11 +0300 Subject: [PATCH] refactor codebase --- .gitignore | 2 - package.json | 8 ++- src/constants/data.ts | 36 ---------- src/constants/landing.ts | 34 ---------- .../Editor/{ => components}/BottomBar.tsx | 22 +++---- .../{ => components}/FullscreenDropzone.tsx | 0 .../index.tsx => components/LiveEditor.tsx} | 4 +- .../index.tsx => components/TextEditor.tsx} | 0 .../views}/GraphView/CustomEdge/index.tsx | 0 .../GraphView/CustomNode/ObjectNode.tsx | 2 +- .../views}/GraphView/CustomNode/TextNode.tsx | 6 +- .../GraphView/CustomNode/TextRenderer.tsx | 0 .../views}/GraphView/CustomNode/index.tsx | 2 +- .../views}/GraphView/CustomNode/styles.tsx | 0 .../views}/GraphView/NotSupported.tsx | 0 .../components/views}/GraphView/index.tsx | 4 +- .../views}/GraphView/lib/jsonParser.ts | 0 .../GraphView/lib/utils/addEdgeToGraph.ts | 0 .../GraphView/lib/utils/addNodeToGraph.ts | 4 +- .../GraphView/lib/utils/calculateNodeSize.ts | 0 .../GraphView/lib/utils/getChildrenEdges.ts | 0 .../views}/GraphView/lib/utils/getNodePath.ts | 0 .../views}/GraphView/lib/utils/getOutgoers.ts | 0 .../views}/GraphView/lib/utils/traverse.ts | 7 +- .../views}/GraphView/stores/useGraph.ts | 8 +-- .../components/views}/TreeView/Label.tsx | 0 .../components/views}/TreeView/Value.tsx | 2 +- .../components/views}/TreeView/index.tsx | 0 src/containers/Editor/index.tsx | 8 +-- src/containers/Landing/FAQ.tsx | 2 +- src/containers/Modals/ClearModal/index.tsx | 2 +- src/containers/Modals/CloudModal/index.tsx | 15 ++--- src/containers/Modals/NodeModal/index.tsx | 2 +- src/containers/Modals/ReviewModal/index.tsx | 61 ----------------- src/containers/Modals/ShareModal/index.tsx | 66 ------------------- src/containers/Modals/index.ts | 4 -- src/containers/Toolbar/AccountMenu.tsx | 18 +++-- src/containers/Toolbar/FileMenu.tsx | 6 +- src/containers/Toolbar/Logo.tsx | 6 +- src/containers/Toolbar/OptionsMenu.tsx | 6 +- src/containers/Toolbar/ToolsMenu.tsx | 6 +- src/containers/Toolbar/ViewMenu.tsx | 29 +++++--- src/containers/Toolbar/ZoomMenu.tsx | 8 +-- src/containers/Toolbar/index.tsx | 55 +++++++++------- src/containers/Toolbar/styles.ts | 24 ------- src/{constants => data}/faq.json | 0 src/{constants => data}/privacy.json | 0 src/{constants => data}/terms.json | 0 src/hooks/useFocusNode.ts | 2 +- src/hooks/useToggleHide.ts | 2 +- .../index.tsx => layout/AuthLayout.tsx} | 0 src/layout/ModalController.tsx | 2 - src/{services => lib/api}/document.service.ts | 0 src/lib/utils/gaEvent.ts | 0 src/lib/utils/getNextDirection.ts | 6 -- src/lib/utils/{widget.ts => helpers.ts} | 0 src/modules/GraphView/LICENSE | 42 ------------ src/pages/editor.tsx | 2 +- src/pages/forgot-password.tsx | 2 +- src/pages/legal/privacy.tsx | 2 +- src/pages/legal/terms.tsx | 2 +- src/pages/sign-in.tsx | 2 +- src/pages/sign-up.tsx | 2 +- src/pages/widget.tsx | 14 ++-- src/store/useConfig.ts | 2 +- src/store/useFile.ts | 45 +++++++++++-- src/store/useJson.ts | 2 +- src/store/useModal.ts | 2 - src/types/graph.ts | 2 + 69 files changed, 189 insertions(+), 403 deletions(-) delete mode 100644 src/constants/data.ts delete mode 100644 src/constants/landing.ts rename src/containers/Editor/{ => components}/BottomBar.tsx (91%) rename src/containers/Editor/{ => components}/FullscreenDropzone.tsx (100%) rename src/containers/Editor/{LiveEditor/index.tsx => components/LiveEditor.tsx} (86%) rename src/containers/Editor/{TextEditor/index.tsx => components/TextEditor.tsx} (100%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomEdge/index.tsx (100%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomNode/ObjectNode.tsx (92%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomNode/TextNode.tsx (92%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomNode/TextRenderer.tsx (100%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomNode/index.tsx (94%) rename src/{modules => containers/Editor/components/views}/GraphView/CustomNode/styles.tsx (100%) rename src/{modules => containers/Editor/components/views}/GraphView/NotSupported.tsx (100%) rename src/{modules => containers/Editor/components/views}/GraphView/index.tsx (97%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/jsonParser.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/addEdgeToGraph.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/addNodeToGraph.ts (75%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/calculateNodeSize.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/getChildrenEdges.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/getNodePath.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/getOutgoers.ts (100%) rename src/{modules => containers/Editor/components/views}/GraphView/lib/utils/traverse.ts (97%) rename src/{modules => containers/Editor/components/views}/GraphView/stores/useGraph.ts (95%) rename src/{modules => containers/Editor/components/views}/TreeView/Label.tsx (100%) rename src/{modules => containers/Editor/components/views}/TreeView/Value.tsx (90%) rename src/{modules => containers/Editor/components/views}/TreeView/index.tsx (100%) delete mode 100644 src/containers/Modals/ReviewModal/index.tsx delete mode 100644 src/containers/Modals/ShareModal/index.tsx rename src/{constants => data}/faq.json (100%) rename src/{constants => data}/privacy.json (100%) rename src/{constants => data}/terms.json (100%) rename src/{containers/AuthLayout/index.tsx => layout/AuthLayout.tsx} (100%) rename src/{services => lib/api}/document.service.ts (100%) delete mode 100644 src/lib/utils/gaEvent.ts delete mode 100644 src/lib/utils/getNextDirection.ts rename src/lib/utils/{widget.ts => helpers.ts} (100%) delete mode 100644 src/modules/GraphView/LICENSE diff --git a/.gitignore b/.gitignore index 94433c4..d317839 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,3 @@ npm-debug.log* **/public/fallback-*.js # Sentry Auth Token .sentryclirc - -/src/migration \ No newline at end of file diff --git a/package.json b/package.json index fcbbbc6..7ee7aa1 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,14 @@ "name": "json-crack", "private": true, "version": "0.0.0", - "author": "https://github.com/AykutSarac", + "author": { + "name": "JSON Crack", + "email": "contact@jsoncrack.com" + }, "homepage": "https://jsoncrack.com", + "bugs": { + "url": "https://github.com/AykutSarac/jsoncrack.com/issues" + }, "scripts": { "dev": "next dev", "build": "next build", diff --git a/src/constants/data.ts b/src/constants/data.ts deleted file mode 100644 index e3ebc9b..0000000 --- a/src/constants/data.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Example taken from https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json -const sampleJson = Object.freeze({ - squadName: "Super hero squad", - homeTown: "Metro City", - formed: 2016, - secretBase: "Super tower", - active: true, - members: [ - { - name: "Molecule Man", - age: 29, - secretIdentity: "Dan Jukes", - powers: ["Radiation resistance", "Turning tiny", "Radiation blast"], - }, - { - name: "Madame Uppercut", - age: 39, - secretIdentity: "Jane Wilson", - powers: ["Million tonne punch", "Damage resistance", "Superhuman reflexes"], - }, - { - name: "Eternal Flame", - age: 1000000, - secretIdentity: "Unknown", - powers: [ - "Immortality", - "Heat Immunity", - "Inferno", - "Teleportation", - "Interdimensional travel", - ], - }, - ], -}); - -export const defaultJson = JSON.stringify(sampleJson, null, 2); diff --git a/src/constants/landing.ts b/src/constants/landing.ts deleted file mode 100644 index cd77061..0000000 --- a/src/constants/landing.ts +++ /dev/null @@ -1,34 +0,0 @@ -export const images = Object.freeze([ - { - id: 1, - alt: "⚡️ Clean and Intuitive Interface designed for productivity and ease of use.", - }, - { - id: 2, - alt: "🔎 Enhanced Search Experience, with the ability to focus on node as you navigate through the data.", - }, - { - id: 3, - alt: "✍️ Understand your data in less time, modify the data directly on the graph.", - }, - { - id: 4, - alt: "📋 Download graphs as images, with options to customize the image quality and background color.", - }, - { - id: 5, - alt: "🎨 Customize the graph appearance, with options to change the node and edge colors, and the graph layout. Match the graph to your brand colors.", - }, - { - id: 6, - alt: "🖍️ Compare data on the graph, with the ability to highlight the differences between two datasets.", - }, - { - id: 7, - alt: "🤖 Filter and transform your data quickly and securely using the AI powered assistant.", - }, - { - id: 8, - alt: "🌓 Who doesn't love dark mode? A sleek and modern design that is easy on the eyes.", - }, -]); diff --git a/src/containers/Editor/BottomBar.tsx b/src/containers/Editor/components/BottomBar.tsx similarity index 91% rename from src/containers/Editor/BottomBar.tsx rename to src/containers/Editor/components/BottomBar.tsx index 535eaf8..7303f3c 100644 --- a/src/containers/Editor/BottomBar.tsx +++ b/src/containers/Editor/components/BottomBar.tsx @@ -1,8 +1,9 @@ import React from "react"; +import Link from "next/link"; import { Flex, Popover, Text } from "@mantine/core"; import styled from "styled-components"; import { event as gaEvent } from "nextjs-google-analytics"; -import { AiOutlineLink, AiOutlineLock, AiOutlineUnlock } from "react-icons/ai"; +import { AiOutlineLock, AiOutlineUnlock } from "react-icons/ai"; import { BiSolidDockLeft } from "react-icons/bi"; import { VscCheck, @@ -13,7 +14,7 @@ import { VscSync, VscSyncIgnored, } from "react-icons/vsc"; -import useGraph from "src/modules/GraphView/stores/useGraph"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import useFile from "src/store/useFile"; import useModal from "src/store/useModal"; @@ -114,7 +115,6 @@ export const BottomBar = () => { - {fileName && ( setVisible("cloud")(true)}> @@ -149,12 +149,6 @@ export const BottomBar = () => { {isPrivate ? "Private" : "Public"} )} - {isAuthenticated && ( - setVisible("notice")(true)}> - - Share - - )} { toggleLiveTransform(!liveTransformEnabled); @@ -174,10 +168,12 @@ export const BottomBar = () => { Nodes: {nodeCount} - setVisible("review")(true)}> - - Feedback - + + + + Feedback + + ); diff --git a/src/containers/Editor/FullscreenDropzone.tsx b/src/containers/Editor/components/FullscreenDropzone.tsx similarity index 100% rename from src/containers/Editor/FullscreenDropzone.tsx rename to src/containers/Editor/components/FullscreenDropzone.tsx diff --git a/src/containers/Editor/LiveEditor/index.tsx b/src/containers/Editor/components/LiveEditor.tsx similarity index 86% rename from src/containers/Editor/LiveEditor/index.tsx rename to src/containers/Editor/components/LiveEditor.tsx index e907271..183bdd5 100644 --- a/src/containers/Editor/LiveEditor/index.tsx +++ b/src/containers/Editor/components/LiveEditor.tsx @@ -1,8 +1,8 @@ import React from "react"; import styled from "styled-components"; +import { GraphView } from "src/containers/Editor/components/views/GraphView"; +import { TreeView } from "src/containers/Editor/components/views/TreeView"; import { ViewMode } from "src/enums/viewMode.enum"; -import { GraphView } from "src/modules/GraphView"; -import { TreeView } from "src/modules/TreeView"; import useConfig from "src/store/useConfig"; const StyledLiveEditor = styled.div` diff --git a/src/containers/Editor/TextEditor/index.tsx b/src/containers/Editor/components/TextEditor.tsx similarity index 100% rename from src/containers/Editor/TextEditor/index.tsx rename to src/containers/Editor/components/TextEditor.tsx diff --git a/src/modules/GraphView/CustomEdge/index.tsx b/src/containers/Editor/components/views/GraphView/CustomEdge/index.tsx similarity index 100% rename from src/modules/GraphView/CustomEdge/index.tsx rename to src/containers/Editor/components/views/GraphView/CustomEdge/index.tsx diff --git a/src/modules/GraphView/CustomNode/ObjectNode.tsx b/src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx similarity index 92% rename from src/modules/GraphView/CustomNode/ObjectNode.tsx rename to src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx index 049f24d..64e8c85 100644 --- a/src/modules/GraphView/CustomNode/ObjectNode.tsx +++ b/src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx @@ -1,5 +1,5 @@ import React from "react"; -import type { CustomNodeProps } from "src/modules/GraphView/CustomNode"; +import type { CustomNodeProps } from "src/containers/Editor/components/views/GraphView/CustomNode"; import { TextRenderer } from "./TextRenderer"; import * as Styled from "./styles"; diff --git a/src/modules/GraphView/CustomNode/TextNode.tsx b/src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx similarity index 92% rename from src/modules/GraphView/CustomNode/TextNode.tsx rename to src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx index 8fda850..91c48f6 100644 --- a/src/modules/GraphView/CustomNode/TextNode.tsx +++ b/src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx @@ -1,10 +1,10 @@ import React from "react"; import styled from "styled-components"; import { MdLink, MdLinkOff } from "react-icons/md"; +import type { CustomNodeProps } from "src/containers/Editor/components/views/GraphView/CustomNode"; +import { isContentImage } from "src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import useToggleHide from "src/hooks/useToggleHide"; -import type { CustomNodeProps } from "src/modules/GraphView/CustomNode"; -import { isContentImage } from "src/modules/GraphView/lib/utils/calculateNodeSize"; -import useGraph from "src/modules/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import { TextRenderer } from "./TextRenderer"; import * as Styled from "./styles"; diff --git a/src/modules/GraphView/CustomNode/TextRenderer.tsx b/src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx similarity index 100% rename from src/modules/GraphView/CustomNode/TextRenderer.tsx rename to src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx diff --git a/src/modules/GraphView/CustomNode/index.tsx b/src/containers/Editor/components/views/GraphView/CustomNode/index.tsx similarity index 94% rename from src/modules/GraphView/CustomNode/index.tsx rename to src/containers/Editor/components/views/GraphView/CustomNode/index.tsx index 8fcff4c..05196d7 100644 --- a/src/modules/GraphView/CustomNode/index.tsx +++ b/src/containers/Editor/components/views/GraphView/CustomNode/index.tsx @@ -1,7 +1,7 @@ import React from "react"; import type { NodeProps } from "reaflow"; import { Node } from "reaflow"; -import useGraph from "src/modules/GraphView/stores/useGraph"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import useModal from "src/store/useModal"; import type { NodeData } from "src/types/graph"; import { ObjectNode } from "./ObjectNode"; diff --git a/src/modules/GraphView/CustomNode/styles.tsx b/src/containers/Editor/components/views/GraphView/CustomNode/styles.tsx similarity index 100% rename from src/modules/GraphView/CustomNode/styles.tsx rename to src/containers/Editor/components/views/GraphView/CustomNode/styles.tsx diff --git a/src/modules/GraphView/NotSupported.tsx b/src/containers/Editor/components/views/GraphView/NotSupported.tsx similarity index 100% rename from src/modules/GraphView/NotSupported.tsx rename to src/containers/Editor/components/views/GraphView/NotSupported.tsx diff --git a/src/modules/GraphView/index.tsx b/src/containers/Editor/components/views/GraphView/index.tsx similarity index 97% rename from src/modules/GraphView/index.tsx rename to src/containers/Editor/components/views/GraphView/index.tsx index d5149ea..7809703 100644 --- a/src/modules/GraphView/index.tsx +++ b/src/containers/Editor/components/views/GraphView/index.tsx @@ -6,9 +6,9 @@ import { Space } from "react-zoomable-ui"; import { Canvas } from "reaflow"; import type { ElkRoot } from "reaflow/dist/layout/useLayout"; import { useLongPress } from "use-long-press"; +import { CustomNode } from "src/containers/Editor/components/views/GraphView/CustomNode"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import useToggleHide from "src/hooks/useToggleHide"; -import { CustomNode } from "src/modules/GraphView/CustomNode"; -import useGraph from "src/modules/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import { CustomEdge } from "./CustomEdge"; import { NotSupported } from "./NotSupported"; diff --git a/src/modules/GraphView/lib/jsonParser.ts b/src/containers/Editor/components/views/GraphView/lib/jsonParser.ts similarity index 100% rename from src/modules/GraphView/lib/jsonParser.ts rename to src/containers/Editor/components/views/GraphView/lib/jsonParser.ts diff --git a/src/modules/GraphView/lib/utils/addEdgeToGraph.ts b/src/containers/Editor/components/views/GraphView/lib/utils/addEdgeToGraph.ts similarity index 100% rename from src/modules/GraphView/lib/utils/addEdgeToGraph.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/addEdgeToGraph.ts diff --git a/src/modules/GraphView/lib/utils/addNodeToGraph.ts b/src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts similarity index 75% rename from src/modules/GraphView/lib/utils/addNodeToGraph.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts index 117f704..4e291dc 100644 --- a/src/modules/GraphView/lib/utils/addNodeToGraph.ts +++ b/src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts @@ -1,6 +1,6 @@ import type { NodeType } from "jsonc-parser"; -import type { Graph } from "src/modules/GraphView/lib/jsonParser"; -import { calculateNodeSize } from "src/modules/GraphView/lib/utils/calculateNodeSize"; +import type { Graph } from "src/containers/Editor/components/views/GraphView/lib/jsonParser"; +import { calculateNodeSize } from "src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize"; type Props = { graph: Graph; diff --git a/src/modules/GraphView/lib/utils/calculateNodeSize.ts b/src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize.ts similarity index 100% rename from src/modules/GraphView/lib/utils/calculateNodeSize.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize.ts diff --git a/src/modules/GraphView/lib/utils/getChildrenEdges.ts b/src/containers/Editor/components/views/GraphView/lib/utils/getChildrenEdges.ts similarity index 100% rename from src/modules/GraphView/lib/utils/getChildrenEdges.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/getChildrenEdges.ts diff --git a/src/modules/GraphView/lib/utils/getNodePath.ts b/src/containers/Editor/components/views/GraphView/lib/utils/getNodePath.ts similarity index 100% rename from src/modules/GraphView/lib/utils/getNodePath.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/getNodePath.ts diff --git a/src/modules/GraphView/lib/utils/getOutgoers.ts b/src/containers/Editor/components/views/GraphView/lib/utils/getOutgoers.ts similarity index 100% rename from src/modules/GraphView/lib/utils/getOutgoers.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/getOutgoers.ts diff --git a/src/modules/GraphView/lib/utils/traverse.ts b/src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts similarity index 97% rename from src/modules/GraphView/lib/utils/traverse.ts rename to src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts index 4077a4e..b66ff45 100644 --- a/src/modules/GraphView/lib/utils/traverse.ts +++ b/src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts @@ -1,6 +1,9 @@ import type { Node, NodeType } from "jsonc-parser"; -import type { Graph, States } from "src/modules/GraphView/lib/jsonParser"; -import { calculateNodeSize } from "src/modules/GraphView/lib/utils/calculateNodeSize"; +import type { + Graph, + States, +} from "src/containers/Editor/components/views/GraphView/lib/jsonParser"; +import { calculateNodeSize } from "src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize"; import { addEdgeToGraph } from "./addEdgeToGraph"; import { addNodeToGraph } from "./addNodeToGraph"; diff --git a/src/modules/GraphView/stores/useGraph.ts b/src/containers/Editor/components/views/GraphView/stores/useGraph.ts similarity index 95% rename from src/modules/GraphView/stores/useGraph.ts rename to src/containers/Editor/components/views/GraphView/stores/useGraph.ts index c0a62e9..938712e 100644 --- a/src/modules/GraphView/stores/useGraph.ts +++ b/src/containers/Editor/components/views/GraphView/stores/useGraph.ts @@ -1,11 +1,11 @@ import type { ViewPort } from "react-zoomable-ui/dist/ViewPort"; import type { CanvasDirection } from "reaflow/dist/layout/elkLayout"; import { create } from "zustand"; -import { parser } from "src/modules/GraphView/lib/jsonParser"; -import { getChildrenEdges } from "src/modules/GraphView/lib/utils/getChildrenEdges"; -import { getOutgoers } from "src/modules/GraphView/lib/utils/getOutgoers"; +import { parser } from "src/containers/Editor/components/views/GraphView/lib/jsonParser"; +import { getChildrenEdges } from "src/containers/Editor/components/views/GraphView/lib/utils/getChildrenEdges"; +import { getOutgoers } from "src/containers/Editor/components/views/GraphView/lib/utils/getOutgoers"; import type { NodeData, EdgeData } from "src/types/graph"; -import useJson from "../../../store/useJson"; +import useJson from "../../../../../../store/useJson"; export interface Graph { viewPort: ViewPort | null; diff --git a/src/modules/TreeView/Label.tsx b/src/containers/Editor/components/views/TreeView/Label.tsx similarity index 100% rename from src/modules/TreeView/Label.tsx rename to src/containers/Editor/components/views/TreeView/Label.tsx diff --git a/src/modules/TreeView/Value.tsx b/src/containers/Editor/components/views/TreeView/Value.tsx similarity index 90% rename from src/modules/TreeView/Value.tsx rename to src/containers/Editor/components/views/TreeView/Value.tsx index 16acd39..e877f27 100644 --- a/src/modules/TreeView/Value.tsx +++ b/src/containers/Editor/components/views/TreeView/Value.tsx @@ -1,7 +1,7 @@ import React from "react"; import type { DefaultTheme } from "styled-components"; import { useTheme } from "styled-components"; -import { TextRenderer } from "src/modules/GraphView/CustomNode/TextRenderer"; +import { TextRenderer } from "src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer"; type TextColorFn = { theme: DefaultTheme; diff --git a/src/modules/TreeView/index.tsx b/src/containers/Editor/components/views/TreeView/index.tsx similarity index 100% rename from src/modules/TreeView/index.tsx rename to src/containers/Editor/components/views/TreeView/index.tsx diff --git a/src/containers/Editor/index.tsx b/src/containers/Editor/index.tsx index 2b2bf83..2694b10 100644 --- a/src/containers/Editor/index.tsx +++ b/src/containers/Editor/index.tsx @@ -3,8 +3,8 @@ import dynamic from "next/dynamic"; import styled from "styled-components"; import { Allotment } from "allotment"; import "allotment/dist/style.css"; -import useGraph from "src/modules/GraphView/stores/useGraph"; -import { FullscreenDropzone } from "./FullscreenDropzone"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import { FullscreenDropzone } from "./components/FullscreenDropzone"; export const StyledEditor = styled(Allotment)` position: relative !important; @@ -17,11 +17,11 @@ export const StyledEditor = styled(Allotment)` } `; -const TextEditor = dynamic(() => import("src/containers/Editor/TextEditor"), { +const TextEditor = dynamic(() => import("src/containers/Editor/components/TextEditor"), { ssr: false, }); -const LiveEditor = dynamic(() => import("src/containers/Editor/LiveEditor"), { +const LiveEditor = dynamic(() => import("src/containers/Editor/components/LiveEditor"), { ssr: false, }); diff --git a/src/containers/Landing/FAQ.tsx b/src/containers/Landing/FAQ.tsx index a3c9f92..99fa44f 100644 --- a/src/containers/Landing/FAQ.tsx +++ b/src/containers/Landing/FAQ.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Container, Title, Accordion } from "@mantine/core"; -import Questions from "src/constants/faq.json"; +import Questions from "src/data/faq.json"; export const FAQ = () => { return ( diff --git a/src/containers/Modals/ClearModal/index.tsx b/src/containers/Modals/ClearModal/index.tsx index efb4f2d..ae57d11 100644 --- a/src/containers/Modals/ClearModal/index.tsx +++ b/src/containers/Modals/ClearModal/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import { useRouter } from "next/router"; import type { ModalProps } from "@mantine/core"; import { Modal, Group, Button, Text, Divider } from "@mantine/core"; -import { documentSvc } from "src/services/document.service"; +import { documentSvc } from "src/lib/api/document.service"; import useJson from "src/store/useJson"; export const ClearModal = ({ opened, onClose }: ModalProps) => { diff --git a/src/containers/Modals/CloudModal/index.tsx b/src/containers/Modals/CloudModal/index.tsx index 3764ffb..671f158 100644 --- a/src/containers/Modals/CloudModal/index.tsx +++ b/src/containers/Modals/CloudModal/index.tsx @@ -29,7 +29,7 @@ import { LuDownload } from "react-icons/lu"; import { SlOptionsVertical } from "react-icons/sl"; import { VscAdd, VscWarning } from "react-icons/vsc"; import type { FileFormat } from "src/enums/file.enum"; -import { documentSvc } from "src/services/document.service"; +import { documentSvc } from "src/lib/api/document.service"; import type { File } from "src/store/useFile"; import useFile from "src/store/useFile"; import useModal from "src/store/useModal"; @@ -152,7 +152,9 @@ export const CloudModal = ({ opened, onClose }: ModalProps) => { {element.name} - {dayjs(element.updated_at).format("DD MMM YYYY")} + + {dayjs(element.updated_at).fromNow()} + e.stopPropagation()}> @@ -219,14 +221,7 @@ export const CloudModal = ({ opened, onClose }: ModalProps) => { /> - - - - Format - Name - Last opened date - - +
{rows}
diff --git a/src/containers/Modals/NodeModal/index.tsx b/src/containers/Modals/NodeModal/index.tsx index 4587fb6..ef3d671 100644 --- a/src/containers/Modals/NodeModal/index.tsx +++ b/src/containers/Modals/NodeModal/index.tsx @@ -4,7 +4,7 @@ import { Modal, Stack, Text, ScrollArea, Button } from "@mantine/core"; import { CodeHighlight } from "@mantine/code-highlight"; import { event as gaEvent } from "nextjs-google-analytics"; import { VscLock } from "react-icons/vsc"; -import useGraph from "src/modules/GraphView/stores/useGraph"; +import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import useModal from "src/store/useModal"; const dataToString = (data: any) => { diff --git a/src/containers/Modals/ReviewModal/index.tsx b/src/containers/Modals/ReviewModal/index.tsx deleted file mode 100644 index bf79f80..0000000 --- a/src/containers/Modals/ReviewModal/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React from "react"; -import type { ModalProps } from "@mantine/core"; -import { Button, Modal, Rating, Text, Textarea } from "@mantine/core"; -import { toast } from "react-hot-toast"; -import { supabase } from "src/lib/api/supabase"; - -export const ReviewModal = ({ opened, onClose }: ModalProps) => { - const [stars, setStars] = React.useState(0); - const [review, setReview] = React.useState(""); - - return ( - { - onClose(); - setStars(0); - setReview(""); - }} - centered - > -
{ - e.preventDefault(); - if (stars === 0 && !review.length) return onClose(); - supabase - .from("reviews") - .insert({ stars, review }) - .then(({ error }) => { - if (error) return toast.error(error.message); - toast.success("Thank you for your feedback!"); - }); - onClose(); - }} - > - How was your experience? - -