From 54f1b08b1d5b167ddbf179ffb3877b884a7e656a Mon Sep 17 00:00:00 2001 From: Eugen Ciur Date: Sat, 7 Sep 2024 15:03:11 +0200 Subject: [PATCH] refactoring --- ui2/src/features/nodes/apiSlice.ts | 11 ----------- ui2/src/features/nodes/components/Commander.tsx | 7 ++++--- .../nodes/components}/EditNodeTagsButton.tsx | 2 +- .../nodes/components}/EditNodeTitleButton.tsx | 2 +- .../{FolderNodeActions => }/FolderNodeActions.tsx | 13 +++++++------ .../nodes/components/FolderNodeActions/index.tsx | 3 --- ui2/src/features/nodes/components/UploadButton.tsx | 2 +- 7 files changed, 14 insertions(+), 26 deletions(-) rename ui2/src/{components/SinglePanel => features/nodes/components}/EditNodeTagsButton.tsx (95%) rename ui2/src/{components/SinglePanel => features/nodes/components}/EditNodeTitleButton.tsx (95%) rename ui2/src/features/nodes/components/{FolderNodeActions => }/FolderNodeActions.tsx (80%) delete mode 100644 ui2/src/features/nodes/components/FolderNodeActions/index.tsx diff --git a/ui2/src/features/nodes/apiSlice.ts b/ui2/src/features/nodes/apiSlice.ts index 2a3a15d57..67a34e945 100644 --- a/ui2/src/features/nodes/apiSlice.ts +++ b/ui2/src/features/nodes/apiSlice.ts @@ -1,10 +1,5 @@ import {apiSlice} from "@/features/api/slice" import type {Paginated, FolderType, NodeType} from "@/types" -import { - uploaderFileItemAdded, - uploaderFileItemFailed, - UpdateFileStatusArg -} from "@/features/ui/uiSlice" type CreateFolderType = { title: string @@ -12,12 +7,6 @@ type CreateFolderType = { ctype: "folder" } -type CreateDocumentNodesType = { - source_files: File[] - target: FolderType - ocr: boolean -} - type RenameFolderType = { title: string id: string diff --git a/ui2/src/features/nodes/components/Commander.tsx b/ui2/src/features/nodes/components/Commander.tsx index 2544a469f..55e985e25 100644 --- a/ui2/src/features/nodes/components/Commander.tsx +++ b/ui2/src/features/nodes/components/Commander.tsx @@ -5,8 +5,6 @@ import {useDisclosure} from "@mantine/hooks" import {useAppSelector, useAppDispatch} from "@/app/hooks" import {useNavigate} from "react-router-dom" -import FolderNodeActions from "@/features/nodes/components/FolderNodeActions" -import Node from "@/features/nodes/components/Node" import { setCurrentNode, selectLastPageSize, @@ -14,7 +12,6 @@ import { fetchPaginatedDocument, selectFilterText } from "@/slices/dualPanel/dualPanel" -import {DropFilesModal} from "@/features/nodes/components/DropFiles" import type {NType, NodeType, PanelMode} from "@/types" import Breadcrumbs from "@/components/Breadcrumbs" @@ -27,6 +24,10 @@ import { useGetPaginatedNodesQuery } from "@/features/nodes/apiSlice" +import Node from "./Node" +import {DropFilesModal} from "./DropFiles" +import FolderNodeActions from "./FolderNodeActions" + export default function Commander() { const [opened, {open, close}] = useDisclosure(false) const [dragOver, setDragOver] = useState(false) diff --git a/ui2/src/components/SinglePanel/EditNodeTagsButton.tsx b/ui2/src/features/nodes/components/EditNodeTagsButton.tsx similarity index 95% rename from ui2/src/components/SinglePanel/EditNodeTagsButton.tsx rename to ui2/src/features/nodes/components/EditNodeTagsButton.tsx index fbcec7f9b..74d380186 100644 --- a/ui2/src/components/SinglePanel/EditNodeTagsButton.tsx +++ b/ui2/src/features/nodes/components/EditNodeTagsButton.tsx @@ -8,7 +8,7 @@ import { selectSelectedNodeIds, clearNodesSelection } from "@/slices/dualPanel/dualPanel" -import {EditNodeTagsModal} from "@/components/modals/EditNodeTags" +import {EditNodeTagsModal} from "@/features/nodes/components/EditNodeTags" import type {RootState} from "@/app/types" diff --git a/ui2/src/components/SinglePanel/EditNodeTitleButton.tsx b/ui2/src/features/nodes/components/EditNodeTitleButton.tsx similarity index 95% rename from ui2/src/components/SinglePanel/EditNodeTitleButton.tsx rename to ui2/src/features/nodes/components/EditNodeTitleButton.tsx index f3a48a75b..431724282 100644 --- a/ui2/src/components/SinglePanel/EditNodeTitleButton.tsx +++ b/ui2/src/features/nodes/components/EditNodeTitleButton.tsx @@ -8,7 +8,7 @@ import { selectSelectedNodeIds, clearNodesSelection } from "@/slices/dualPanel/dualPanel" -import {EditNodeTitleModal} from "@/components/modals/EditNodeTitle" +import {EditNodeTitleModal} from "@/features/nodes/components/EditNodeTitle" import type {RootState} from "@/app/types" diff --git a/ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx b/ui2/src/features/nodes/components/FolderNodeActions.tsx similarity index 80% rename from ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx rename to ui2/src/features/nodes/components/FolderNodeActions.tsx index b0ce6c773..4d989eb31 100644 --- a/ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx +++ b/ui2/src/features/nodes/components/FolderNodeActions.tsx @@ -8,14 +8,15 @@ import {updateActionPanel} from "@/features/ui/uiSlice" import type {RootState} from "@/app/types" import type {PanelMode} from "@/types" import ToggleSecondaryPanel from "@/components/DualPanel/ToggleSecondaryPanel" -import DeleteButton from "@/features/nodes/components/DeleteButton" -import NewFolderButton from "@/features/nodes/components/NewFolderButton" -import UploadButton from "@/features/nodes/components/UploadButton" import PanelContext from "@/contexts/PanelContext" -import EditNodeTagsButton from "@/components/SinglePanel/EditNodeTagsButton" -import EditNodeTitleButton from "@/components/SinglePanel/EditNodeTitleButton" -import QuickFilter from "@/features/nodes/components/QuickFilter" + +import QuickFilter from "./QuickFilter" +import DeleteButton from "./DeleteButton" +import NewFolderButton from "./NewFolderButton" +import UploadButton from "./UploadButton" +import EditNodeTagsButton from "./EditNodeTagsButton" +import EditNodeTitleButton from "./EditNodeTitleButton" export default function FolderNodeActions() { const {height, width} = useViewportSize() diff --git a/ui2/src/features/nodes/components/FolderNodeActions/index.tsx b/ui2/src/features/nodes/components/FolderNodeActions/index.tsx deleted file mode 100644 index 96f699ae9..000000000 --- a/ui2/src/features/nodes/components/FolderNodeActions/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import FolderNodeActions from "./FolderNodeActions" - -export default FolderNodeActions diff --git a/ui2/src/features/nodes/components/UploadButton.tsx b/ui2/src/features/nodes/components/UploadButton.tsx index f7861602d..96e688e25 100644 --- a/ui2/src/features/nodes/components/UploadButton.tsx +++ b/ui2/src/features/nodes/components/UploadButton.tsx @@ -9,7 +9,7 @@ import {PanelMode} from "@/types" import {selectCurrentFolderID} from "@/slices/dualPanel/dualPanel" import {useGetFolderQuery} from "../apiSlice" -import {DropFilesModal} from "@/features/nodes/components/DropFiles" +import {DropFilesModal} from "./DropFiles" const MIME_TYPES = [ "image/png",