diff --git a/ui2/src/components/SinglePanel/SinglePanel.tsx b/ui2/src/components/SinglePanel/SinglePanel.tsx index 2d223a0de..71ded504d 100644 --- a/ui2/src/components/SinglePanel/SinglePanel.tsx +++ b/ui2/src/components/SinglePanel/SinglePanel.tsx @@ -6,7 +6,7 @@ import { selectSearchResults } from "@/slices/dualPanel/dualPanel" import {useSelector} from "react-redux" -import Commander from "@/components/Commander" +import Commander from "@/features/nodes/components/Commander" import Viewer from "@/components/Viewer" import SearchResults from "@/components/SearchResults" import PanelContext from "@/contexts/PanelContext" diff --git a/ui2/src/components/Commander/Commander.module.scss b/ui2/src/features/nodes/components/Commander.module.scss similarity index 100% rename from ui2/src/components/Commander/Commander.module.scss rename to ui2/src/features/nodes/components/Commander.module.scss diff --git a/ui2/src/components/Commander/Commander.tsx b/ui2/src/features/nodes/components/Commander.tsx similarity index 97% rename from ui2/src/components/Commander/Commander.tsx rename to ui2/src/features/nodes/components/Commander.tsx index 62b8e18c2..7a343ee9e 100644 --- a/ui2/src/components/Commander/Commander.tsx +++ b/ui2/src/features/nodes/components/Commander.tsx @@ -4,8 +4,8 @@ import {Group, Stack, Box} from "@mantine/core" import {useAppSelector, useAppDispatch} from "@/app/hooks" import {useNavigate} from "react-router-dom" -import FolderNodeActions from "@/components/Commander/FolderNodeActions" -import Node from "@/components/Node" +import FolderNodeActions from "@/features/nodes/components/FolderNodeActions" +import Node from "@/features/nodes/components/Node" import { setCurrentNode, selectLastPageSize, diff --git a/ui2/src/components/Commander/DeleteButton.tsx b/ui2/src/features/nodes/components/DeleteButton.tsx similarity index 100% rename from ui2/src/components/Commander/DeleteButton.tsx rename to ui2/src/features/nodes/components/DeleteButton.tsx diff --git a/ui2/src/components/Commander/DeleteModal.tsx b/ui2/src/features/nodes/components/DeleteModal.tsx similarity index 100% rename from ui2/src/components/Commander/DeleteModal.tsx rename to ui2/src/features/nodes/components/DeleteModal.tsx diff --git a/ui2/src/components/Commander/FolderNodeActions/FolderNodeActions.tsx b/ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx similarity index 87% rename from ui2/src/components/Commander/FolderNodeActions/FolderNodeActions.tsx rename to ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx index 7ffb079b5..d12dcce03 100644 --- a/ui2/src/components/Commander/FolderNodeActions/FolderNodeActions.tsx +++ b/ui2/src/features/nodes/components/FolderNodeActions/FolderNodeActions.tsx @@ -8,14 +8,14 @@ import {updateActionPanel} from "@/slices/sizes" import type {RootState} from "@/app/types" import type {PanelMode} from "@/types" import ToggleSecondaryPanel from "@/components/DualPanel/ToggleSecondaryPanel" -import DeleteButton from "@/components/Commander/DeleteButton" -import NewFolderButton from "@/components/Commander/NewFolderButton" -import UploadButton from "@/components/Commander/UploadButton" +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 "@/components/Commander/QuickFilter" +import QuickFilter from "@/features/nodes/components/QuickFilter" export default function FolderNodeActions() { const {height, width} = useViewportSize() diff --git a/ui2/src/components/Commander/FolderNodeActions/index.tsx b/ui2/src/features/nodes/components/FolderNodeActions/index.tsx similarity index 100% rename from ui2/src/components/Commander/FolderNodeActions/index.tsx rename to ui2/src/features/nodes/components/FolderNodeActions/index.tsx diff --git a/ui2/src/components/Commander/NewFolderButton.tsx b/ui2/src/features/nodes/components/NewFolderButton.tsx similarity index 100% rename from ui2/src/components/Commander/NewFolderButton.tsx rename to ui2/src/features/nodes/components/NewFolderButton.tsx diff --git a/ui2/src/components/Node/Document/Document.module.scss b/ui2/src/features/nodes/components/Node/Document/Document.module.scss similarity index 100% rename from ui2/src/components/Node/Document/Document.module.scss rename to ui2/src/features/nodes/components/Node/Document/Document.module.scss diff --git a/ui2/src/components/Node/Document/Document.tsx b/ui2/src/features/nodes/components/Node/Document/Document.tsx similarity index 96% rename from ui2/src/components/Node/Document/Document.tsx rename to ui2/src/features/nodes/components/Node/Document/Document.tsx index d61e0f665..de5643653 100644 --- a/ui2/src/components/Node/Document/Document.tsx +++ b/ui2/src/features/nodes/components/Node/Document/Document.tsx @@ -8,7 +8,7 @@ import { selectionRemoveNode } from "@/slices/dualPanel/dualPanel" -import Tags from "@/components/Node/Tags" +import Tags from "@/features/nodes/components/Node/Tags" import type {NodeType, PanelMode} from "@/types" import classes from "./Document.module.scss" import {RootState} from "@/app/types" diff --git a/ui2/src/components/Node/Folder/Folder.module.scss b/ui2/src/features/nodes/components/Node/Folder/Folder.module.scss similarity index 100% rename from ui2/src/components/Node/Folder/Folder.module.scss rename to ui2/src/features/nodes/components/Node/Folder/Folder.module.scss diff --git a/ui2/src/components/Node/Folder/Folder.tsx b/ui2/src/features/nodes/components/Node/Folder/Folder.tsx similarity index 96% rename from ui2/src/components/Node/Folder/Folder.tsx rename to ui2/src/features/nodes/components/Node/Folder/Folder.tsx index 125cc3738..2fc69120c 100644 --- a/ui2/src/components/Node/Folder/Folder.tsx +++ b/ui2/src/features/nodes/components/Node/Folder/Folder.tsx @@ -8,7 +8,7 @@ import { selectionRemoveNode } from "@/slices/dualPanel/dualPanel" -import Tags from "@/components/Node/Tags" +import Tags from "@/features/nodes/components/Node/Tags" import classes from "./Folder.module.scss" import {RootState} from "@/app/types" import type {NodeType, PanelMode} from "@/types" diff --git a/ui2/src/components/Node/Node.module.scss b/ui2/src/features/nodes/components/Node/Node.module.scss similarity index 100% rename from ui2/src/components/Node/Node.module.scss rename to ui2/src/features/nodes/components/Node/Node.module.scss diff --git a/ui2/src/components/Node/Node.tsx b/ui2/src/features/nodes/components/Node/Node.tsx similarity index 100% rename from ui2/src/components/Node/Node.tsx rename to ui2/src/features/nodes/components/Node/Node.tsx diff --git a/ui2/src/components/Node/Tags/Tags.module.css b/ui2/src/features/nodes/components/Node/Tags/Tags.module.css similarity index 100% rename from ui2/src/components/Node/Tags/Tags.module.css rename to ui2/src/features/nodes/components/Node/Tags/Tags.module.css diff --git a/ui2/src/components/Node/Tags/index.tsx b/ui2/src/features/nodes/components/Node/Tags/index.tsx similarity index 100% rename from ui2/src/components/Node/Tags/index.tsx rename to ui2/src/features/nodes/components/Node/Tags/index.tsx diff --git a/ui2/src/components/Node/index.tsx b/ui2/src/features/nodes/components/Node/index.tsx similarity index 100% rename from ui2/src/components/Node/index.tsx rename to ui2/src/features/nodes/components/Node/index.tsx diff --git a/ui2/src/components/Commander/QuickFilter.tsx b/ui2/src/features/nodes/components/QuickFilter.tsx similarity index 100% rename from ui2/src/components/Commander/QuickFilter.tsx rename to ui2/src/features/nodes/components/QuickFilter.tsx diff --git a/ui2/src/components/Commander/UploadButton.tsx b/ui2/src/features/nodes/components/UploadButton.tsx similarity index 100% rename from ui2/src/components/Commander/UploadButton.tsx rename to ui2/src/features/nodes/components/UploadButton.tsx diff --git a/ui2/src/components/Commander/index.tsx b/ui2/src/features/nodes/components/index.tsx similarity index 100% rename from ui2/src/components/Commander/index.tsx rename to ui2/src/features/nodes/components/index.tsx diff --git a/ui2/src/slices/currentUser.ts b/ui2/src/slices/currentUser.ts index 40cbc3235..82e09e2bb 100644 --- a/ui2/src/slices/currentUser.ts +++ b/ui2/src/slices/currentUser.ts @@ -1,8 +1,6 @@ import {createSlice, createAsyncThunk, PayloadAction} from "@reduxjs/toolkit" import axios from "@/httpClient" import type {SliceState, SliceStateStatus, User, UserDetails} from "@/types" -import {store} from "@/app/store" -import {storeHomeNode, storeInboxNode} from "./dualPanel/dualPanel" const initialState: SliceState = { data: null, @@ -15,19 +13,6 @@ export const fetchCurrentUser = createAsyncThunk( async () => { const response = await axios.get("/api/users/me") const userDetails = response.data as UserDetails - store.dispatch( - storeHomeNode({ - folder_id: userDetails.home_folder_id, - user_id: userDetails.id - }) - ) - store.dispatch( - storeInboxNode({ - folder_id: userDetails.home_folder_id, - user_id: userDetails.id - }) - ) - return userDetails } ) diff --git a/ui2/src/slices/dualPanel/dualPanel.ts b/ui2/src/slices/dualPanel/dualPanel.ts index bbb90eda6..88ee3285a 100644 --- a/ui2/src/slices/dualPanel/dualPanel.ts +++ b/ui2/src/slices/dualPanel/dualPanel.ts @@ -23,7 +23,6 @@ import { commanderInitialState, setCurrentNodeHelper, nodeAddedHelper, - nodeUpdatedHelper, dropThumbnailPageHelper, resetPageChangesHelper, getLatestVersionPages @@ -55,7 +54,6 @@ import { DualPanelState, SetCurrentNodeArgs, FolderAddedArgs, - NodeUpdatedArgs, NodeWithSpinner, SelectionNodePayload, SelectionPagePayload @@ -229,10 +227,6 @@ export const deleteNodes = createAsyncThunk( return nodeIds } ) -type StoreNodeInput = { - folder_id: string - user_id: string -} type SetCurrentPageArg = { mode: PanelMode @@ -381,42 +375,6 @@ const dualPanelSlice = createSlice({ } } }, - storeHomeNode(state, action: PayloadAction) { - const node: NodeType = { - id: action.payload.folder_id, - ctype: "folder", - title: ".home", - breadcrumb: [], - tags: [], - user_id: action.payload.user_id, - update_at: "", - ocr_status: "UNKNOWN", - ocr: false, - parent_id: null, - thumbnail_url: null, - accept_dropped_nodes: false, - is_currently_dragged: false - } - state.nodes.push(node) - }, - storeInboxNode(state, action: PayloadAction) { - const node: NodeType = { - id: action.payload.folder_id, - ctype: "folder", - title: ".inbox", - breadcrumb: [], - tags: [], - user_id: action.payload.user_id, - update_at: "", - ocr_status: "UNKNOWN", - ocr: false, - parent_id: null, - thumbnail_url: null, - accept_dropped_nodes: false, - is_currently_dragged: false - } - state.nodes.push(node) - }, nodeAdded(state, action: PayloadAction) { nodeAddedHelper({ state, @@ -431,19 +389,6 @@ const dualPanelSlice = createSlice({ mode: action.payload.panel }) }, - folderAdded(state, action: PayloadAction) { - nodeAddedHelper({ - state, - node: action.payload.node, - mode: action.payload.mode - }) - }, - nodeUpdated(state, action: PayloadAction) { - nodeUpdatedHelper({ - state, - node: action.payload.node - }) - }, openSecondaryPanel(state, action: PayloadAction) { state.secondaryPanel = { commander: commanderInitialState(action.payload), @@ -692,8 +637,6 @@ export const { fitZoomFactor, toggleThumbnailsPanel, setCurrentNode, - folderAdded, - nodeUpdated, openSecondaryPanel, closeSecondaryPanel, selectionAddNode, @@ -702,8 +645,6 @@ export const { selectionRemovePage, clearNodesSelection, updateSearchResultItemTarget, - storeHomeNode, - storeInboxNode, nodeAdded, setCurrentPage, dropThumbnailPage, diff --git a/ui2/src/slices/dualPanel/helpers.ts b/ui2/src/slices/dualPanel/helpers.ts index be191da4b..3108d495e 100644 --- a/ui2/src/slices/dualPanel/helpers.ts +++ b/ui2/src/slices/dualPanel/helpers.ts @@ -231,22 +231,6 @@ export function setCurrentNodeHelper({ } } } -export function nodeUpdatedHelper({ - state, - node -}: { - state: DualPanelState - node: NodeType -}) { - const newNodes = state.nodes.map(n => { - if (n.id != node.id) { - return n - } - return node - }) - - state.nodes = newNodes -} export function nodeAddedHelper({ state, diff --git a/ui2/src/slices/dualPanel/types.ts b/ui2/src/slices/dualPanel/types.ts index 47cfa7340..13f2d23ec 100644 --- a/ui2/src/slices/dualPanel/types.ts +++ b/ui2/src/slices/dualPanel/types.ts @@ -29,8 +29,6 @@ export type FolderAddedArgs = { mode: PanelMode } -export type NodeUpdatedArgs = FolderAddedArgs - export type SelectionNodePayload = { selectionId: string mode: PanelMode