From ca36a4ba44eda0197bb1754f11cb4ec0826ed5e3 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Sun, 8 Dec 2024 00:57:36 +0300 Subject: [PATCH] refactor folder structure --- src/containers/Editor/index.tsx | 49 ------------------- .../editor}/BottomBar.tsx | 2 +- .../editor}/ExternalMode.tsx | 0 .../editor}/FullscreenDropzone.tsx | 0 .../editor}/LiveEditor.tsx | 4 +- .../editor}/ModalController.tsx | 4 +- .../editor}/TextEditor.tsx | 0 .../editor}/Toolbar/FileMenu.tsx | 0 .../editor}/Toolbar/Logo.tsx | 0 .../editor}/Toolbar/OptionsMenu.tsx | 0 .../editor}/Toolbar/SearchInput.tsx | 0 .../editor}/Toolbar/ToolsMenu.tsx | 0 .../editor}/Toolbar/ViewMenu.tsx | 2 +- .../editor}/Toolbar/ZoomMenu.tsx | 2 +- .../editor}/Toolbar/index.tsx | 2 +- .../editor}/Toolbar/styles.ts | 0 .../views/GraphView/CustomEdge/index.tsx | 0 .../views/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 .../editor}/views/GraphView/NotSupported.tsx | 0 .../editor}/views/GraphView/index.tsx | 4 +- .../editor}/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 +-- .../editor}/views/TreeView/Label.tsx | 0 .../editor}/views/TreeView/Value.tsx | 2 +- .../editor}/views/TreeView/index.tsx | 0 .../modals}/DownloadModal/index.tsx | 0 .../modals}/ImportModal/index.tsx | 0 .../modals}/JPathModal/index.tsx | 0 .../modals}/JQModal/index.tsx | 0 .../modals}/JWTModal/index.tsx | 0 .../modals}/NodeModal/index.tsx | 2 +- .../modals}/SchemaModal/index.tsx | 0 .../modals}/TypeModal/index.tsx | 0 .../modals}/UpgradeModal/index.tsx | 0 .../Modals => features/modals}/index.ts | 0 src/hooks/useFocusNode.ts | 2 +- src/hooks/useToggleHide.ts | 2 +- .../ConverterLayout/PageLinks.tsx | 0 .../ConverterLayout/ToolPage.tsx | 6 +-- .../ConverterLayout/options.ts | 0 src/{containers => layout}/Landing/FAQ.tsx | 0 .../Landing/Features.tsx | 0 .../Landing/HeroPreview.tsx | 0 .../Landing/HeroSection.tsx | 0 .../Landing/LovedBy.tsx | 0 .../Landing/Section1.tsx | 0 .../Landing/SeePremium.tsx | 0 src/layout/{ => PageLayout}/Footer.tsx | 2 +- src/layout/{ => PageLayout}/Navbar.tsx | 2 +- .../{Layout.tsx => PageLayout/index.tsx} | 6 +-- .../TypeLayout/PageLinks.tsx | 0 .../TypeLayout/TypegenWrapper.tsx | 4 +- src/pages/404.tsx | 2 +- src/pages/_error.tsx | 2 +- src/pages/converter/csv-to-json.tsx | 2 +- src/pages/converter/csv-to-xml.tsx | 2 +- src/pages/converter/csv-to-yaml.tsx | 2 +- src/pages/converter/json-to-csv.tsx | 2 +- src/pages/converter/json-to-xml.tsx | 2 +- src/pages/converter/json-to-yaml.tsx | 2 +- src/pages/converter/xml-to-csv.tsx | 2 +- src/pages/converter/xml-to-json.tsx | 2 +- src/pages/converter/xml-to-yaml.tsx | 2 +- src/pages/converter/yaml-to-csv.tsx | 2 +- src/pages/converter/yaml-to-json.tsx | 2 +- src/pages/converter/yaml-to-xml.tsx | 2 +- src/pages/docs.tsx | 2 +- src/pages/editor.tsx | 48 +++++++++++++++--- src/pages/index.tsx | 16 +++--- src/pages/legal/privacy.tsx | 2 +- src/pages/legal/terms.tsx | 2 +- src/pages/tools/json-schema.tsx | 4 +- src/pages/type/csv-to-go.tsx | 2 +- src/pages/type/csv-to-kotlin.tsx | 2 +- src/pages/type/csv-to-rust.tsx | 2 +- src/pages/type/csv-to-typescript.tsx | 2 +- src/pages/type/json-to-go.tsx | 2 +- src/pages/type/json-to-kotlin.tsx | 2 +- src/pages/type/json-to-rust.tsx | 2 +- src/pages/type/json-to-typescript.tsx | 2 +- src/pages/type/xml-to-go.tsx | 2 +- src/pages/type/xml-to-kotlin.tsx | 2 +- src/pages/type/xml-to-rust.tsx | 2 +- src/pages/type/xml-to-typescript.tsx | 2 +- src/pages/type/yaml-to-go.tsx | 2 +- src/pages/type/yaml-to-kotlin.tsx | 2 +- src/pages/type/yaml-to-rust.tsx | 2 +- src/pages/type/yaml-to-typescript.tsx | 2 +- src/pages/widget.tsx | 6 +-- src/store/useConfig.ts | 2 +- src/store/useFile.ts | 2 +- src/store/useJson.ts | 2 +- src/store/useModal.ts | 2 +- 104 files changed, 128 insertions(+), 146 deletions(-) delete mode 100644 src/containers/Editor/index.tsx rename src/{containers/Editor/components => features/editor}/BottomBar.tsx (98%) rename src/{layout => features/editor}/ExternalMode.tsx (100%) rename src/{containers/Editor/components => features/editor}/FullscreenDropzone.tsx (100%) rename src/{containers/Editor/components => features/editor}/LiveEditor.tsx (86%) rename src/{layout => features/editor}/ModalController.tsx (92%) rename src/{containers/Editor/components => features/editor}/TextEditor.tsx (100%) rename src/{containers => features/editor}/Toolbar/FileMenu.tsx (100%) rename src/{containers => features/editor}/Toolbar/Logo.tsx (100%) rename src/{containers => features/editor}/Toolbar/OptionsMenu.tsx (100%) rename src/{containers => features/editor}/Toolbar/SearchInput.tsx (100%) rename src/{containers => features/editor}/Toolbar/ToolsMenu.tsx (100%) rename src/{containers => features/editor}/Toolbar/ViewMenu.tsx (98%) rename src/{containers => features/editor}/Toolbar/ZoomMenu.tsx (97%) rename src/{containers => features/editor}/Toolbar/index.tsx (97%) rename src/{containers => features/editor}/Toolbar/styles.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomEdge/index.tsx (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomNode/ObjectNode.tsx (92%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomNode/TextNode.tsx (92%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomNode/TextRenderer.tsx (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomNode/index.tsx (94%) rename src/{containers/Editor/components => features/editor}/views/GraphView/CustomNode/styles.tsx (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/NotSupported.tsx (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/index.tsx (97%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/jsonParser.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/addEdgeToGraph.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/addNodeToGraph.ts (75%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/calculateNodeSize.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/getChildrenEdges.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/getNodePath.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/getOutgoers.ts (100%) rename src/{containers/Editor/components => features/editor}/views/GraphView/lib/utils/traverse.ts (97%) rename src/{containers/Editor/components => features/editor}/views/GraphView/stores/useGraph.ts (95%) rename src/{containers/Editor/components => features/editor}/views/TreeView/Label.tsx (100%) rename src/{containers/Editor/components => features/editor}/views/TreeView/Value.tsx (90%) rename src/{containers/Editor/components => features/editor}/views/TreeView/index.tsx (100%) rename src/{containers/Modals => features/modals}/DownloadModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/ImportModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/JPathModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/JQModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/JWTModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/NodeModal/index.tsx (95%) rename src/{containers/Modals => features/modals}/SchemaModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/TypeModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/UpgradeModal/index.tsx (100%) rename src/{containers/Modals => features/modals}/index.ts (100%) rename src/{containers => layout}/ConverterLayout/PageLinks.tsx (100%) rename src/{containers => layout}/ConverterLayout/ToolPage.tsx (95%) rename src/{containers => layout}/ConverterLayout/options.ts (100%) rename src/{containers => layout}/Landing/FAQ.tsx (100%) rename src/{containers => layout}/Landing/Features.tsx (100%) rename src/{containers => layout}/Landing/HeroPreview.tsx (100%) rename src/{containers => layout}/Landing/HeroSection.tsx (100%) rename src/{containers => layout}/Landing/LovedBy.tsx (100%) rename src/{containers => layout}/Landing/Section1.tsx (100%) rename src/{containers => layout}/Landing/SeePremium.tsx (100%) rename src/layout/{ => PageLayout}/Footer.tsx (98%) rename src/layout/{ => PageLayout}/Navbar.tsx (98%) rename src/layout/{Layout.tsx => PageLayout/index.tsx} (76%) rename src/{containers => layout}/TypeLayout/PageLinks.tsx (100%) rename src/{containers => layout}/TypeLayout/TypegenWrapper.tsx (96%) diff --git a/src/containers/Editor/index.tsx b/src/containers/Editor/index.tsx deleted file mode 100644 index 2694b10..0000000 --- a/src/containers/Editor/index.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from "react"; -import dynamic from "next/dynamic"; -import styled from "styled-components"; -import { Allotment } from "allotment"; -import "allotment/dist/style.css"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; -import { FullscreenDropzone } from "./components/FullscreenDropzone"; - -export const StyledEditor = styled(Allotment)` - position: relative !important; - display: flex; - background: ${({ theme }) => theme.BACKGROUND_SECONDARY}; - height: calc(100vh - 67px); - - @media only screen and (max-width: 320px) { - height: 100vh; - } -`; - -const TextEditor = dynamic(() => import("src/containers/Editor/components/TextEditor"), { - ssr: false, -}); - -const LiveEditor = dynamic(() => import("src/containers/Editor/components/LiveEditor"), { - ssr: false, -}); - -export const Editor = () => { - const fullscreen = useGraph(state => state.fullscreen); - - return ( - <> - - - - - - - - - - - ); -}; diff --git a/src/containers/Editor/components/BottomBar.tsx b/src/features/editor/BottomBar.tsx similarity index 98% rename from src/containers/Editor/components/BottomBar.tsx rename to src/features/editor/BottomBar.tsx index b5c2237..7a7ea75 100644 --- a/src/containers/Editor/components/BottomBar.tsx +++ b/src/features/editor/BottomBar.tsx @@ -12,7 +12,7 @@ import { VscSync, VscSyncIgnored, } from "react-icons/vsc"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import useFile from "src/store/useFile"; diff --git a/src/layout/ExternalMode.tsx b/src/features/editor/ExternalMode.tsx similarity index 100% rename from src/layout/ExternalMode.tsx rename to src/features/editor/ExternalMode.tsx diff --git a/src/containers/Editor/components/FullscreenDropzone.tsx b/src/features/editor/FullscreenDropzone.tsx similarity index 100% rename from src/containers/Editor/components/FullscreenDropzone.tsx rename to src/features/editor/FullscreenDropzone.tsx diff --git a/src/containers/Editor/components/LiveEditor.tsx b/src/features/editor/LiveEditor.tsx similarity index 86% rename from src/containers/Editor/components/LiveEditor.tsx rename to src/features/editor/LiveEditor.tsx index 183bdd5..2fd80fb 100644 --- a/src/containers/Editor/components/LiveEditor.tsx +++ b/src/features/editor/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/features/editor/views/GraphView"; +import { TreeView } from "src/features/editor/views/TreeView"; import useConfig from "src/store/useConfig"; const StyledLiveEditor = styled.div` diff --git a/src/layout/ModalController.tsx b/src/features/editor/ModalController.tsx similarity index 92% rename from src/layout/ModalController.tsx rename to src/features/editor/ModalController.tsx index 47aceb7..f06e5ff 100644 --- a/src/layout/ModalController.tsx +++ b/src/features/editor/ModalController.tsx @@ -1,7 +1,7 @@ import React from "react"; import type { ModalProps } from "@mantine/core"; -import * as Modals from "src/containers/Modals"; -import type { Modal } from "src/containers/Modals"; +import * as Modals from "src/features/modals"; +import type { Modal } from "src/features/modals"; import useModal from "src/store/useModal"; type ModalComponent = { key: Modal; component: React.FC }; diff --git a/src/containers/Editor/components/TextEditor.tsx b/src/features/editor/TextEditor.tsx similarity index 100% rename from src/containers/Editor/components/TextEditor.tsx rename to src/features/editor/TextEditor.tsx diff --git a/src/containers/Toolbar/FileMenu.tsx b/src/features/editor/Toolbar/FileMenu.tsx similarity index 100% rename from src/containers/Toolbar/FileMenu.tsx rename to src/features/editor/Toolbar/FileMenu.tsx diff --git a/src/containers/Toolbar/Logo.tsx b/src/features/editor/Toolbar/Logo.tsx similarity index 100% rename from src/containers/Toolbar/Logo.tsx rename to src/features/editor/Toolbar/Logo.tsx diff --git a/src/containers/Toolbar/OptionsMenu.tsx b/src/features/editor/Toolbar/OptionsMenu.tsx similarity index 100% rename from src/containers/Toolbar/OptionsMenu.tsx rename to src/features/editor/Toolbar/OptionsMenu.tsx diff --git a/src/containers/Toolbar/SearchInput.tsx b/src/features/editor/Toolbar/SearchInput.tsx similarity index 100% rename from src/containers/Toolbar/SearchInput.tsx rename to src/features/editor/Toolbar/SearchInput.tsx diff --git a/src/containers/Toolbar/ToolsMenu.tsx b/src/features/editor/Toolbar/ToolsMenu.tsx similarity index 100% rename from src/containers/Toolbar/ToolsMenu.tsx rename to src/features/editor/Toolbar/ToolsMenu.tsx diff --git a/src/containers/Toolbar/ViewMenu.tsx b/src/features/editor/Toolbar/ViewMenu.tsx similarity index 98% rename from src/containers/Toolbar/ViewMenu.tsx rename to src/features/editor/Toolbar/ViewMenu.tsx index 3e95ddf..0784f84 100644 --- a/src/containers/Toolbar/ViewMenu.tsx +++ b/src/features/editor/Toolbar/ViewMenu.tsx @@ -7,8 +7,8 @@ import toast from "react-hot-toast"; import { CgChevronDown } from "react-icons/cg"; import { TiFlowMerge } from "react-icons/ti"; import { VscExpandAll, VscCollapseAll, VscTarget } from "react-icons/vsc"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; import { ViewMode } from "src/enums/viewMode.enum"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useToggleHide from "src/hooks/useToggleHide"; import useConfig from "src/store/useConfig"; import type { LayoutDirection } from "src/types/graph"; diff --git a/src/containers/Toolbar/ZoomMenu.tsx b/src/features/editor/Toolbar/ZoomMenu.tsx similarity index 97% rename from src/containers/Toolbar/ZoomMenu.tsx rename to src/features/editor/Toolbar/ZoomMenu.tsx index e46ca91..d616d8b 100644 --- a/src/containers/Toolbar/ZoomMenu.tsx +++ b/src/features/editor/Toolbar/ZoomMenu.tsx @@ -3,7 +3,7 @@ import { Menu, Flex, Input, Text } from "@mantine/core"; import { getHotkeyHandler, useHotkeys } from "@mantine/hooks"; import { event as gaEvent } from "nextjs-google-analytics"; import { CgChevronDown } from "react-icons/cg"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import { StyledToolElement } from "./styles"; export const ZoomMenu = () => { diff --git a/src/containers/Toolbar/index.tsx b/src/features/editor/Toolbar/index.tsx similarity index 97% rename from src/containers/Toolbar/index.tsx rename to src/features/editor/Toolbar/index.tsx index 415da12..7b12870 100644 --- a/src/containers/Toolbar/index.tsx +++ b/src/features/editor/Toolbar/index.tsx @@ -5,8 +5,8 @@ import toast from "react-hot-toast"; import { AiOutlineFullscreen } from "react-icons/ai"; import { FiDownload } from "react-icons/fi"; import { LuCrown } from "react-icons/lu"; -import { SearchInput } from "src/containers/Toolbar/SearchInput"; import { type FileFormat, formats } from "src/enums/file.enum"; +import { SearchInput } from "src/features/editor/Toolbar/SearchInput"; import { JSONCrackLogo } from "src/layout/JsonCrackLogo"; import useFile from "src/store/useFile"; import useModal from "src/store/useModal"; diff --git a/src/containers/Toolbar/styles.ts b/src/features/editor/Toolbar/styles.ts similarity index 100% rename from src/containers/Toolbar/styles.ts rename to src/features/editor/Toolbar/styles.ts diff --git a/src/containers/Editor/components/views/GraphView/CustomEdge/index.tsx b/src/features/editor/views/GraphView/CustomEdge/index.tsx similarity index 100% rename from src/containers/Editor/components/views/GraphView/CustomEdge/index.tsx rename to src/features/editor/views/GraphView/CustomEdge/index.tsx diff --git a/src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx b/src/features/editor/views/GraphView/CustomNode/ObjectNode.tsx similarity index 92% rename from src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx rename to src/features/editor/views/GraphView/CustomNode/ObjectNode.tsx index 64e8c85..4d50272 100644 --- a/src/containers/Editor/components/views/GraphView/CustomNode/ObjectNode.tsx +++ b/src/features/editor/views/GraphView/CustomNode/ObjectNode.tsx @@ -1,5 +1,5 @@ import React from "react"; -import type { CustomNodeProps } from "src/containers/Editor/components/views/GraphView/CustomNode"; +import type { CustomNodeProps } from "src/features/editor/views/GraphView/CustomNode"; import { TextRenderer } from "./TextRenderer"; import * as Styled from "./styles"; diff --git a/src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx b/src/features/editor/views/GraphView/CustomNode/TextNode.tsx similarity index 92% rename from src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx rename to src/features/editor/views/GraphView/CustomNode/TextNode.tsx index 91c48f6..f223f03 100644 --- a/src/containers/Editor/components/views/GraphView/CustomNode/TextNode.tsx +++ b/src/features/editor/views/GraphView/CustomNode/TextNode.tsx @@ -1,9 +1,9 @@ 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 type { CustomNodeProps } from "src/features/editor/views/GraphView/CustomNode"; +import { isContentImage } from "src/features/editor/views/GraphView/lib/utils/calculateNodeSize"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useToggleHide from "src/hooks/useToggleHide"; import useConfig from "src/store/useConfig"; import { TextRenderer } from "./TextRenderer"; diff --git a/src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx b/src/features/editor/views/GraphView/CustomNode/TextRenderer.tsx similarity index 100% rename from src/containers/Editor/components/views/GraphView/CustomNode/TextRenderer.tsx rename to src/features/editor/views/GraphView/CustomNode/TextRenderer.tsx diff --git a/src/containers/Editor/components/views/GraphView/CustomNode/index.tsx b/src/features/editor/views/GraphView/CustomNode/index.tsx similarity index 94% rename from src/containers/Editor/components/views/GraphView/CustomNode/index.tsx rename to src/features/editor/views/GraphView/CustomNode/index.tsx index 05196d7..485d2ce 100644 --- a/src/containers/Editor/components/views/GraphView/CustomNode/index.tsx +++ b/src/features/editor/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/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/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/containers/Editor/components/views/GraphView/CustomNode/styles.tsx b/src/features/editor/views/GraphView/CustomNode/styles.tsx similarity index 100% rename from src/containers/Editor/components/views/GraphView/CustomNode/styles.tsx rename to src/features/editor/views/GraphView/CustomNode/styles.tsx diff --git a/src/containers/Editor/components/views/GraphView/NotSupported.tsx b/src/features/editor/views/GraphView/NotSupported.tsx similarity index 100% rename from src/containers/Editor/components/views/GraphView/NotSupported.tsx rename to src/features/editor/views/GraphView/NotSupported.tsx diff --git a/src/containers/Editor/components/views/GraphView/index.tsx b/src/features/editor/views/GraphView/index.tsx similarity index 97% rename from src/containers/Editor/components/views/GraphView/index.tsx rename to src/features/editor/views/GraphView/index.tsx index 7809703..ea5dc8e 100644 --- a/src/containers/Editor/components/views/GraphView/index.tsx +++ b/src/features/editor/views/GraphView/index.tsx @@ -6,8 +6,8 @@ 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 { CustomNode } from "src/features/editor/views/GraphView/CustomNode"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useToggleHide from "src/hooks/useToggleHide"; import useConfig from "src/store/useConfig"; import { CustomEdge } from "./CustomEdge"; diff --git a/src/containers/Editor/components/views/GraphView/lib/jsonParser.ts b/src/features/editor/views/GraphView/lib/jsonParser.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/jsonParser.ts rename to src/features/editor/views/GraphView/lib/jsonParser.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/addEdgeToGraph.ts b/src/features/editor/views/GraphView/lib/utils/addEdgeToGraph.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/utils/addEdgeToGraph.ts rename to src/features/editor/views/GraphView/lib/utils/addEdgeToGraph.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts b/src/features/editor/views/GraphView/lib/utils/addNodeToGraph.ts similarity index 75% rename from src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts rename to src/features/editor/views/GraphView/lib/utils/addNodeToGraph.ts index 4e291dc..0375090 100644 --- a/src/containers/Editor/components/views/GraphView/lib/utils/addNodeToGraph.ts +++ b/src/features/editor/views/GraphView/lib/utils/addNodeToGraph.ts @@ -1,6 +1,6 @@ import type { NodeType } from "jsonc-parser"; -import type { Graph } from "src/containers/Editor/components/views/GraphView/lib/jsonParser"; -import { calculateNodeSize } from "src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize"; +import type { Graph } from "src/features/editor/views/GraphView/lib/jsonParser"; +import { calculateNodeSize } from "src/features/editor/views/GraphView/lib/utils/calculateNodeSize"; type Props = { graph: Graph; diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize.ts b/src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/utils/calculateNodeSize.ts rename to src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/getChildrenEdges.ts b/src/features/editor/views/GraphView/lib/utils/getChildrenEdges.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/utils/getChildrenEdges.ts rename to src/features/editor/views/GraphView/lib/utils/getChildrenEdges.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/getNodePath.ts b/src/features/editor/views/GraphView/lib/utils/getNodePath.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/utils/getNodePath.ts rename to src/features/editor/views/GraphView/lib/utils/getNodePath.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/getOutgoers.ts b/src/features/editor/views/GraphView/lib/utils/getOutgoers.ts similarity index 100% rename from src/containers/Editor/components/views/GraphView/lib/utils/getOutgoers.ts rename to src/features/editor/views/GraphView/lib/utils/getOutgoers.ts diff --git a/src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts b/src/features/editor/views/GraphView/lib/utils/traverse.ts similarity index 97% rename from src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts rename to src/features/editor/views/GraphView/lib/utils/traverse.ts index b66ff45..8ce490d 100644 --- a/src/containers/Editor/components/views/GraphView/lib/utils/traverse.ts +++ b/src/features/editor/views/GraphView/lib/utils/traverse.ts @@ -1,9 +1,6 @@ import type { Node, NodeType } from "jsonc-parser"; -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 type { Graph, States } from "src/features/editor/views/GraphView/lib/jsonParser"; +import { calculateNodeSize } from "src/features/editor/views/GraphView/lib/utils/calculateNodeSize"; import { addEdgeToGraph } from "./addEdgeToGraph"; import { addNodeToGraph } from "./addNodeToGraph"; diff --git a/src/containers/Editor/components/views/GraphView/stores/useGraph.ts b/src/features/editor/views/GraphView/stores/useGraph.ts similarity index 95% rename from src/containers/Editor/components/views/GraphView/stores/useGraph.ts rename to src/features/editor/views/GraphView/stores/useGraph.ts index 938712e..8ab1c85 100644 --- a/src/containers/Editor/components/views/GraphView/stores/useGraph.ts +++ b/src/features/editor/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/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 { parser } from "src/features/editor/views/GraphView/lib/jsonParser"; +import { getChildrenEdges } from "src/features/editor/views/GraphView/lib/utils/getChildrenEdges"; +import { getOutgoers } from "src/features/editor/views/GraphView/lib/utils/getOutgoers"; +import useJson from "src/store/useJson"; import type { NodeData, EdgeData } from "src/types/graph"; -import useJson from "../../../../../../store/useJson"; export interface Graph { viewPort: ViewPort | null; diff --git a/src/containers/Editor/components/views/TreeView/Label.tsx b/src/features/editor/views/TreeView/Label.tsx similarity index 100% rename from src/containers/Editor/components/views/TreeView/Label.tsx rename to src/features/editor/views/TreeView/Label.tsx diff --git a/src/containers/Editor/components/views/TreeView/Value.tsx b/src/features/editor/views/TreeView/Value.tsx similarity index 90% rename from src/containers/Editor/components/views/TreeView/Value.tsx rename to src/features/editor/views/TreeView/Value.tsx index e877f27..1e3c65f 100644 --- a/src/containers/Editor/components/views/TreeView/Value.tsx +++ b/src/features/editor/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/containers/Editor/components/views/GraphView/CustomNode/TextRenderer"; +import { TextRenderer } from "src/features/editor/views/GraphView/CustomNode/TextRenderer"; type TextColorFn = { theme: DefaultTheme; diff --git a/src/containers/Editor/components/views/TreeView/index.tsx b/src/features/editor/views/TreeView/index.tsx similarity index 100% rename from src/containers/Editor/components/views/TreeView/index.tsx rename to src/features/editor/views/TreeView/index.tsx diff --git a/src/containers/Modals/DownloadModal/index.tsx b/src/features/modals/DownloadModal/index.tsx similarity index 100% rename from src/containers/Modals/DownloadModal/index.tsx rename to src/features/modals/DownloadModal/index.tsx diff --git a/src/containers/Modals/ImportModal/index.tsx b/src/features/modals/ImportModal/index.tsx similarity index 100% rename from src/containers/Modals/ImportModal/index.tsx rename to src/features/modals/ImportModal/index.tsx diff --git a/src/containers/Modals/JPathModal/index.tsx b/src/features/modals/JPathModal/index.tsx similarity index 100% rename from src/containers/Modals/JPathModal/index.tsx rename to src/features/modals/JPathModal/index.tsx diff --git a/src/containers/Modals/JQModal/index.tsx b/src/features/modals/JQModal/index.tsx similarity index 100% rename from src/containers/Modals/JQModal/index.tsx rename to src/features/modals/JQModal/index.tsx diff --git a/src/containers/Modals/JWTModal/index.tsx b/src/features/modals/JWTModal/index.tsx similarity index 100% rename from src/containers/Modals/JWTModal/index.tsx rename to src/features/modals/JWTModal/index.tsx diff --git a/src/containers/Modals/NodeModal/index.tsx b/src/features/modals/NodeModal/index.tsx similarity index 95% rename from src/containers/Modals/NodeModal/index.tsx rename to src/features/modals/NodeModal/index.tsx index ef3d671..68b3fa6 100644 --- a/src/containers/Modals/NodeModal/index.tsx +++ b/src/features/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/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useModal from "src/store/useModal"; const dataToString = (data: any) => { diff --git a/src/containers/Modals/SchemaModal/index.tsx b/src/features/modals/SchemaModal/index.tsx similarity index 100% rename from src/containers/Modals/SchemaModal/index.tsx rename to src/features/modals/SchemaModal/index.tsx diff --git a/src/containers/Modals/TypeModal/index.tsx b/src/features/modals/TypeModal/index.tsx similarity index 100% rename from src/containers/Modals/TypeModal/index.tsx rename to src/features/modals/TypeModal/index.tsx diff --git a/src/containers/Modals/UpgradeModal/index.tsx b/src/features/modals/UpgradeModal/index.tsx similarity index 100% rename from src/containers/Modals/UpgradeModal/index.tsx rename to src/features/modals/UpgradeModal/index.tsx diff --git a/src/containers/Modals/index.ts b/src/features/modals/index.ts similarity index 100% rename from src/containers/Modals/index.ts rename to src/features/modals/index.ts diff --git a/src/hooks/useFocusNode.ts b/src/hooks/useFocusNode.ts index fab3234..28d672c 100644 --- a/src/hooks/useFocusNode.ts +++ b/src/hooks/useFocusNode.ts @@ -1,7 +1,7 @@ import React from "react"; import { useDebouncedValue } from "@mantine/hooks"; import { event as gaEvent } from "nextjs-google-analytics"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import { searchQuery, cleanupHighlight, highlightMatchedNodes } from "src/lib/utils/search"; export const useFocusNode = () => { diff --git a/src/hooks/useToggleHide.ts b/src/hooks/useToggleHide.ts index 0552794..690d75b 100644 --- a/src/hooks/useToggleHide.ts +++ b/src/hooks/useToggleHide.ts @@ -1,5 +1,5 @@ import React from "react"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; const useToggleHide = () => { const getCollapsedNodeIds = useGraph(state => state.getCollapsedNodeIds); diff --git a/src/containers/ConverterLayout/PageLinks.tsx b/src/layout/ConverterLayout/PageLinks.tsx similarity index 100% rename from src/containers/ConverterLayout/PageLinks.tsx rename to src/layout/ConverterLayout/PageLinks.tsx diff --git a/src/containers/ConverterLayout/ToolPage.tsx b/src/layout/ConverterLayout/ToolPage.tsx similarity index 95% rename from src/containers/ConverterLayout/ToolPage.tsx rename to src/layout/ConverterLayout/ToolPage.tsx index bce8715..34d35ed 100644 --- a/src/containers/ConverterLayout/ToolPage.tsx +++ b/src/layout/ConverterLayout/ToolPage.tsx @@ -4,10 +4,10 @@ import { Editor } from "@monaco-editor/react"; import { NextSeo } from "next-seo"; import { LuCheck, LuXCircle } from "react-icons/lu"; import { SEO } from "src/constants/seo"; -import { PageLinks } from "src/containers/ConverterLayout/PageLinks"; -import { editorOptions } from "src/containers/ConverterLayout/options"; import { type FileFormat, formats } from "src/enums/file.enum"; -import Layout from "src/layout/Layout"; +import { PageLinks } from "src/layout/ConverterLayout/PageLinks"; +import { editorOptions } from "src/layout/ConverterLayout/options"; +import Layout from "src/layout/PageLayout"; import { contentToJson, jsonToContent } from "src/lib/utils/jsonAdapter"; interface ToolPageProps { diff --git a/src/containers/ConverterLayout/options.ts b/src/layout/ConverterLayout/options.ts similarity index 100% rename from src/containers/ConverterLayout/options.ts rename to src/layout/ConverterLayout/options.ts diff --git a/src/containers/Landing/FAQ.tsx b/src/layout/Landing/FAQ.tsx similarity index 100% rename from src/containers/Landing/FAQ.tsx rename to src/layout/Landing/FAQ.tsx diff --git a/src/containers/Landing/Features.tsx b/src/layout/Landing/Features.tsx similarity index 100% rename from src/containers/Landing/Features.tsx rename to src/layout/Landing/Features.tsx diff --git a/src/containers/Landing/HeroPreview.tsx b/src/layout/Landing/HeroPreview.tsx similarity index 100% rename from src/containers/Landing/HeroPreview.tsx rename to src/layout/Landing/HeroPreview.tsx diff --git a/src/containers/Landing/HeroSection.tsx b/src/layout/Landing/HeroSection.tsx similarity index 100% rename from src/containers/Landing/HeroSection.tsx rename to src/layout/Landing/HeroSection.tsx diff --git a/src/containers/Landing/LovedBy.tsx b/src/layout/Landing/LovedBy.tsx similarity index 100% rename from src/containers/Landing/LovedBy.tsx rename to src/layout/Landing/LovedBy.tsx diff --git a/src/containers/Landing/Section1.tsx b/src/layout/Landing/Section1.tsx similarity index 100% rename from src/containers/Landing/Section1.tsx rename to src/layout/Landing/Section1.tsx diff --git a/src/containers/Landing/SeePremium.tsx b/src/layout/Landing/SeePremium.tsx similarity index 100% rename from src/containers/Landing/SeePremium.tsx rename to src/layout/Landing/SeePremium.tsx diff --git a/src/layout/Footer.tsx b/src/layout/PageLayout/Footer.tsx similarity index 98% rename from src/layout/Footer.tsx rename to src/layout/PageLayout/Footer.tsx index 6a7bf9c..c539d0e 100644 --- a/src/layout/Footer.tsx +++ b/src/layout/PageLayout/Footer.tsx @@ -4,7 +4,7 @@ import { Anchor, Container, Divider, Flex, Stack, Text, ThemeIcon } from "@manti import dayjs from "dayjs"; import { FaDiscord, FaGithub, FaLinkedin } from "react-icons/fa"; import { FaXTwitter } from "react-icons/fa6"; -import { JSONCrackLogo } from "./JsonCrackLogo"; +import { JSONCrackLogo } from "../JsonCrackLogo"; export const Footer = () => { return ( diff --git a/src/layout/Navbar.tsx b/src/layout/PageLayout/Navbar.tsx similarity index 98% rename from src/layout/Navbar.tsx rename to src/layout/PageLayout/Navbar.tsx index 15482d6..cf19dbd 100644 --- a/src/layout/Navbar.tsx +++ b/src/layout/PageLayout/Navbar.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { Button, Menu, type MenuItemProps, Text, Stack } from "@mantine/core"; import styled from "styled-components"; import { LuChevronDown } from "react-icons/lu"; -import { JSONCrackLogo } from "./JsonCrackLogo"; +import { JSONCrackLogo } from "../JsonCrackLogo"; const StyledNavbarWrapper = styled.div` z-index: 3; diff --git a/src/layout/Layout.tsx b/src/layout/PageLayout/index.tsx similarity index 76% rename from src/layout/Layout.tsx rename to src/layout/PageLayout/index.tsx index 2832111..46599bf 100644 --- a/src/layout/Layout.tsx +++ b/src/layout/PageLayout/index.tsx @@ -11,12 +11,10 @@ const inter = Inter({ const StyledLayoutWrapper = styled.div` background: #fff; - /* background-image: radial-gradient(#ededed 2px, #ffffff 2px); */ - /* background-size: 40px 40px; */ font-family: ${inter.style.fontFamily}; `; -const Layout = ({ children }: React.PropsWithChildren) => { +const PageLayout = ({ children }: React.PropsWithChildren) => { return ( @@ -28,4 +26,4 @@ const Layout = ({ children }: React.PropsWithChildren) => { ); }; -export default Layout; +export default PageLayout; diff --git a/src/containers/TypeLayout/PageLinks.tsx b/src/layout/TypeLayout/PageLinks.tsx similarity index 100% rename from src/containers/TypeLayout/PageLinks.tsx rename to src/layout/TypeLayout/PageLinks.tsx diff --git a/src/containers/TypeLayout/TypegenWrapper.tsx b/src/layout/TypeLayout/TypegenWrapper.tsx similarity index 96% rename from src/containers/TypeLayout/TypegenWrapper.tsx rename to src/layout/TypeLayout/TypegenWrapper.tsx index febfc6b..f6f07e1 100644 --- a/src/containers/TypeLayout/TypegenWrapper.tsx +++ b/src/layout/TypeLayout/TypegenWrapper.tsx @@ -4,9 +4,9 @@ import { Editor } from "@monaco-editor/react"; import { NextSeo } from "next-seo"; import { LuCheck, LuXCircle } from "react-icons/lu"; import { SEO } from "src/constants/seo"; -import { editorOptions } from "src/containers/ConverterLayout/options"; import { type FileFormat, formats, type TypeLanguage, typeOptions } from "src/enums/file.enum"; -import Layout from "src/layout/Layout"; +import { editorOptions } from "src/layout/ConverterLayout/options"; +import Layout from "src/layout/PageLayout"; import { generateType } from "src/lib/utils/generateType"; import { PageLinks } from "./PageLinks"; diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 7441a71..19f5910 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { Button, Stack, Text, Title } from "@mantine/core"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; -import Layout from "src/layout/Layout"; +import Layout from "src/layout/PageLayout"; const NotFound = () => { return ( diff --git a/src/pages/_error.tsx b/src/pages/_error.tsx index 390ef7d..8a927a3 100644 --- a/src/pages/_error.tsx +++ b/src/pages/_error.tsx @@ -3,7 +3,7 @@ import { useRouter } from "next/router"; import { Button, Stack, Text, Title } from "@mantine/core"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; -import Layout from "src/layout/Layout"; +import Layout from "src/layout/PageLayout"; const Custom500 = () => { const router = useRouter(); diff --git a/src/pages/converter/csv-to-json.tsx b/src/pages/converter/csv-to-json.tsx index daf4a36..241515d 100644 --- a/src/pages/converter/csv-to-json.tsx +++ b/src/pages/converter/csv-to-json.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/csv-to-xml.tsx b/src/pages/converter/csv-to-xml.tsx index c214f64..1d7d3f6 100644 --- a/src/pages/converter/csv-to-xml.tsx +++ b/src/pages/converter/csv-to-xml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/csv-to-yaml.tsx b/src/pages/converter/csv-to-yaml.tsx index 318b8d4..ede1065 100644 --- a/src/pages/converter/csv-to-yaml.tsx +++ b/src/pages/converter/csv-to-yaml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/json-to-csv.tsx b/src/pages/converter/json-to-csv.tsx index 8f31fb3..62bd8ec 100644 --- a/src/pages/converter/json-to-csv.tsx +++ b/src/pages/converter/json-to-csv.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/json-to-xml.tsx b/src/pages/converter/json-to-xml.tsx index b58f62b..a0b776d 100644 --- a/src/pages/converter/json-to-xml.tsx +++ b/src/pages/converter/json-to-xml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/json-to-yaml.tsx b/src/pages/converter/json-to-yaml.tsx index 1b2177e..84d7ddb 100644 --- a/src/pages/converter/json-to-yaml.tsx +++ b/src/pages/converter/json-to-yaml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/xml-to-csv.tsx b/src/pages/converter/xml-to-csv.tsx index 813ab42..dc847aa 100644 --- a/src/pages/converter/xml-to-csv.tsx +++ b/src/pages/converter/xml-to-csv.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/xml-to-json.tsx b/src/pages/converter/xml-to-json.tsx index 71d9223..932fc52 100644 --- a/src/pages/converter/xml-to-json.tsx +++ b/src/pages/converter/xml-to-json.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/xml-to-yaml.tsx b/src/pages/converter/xml-to-yaml.tsx index c5718c8..45b06e3 100644 --- a/src/pages/converter/xml-to-yaml.tsx +++ b/src/pages/converter/xml-to-yaml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/yaml-to-csv.tsx b/src/pages/converter/yaml-to-csv.tsx index cdf404f..d5357b7 100644 --- a/src/pages/converter/yaml-to-csv.tsx +++ b/src/pages/converter/yaml-to-csv.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/yaml-to-json.tsx b/src/pages/converter/yaml-to-json.tsx index 5b9b4f2..9500c1a 100644 --- a/src/pages/converter/yaml-to-json.tsx +++ b/src/pages/converter/yaml-to-json.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/converter/yaml-to-xml.tsx b/src/pages/converter/yaml-to-xml.tsx index fc7e997..d029e9c 100644 --- a/src/pages/converter/yaml-to-xml.tsx +++ b/src/pages/converter/yaml-to-xml.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { ToolPage } from "src/containers/ConverterLayout/ToolPage"; import { FileFormat } from "src/enums/file.enum"; +import { ToolPage } from "src/layout/ConverterLayout/ToolPage"; const Page = () => { return ; diff --git a/src/pages/docs.tsx b/src/pages/docs.tsx index b427a4e..f9938ff 100644 --- a/src/pages/docs.tsx +++ b/src/pages/docs.tsx @@ -4,7 +4,7 @@ import { CodeHighlight } from "@mantine/code-highlight"; import styled from "styled-components"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; -import Layout from "src/layout/Layout"; +import Layout from "src/layout/PageLayout"; const StyledFrame = styled.iframe` border: none; diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx index a9f7ac3..532e9f1 100644 --- a/src/pages/editor.tsx +++ b/src/pages/editor.tsx @@ -5,17 +5,20 @@ import { useMantineColorScheme } from "@mantine/core"; import "@mantine/dropzone/styles.css"; import styled, { ThemeProvider } from "styled-components"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { Allotment } from "allotment"; +import "allotment/dist/style.css"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; import { darkTheme, lightTheme } from "src/constants/theme"; -import { Editor } from "src/containers/Editor"; -import { BottomBar } from "src/containers/Editor/components/BottomBar"; -import { Toolbar } from "src/containers/Toolbar"; +import { BottomBar } from "src/features/editor/BottomBar"; +import { FullscreenDropzone } from "src/features/editor/FullscreenDropzone"; +import { Toolbar } from "src/features/editor/Toolbar"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useConfig from "src/store/useConfig"; import useFile from "src/store/useFile"; -const ModalController = dynamic(() => import("src/layout/ModalController")); -const ExternalMode = dynamic(() => import("src/layout/ExternalMode")); +const ModalController = dynamic(() => import("src/features/editor/ModalController")); +const ExternalMode = dynamic(() => import("src/features/editor/ExternalMode")); const queryClient = new QueryClient({ defaultOptions: { @@ -41,11 +44,31 @@ export const StyledEditorWrapper = styled.div` overflow: hidden; `; +export const StyledEditor = styled(Allotment)` + position: relative !important; + display: flex; + background: ${({ theme }) => theme.BACKGROUND_SECONDARY}; + height: calc(100vh - 67px); + + @media only screen and (max-width: 320px) { + height: 100vh; + } +`; + +const TextEditor = dynamic(() => import("src/features/editor/TextEditor"), { + ssr: false, +}); + +const LiveEditor = dynamic(() => import("src/features/editor/LiveEditor"), { + ssr: false, +}); + const EditorPage = () => { const { query, isReady } = useRouter(); const { setColorScheme } = useMantineColorScheme(); const checkEditorSession = useFile(state => state.checkEditorSession); const darkmodeEnabled = useConfig(state => state.darkmodeEnabled); + const fullscreen = useGraph(state => state.fullscreen); React.useEffect(() => { if (isReady) checkEditorSession(query?.json); @@ -71,7 +94,20 @@ const EditorPage = () => { - + + + + + + + + + diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 19de3a3..59621bc 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -2,14 +2,14 @@ import React from "react"; import type { InferGetStaticPropsType, GetStaticProps } from "next"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; -import { FAQ } from "src/containers/Landing/FAQ"; -import { Features } from "src/containers/Landing/Features"; -import { HeroPreview } from "src/containers/Landing/HeroPreview"; -import { HeroSection } from "src/containers/Landing/HeroSection"; -import { LovedBy } from "src/containers/Landing/LovedBy"; -import { Section1 } from "src/containers/Landing/Section1"; -import { SeePremium } from "src/containers/Landing/SeePremium"; -import Layout from "src/layout/Layout"; +import { FAQ } from "src/layout/Landing/FAQ"; +import { Features } from "src/layout/Landing/Features"; +import { HeroPreview } from "src/layout/Landing/HeroPreview"; +import { HeroSection } from "src/layout/Landing/HeroSection"; +import { LovedBy } from "src/layout/Landing/LovedBy"; +import { Section1 } from "src/layout/Landing/Section1"; +import { SeePremium } from "src/layout/Landing/SeePremium"; +import Layout from "src/layout/PageLayout"; export const HomePage = (props: InferGetStaticPropsType) => { return ( diff --git a/src/pages/legal/privacy.tsx b/src/pages/legal/privacy.tsx index 9e17666..b7762e1 100644 --- a/src/pages/legal/privacy.tsx +++ b/src/pages/legal/privacy.tsx @@ -3,7 +3,7 @@ import { Box, Container, Paper, Stack, Text, Title } from "@mantine/core"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; import privacy from "src/data/privacy.json"; -import Layout from "src/layout/Layout"; +import Layout from "src/layout/PageLayout"; const Privacy = () => { return ( diff --git a/src/pages/legal/terms.tsx b/src/pages/legal/terms.tsx index ca8ab01..1a2f453 100644 --- a/src/pages/legal/terms.tsx +++ b/src/pages/legal/terms.tsx @@ -3,7 +3,7 @@ import { Box, Container, Paper, Stack, Text, Title } from "@mantine/core"; import { NextSeo } from "next-seo"; import { SEO } from "src/constants/seo"; import terms from "src/data/terms.json"; -import Layout from "src/layout/Layout"; +import Layout from "src/layout/PageLayout"; const Terms = () => { return ( diff --git a/src/pages/tools/json-schema.tsx b/src/pages/tools/json-schema.tsx index 0072203..bdacd75 100644 --- a/src/pages/tools/json-schema.tsx +++ b/src/pages/tools/json-schema.tsx @@ -3,9 +3,9 @@ import { Box, Button, Container, Flex, Paper, Title, Text } from "@mantine/core" import { Editor, type OnMount } from "@monaco-editor/react"; import { JSONSchemaFaker } from "json-schema-faker"; import { LuCheck, LuXCircle } from "react-icons/lu"; -import { editorOptions } from "src/containers/ConverterLayout/options"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; -import Layout from "src/layout/Layout"; +import { editorOptions } from "src/layout/ConverterLayout/options"; +import Layout from "src/layout/PageLayout"; import { generateType } from "src/lib/utils/generateType"; import { jsonToContent } from "src/lib/utils/jsonAdapter"; diff --git a/src/pages/type/csv-to-go.tsx b/src/pages/type/csv-to-go.tsx index 9da125d..ad5797c 100644 --- a/src/pages/type/csv-to-go.tsx +++ b/src/pages/type/csv-to-go.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/csv-to-kotlin.tsx b/src/pages/type/csv-to-kotlin.tsx index 128954f..fa6ae43 100644 --- a/src/pages/type/csv-to-kotlin.tsx +++ b/src/pages/type/csv-to-kotlin.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/csv-to-rust.tsx b/src/pages/type/csv-to-rust.tsx index 6bbf0a2..9fa67f3 100644 --- a/src/pages/type/csv-to-rust.tsx +++ b/src/pages/type/csv-to-rust.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/csv-to-typescript.tsx b/src/pages/type/csv-to-typescript.tsx index c43b92e..94cc5df 100644 --- a/src/pages/type/csv-to-typescript.tsx +++ b/src/pages/type/csv-to-typescript.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/json-to-go.tsx b/src/pages/type/json-to-go.tsx index 9e8c9e4..2ff24a6 100644 --- a/src/pages/type/json-to-go.tsx +++ b/src/pages/type/json-to-go.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/json-to-kotlin.tsx b/src/pages/type/json-to-kotlin.tsx index a1be479..368fa91 100644 --- a/src/pages/type/json-to-kotlin.tsx +++ b/src/pages/type/json-to-kotlin.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/json-to-rust.tsx b/src/pages/type/json-to-rust.tsx index 9cafb3c..4934d17 100644 --- a/src/pages/type/json-to-rust.tsx +++ b/src/pages/type/json-to-rust.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/json-to-typescript.tsx b/src/pages/type/json-to-typescript.tsx index c35f51f..6407d56 100644 --- a/src/pages/type/json-to-typescript.tsx +++ b/src/pages/type/json-to-typescript.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/xml-to-go.tsx b/src/pages/type/xml-to-go.tsx index 9a3fd19..ef987aa 100644 --- a/src/pages/type/xml-to-go.tsx +++ b/src/pages/type/xml-to-go.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/xml-to-kotlin.tsx b/src/pages/type/xml-to-kotlin.tsx index 540f1b1..42c552d 100644 --- a/src/pages/type/xml-to-kotlin.tsx +++ b/src/pages/type/xml-to-kotlin.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/xml-to-rust.tsx b/src/pages/type/xml-to-rust.tsx index 03804b2..d6dc1da 100644 --- a/src/pages/type/xml-to-rust.tsx +++ b/src/pages/type/xml-to-rust.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/xml-to-typescript.tsx b/src/pages/type/xml-to-typescript.tsx index a4a0020..2eef55a 100644 --- a/src/pages/type/xml-to-typescript.tsx +++ b/src/pages/type/xml-to-typescript.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/yaml-to-go.tsx b/src/pages/type/yaml-to-go.tsx index ec0956b..2220ac5 100644 --- a/src/pages/type/yaml-to-go.tsx +++ b/src/pages/type/yaml-to-go.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/yaml-to-kotlin.tsx b/src/pages/type/yaml-to-kotlin.tsx index 99c2fae..d135bc6 100644 --- a/src/pages/type/yaml-to-kotlin.tsx +++ b/src/pages/type/yaml-to-kotlin.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/yaml-to-rust.tsx b/src/pages/type/yaml-to-rust.tsx index e54e0fc..e862b9b 100644 --- a/src/pages/type/yaml-to-rust.tsx +++ b/src/pages/type/yaml-to-rust.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/type/yaml-to-typescript.tsx b/src/pages/type/yaml-to-typescript.tsx index 5af7c04..cee2434 100644 --- a/src/pages/type/yaml-to-typescript.tsx +++ b/src/pages/type/yaml-to-typescript.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { TypegenWrapper } from "src/containers/TypeLayout/TypegenWrapper"; import { FileFormat, TypeLanguage } from "src/enums/file.enum"; +import { TypegenWrapper } from "src/layout/TypeLayout/TypegenWrapper"; const TypePage = () => { return ; diff --git a/src/pages/widget.tsx b/src/pages/widget.tsx index 0bfec74..d8d7b17 100644 --- a/src/pages/widget.tsx +++ b/src/pages/widget.tsx @@ -6,8 +6,8 @@ import { ThemeProvider } from "styled-components"; import { NextSeo } from "next-seo"; import toast from "react-hot-toast"; import { darkTheme, lightTheme } from "src/constants/theme"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; -import { Toolbar } from "src/containers/Toolbar"; +import { Toolbar } from "src/features/editor/Toolbar"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; import useFile from "src/store/useFile"; import type { LayoutDirection } from "src/types/graph"; @@ -22,7 +22,7 @@ interface EmbedMessage { } const GraphView = dynamic( - () => import("src/containers/Editor/components/views/GraphView").then(c => c.GraphView), + () => import("src/features/editor/views/GraphView").then(c => c.GraphView), { ssr: false, } diff --git a/src/store/useConfig.ts b/src/store/useConfig.ts index 60bc8c0..d026e37 100644 --- a/src/store/useConfig.ts +++ b/src/store/useConfig.ts @@ -1,7 +1,7 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; import { ViewMode } from "src/enums/viewMode.enum"; -import useGraph from "../containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "../features/editor/views/GraphView/stores/useGraph"; const initialStates = { darkmodeEnabled: false, diff --git a/src/store/useFile.ts b/src/store/useFile.ts index 9d4c35e..e4f99d0 100644 --- a/src/store/useFile.ts +++ b/src/store/useFile.ts @@ -5,7 +5,7 @@ import { create } from "zustand"; import { FileFormat } from "src/enums/file.enum"; import { isIframe } from "src/lib/utils/helpers"; import { contentToJson, jsonToContent } from "src/lib/utils/jsonAdapter"; -import useGraph from "../containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "../features/editor/views/GraphView/stores/useGraph"; import useConfig from "./useConfig"; import useJson from "./useJson"; diff --git a/src/store/useJson.ts b/src/store/useJson.ts index ba1e95a..2a13fad 100644 --- a/src/store/useJson.ts +++ b/src/store/useJson.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import useGraph from "src/containers/Editor/components/views/GraphView/stores/useGraph"; +import useGraph from "src/features/editor/views/GraphView/stores/useGraph"; interface JsonActions { setJson: (json: string) => void; diff --git a/src/store/useModal.ts b/src/store/useModal.ts index c40f396..d58e123 100644 --- a/src/store/useModal.ts +++ b/src/store/useModal.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import type { Modal } from "src/containers/Modals"; +import type { Modal } from "src/features/modals"; type ModalState = { [key in Modal]: boolean;