Skip to content

Commit

Permalink
wip: Update to move architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobiClark committed Jan 8, 2025
1 parent 9cb68c3 commit b899804
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
closeContextMenu,
deleteFilesByRelativePath,
setFolderMoveMode,
setFolderDataToMoveToNewLocation,
} from "../../../stores/slices/datasetTreeViewSlice";

const ContextMenu = () => {
Expand Down Expand Up @@ -65,19 +64,22 @@ const ContextMenu = () => {
<div id="context-menu" style={menuStyles}>
<Menu opened position="top" offset={5} styles={{ dropdown: menuStyles }}>
<Menu.Dropdown>
{contextMenuItemData?.relativePath && (
<Menu.Item
onClick={() => {
console.log("data" + JSON.stringify(contextMenuItemData, null, 2));
setFolderMoveMode(true);
setFolderDataToMoveToNewLocation(contextMenuItemData);
}}
>
Open
</Menu.Item>
)}
<Menu.Item onClick={() => console.log("Move")}>Move</Menu.Item>
<Menu.Item onClick={handleDelete}>Delete</Menu.Item>
<Menu.Item
onClick={() => {
console.log("data" + JSON.stringify(contextMenuItemData, null, 2));
setFolderMoveMode(true);
closeContextMenu();
}}
>
Move
</Menu.Item>
<Menu.Item
onClick={() => {
console.log("foo");
}}
>
Delete
</Menu.Item>
<Menu.Item onClick={() => console.log("Delete")}>qwer</Menu.Item>
</Menu.Dropdown>
</Menu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
setDatasetStructureSearchFilter,
openContextMenu,
setFolderMoveMode,
moveFolderToNewLocation,
} from "../../../stores/slices/datasetTreeViewSlice";
import { naturalSort } from "../utils/util-functions";

Expand Down Expand Up @@ -81,7 +82,7 @@ const FolderItem = ({
isFileSelected,
allowStructureEditing,
}) => {
const { folderMoveMode, folderMoveData } = useGlobalStore();
const { folderMoveMode } = useGlobalStore();
const [isOpen, setIsOpen] = useState(false);
const { hovered, ref } = useHover();

Expand Down Expand Up @@ -121,11 +122,11 @@ const FolderItem = ({
onClick={toggleFolder}
/>
)}
{onFolderClick && (
{onFolderClick && !folderMoveMode && (
<Tooltip label="Select this folder" zIndex={2999}>
<Checkbox
readOnly
checked={isFolderSelected?.(name, content)}
checked={false}
onClick={() => onFolderClick?.(name, content, isFolderSelected?.(name, content))}
/>
</Tooltip>
Expand All @@ -135,7 +136,7 @@ const FolderItem = ({
<Checkbox
readOnly
onClick={() => {
setFolderDataToMoveToNewLocation({ name, content });
moveFolderToNewLocation(content.relativePath);
}}
/>
</Tooltip>
Expand Down Expand Up @@ -251,7 +252,10 @@ const DatasetTreeViewRenderer = ({ folderActions, fileActions, allowStructureEdi
)}
{folderMoveMode && (
/* make A ui that allows the user to cancel the move operation */
<Group gap={3} align="center" bg="aliceblue" p="xs">
<Group justify="space-between" bg="aliceblue" p="xs">
<Text size="lg" fw={500}>
Select a folder to move the data to
</Text>
<Button
size="xs"
color="red"
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/src/components/shared/utils/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const ICON_SETTINGS = {
folderColor: "#ADD8E6",
folderSize: 16,
fileSize: 14,
};

0 comments on commit b899804

Please sign in to comment.