diff --git a/client/modules/datafiles/src/DatafilesToolbar/TrashButton.tsx b/client/modules/datafiles/src/DatafilesToolbar/TrashButton.tsx index acdd4c287c..fdbfa6e8c5 100644 --- a/client/modules/datafiles/src/DatafilesToolbar/TrashButton.tsx +++ b/client/modules/datafiles/src/DatafilesToolbar/TrashButton.tsx @@ -1,6 +1,12 @@ import React, { useCallback } from 'react'; -import { useAuthenticatedUser, useTrash } from '@client/hooks'; +import { + useAuthenticatedUser, + useCheckFilesForAssociation, + useNotifyContext, + useTrash, +} from '@client/hooks'; import { Button, ButtonProps, ConfigProvider } from 'antd'; +import { useParams } from 'react-router-dom'; interface TrashButtonProps extends ButtonProps { api: string; @@ -25,8 +31,35 @@ const TrashButton: React.FC> = React.memo( [selectedFiles, mutate, api, system] ); + let { projectId } = useParams(); + if (!projectId) projectId = ''; + + const hasAssociations = useCheckFilesForAssociation( + projectId, + selectedFiles.map((f) => f.path) + ); + + const { notifyApi } = useNotifyContext(); + const handleTrashClick = () => { // const trashPath = path === 'myData' ? '${user.username}/.Trash' : '.Trash'; + + if (hasAssociations) { + notifyApi?.open({ + type: 'error', + message: 'Cannot Trash File(s)', + duration: 10, + description: ( +
+ The selected file(s) are associated to one or more categories. + Please remove category associations before proceeding. +
+ ), + placement: 'bottomLeft', + }); + return; + } + const userUsername: string | undefined = user?.username; let trashPath: string; if (typeof userUsername === 'string' && !system.startsWith('project-')) { diff --git a/client/modules/datafiles/src/projects/ProjectCurationFileListing/ProjectCurationFileListing.tsx b/client/modules/datafiles/src/projects/ProjectCurationFileListing/ProjectCurationFileListing.tsx index de9233a55c..754253be7f 100644 --- a/client/modules/datafiles/src/projects/ProjectCurationFileListing/ProjectCurationFileListing.tsx +++ b/client/modules/datafiles/src/projects/ProjectCurationFileListing/ProjectCurationFileListing.tsx @@ -206,7 +206,7 @@ const FileCurationSelector: React.FC<{ ))}
  • - {showEntitySelector && ( + {showEntitySelector ? (
    virtual={false} @@ -244,6 +244,8 @@ const FileCurationSelector: React.FC<{ )}
    + ) : ( +
    )}
  • diff --git a/client/modules/datafiles/src/projects/ProjectPreview/ProjectPreview.tsx b/client/modules/datafiles/src/projects/ProjectPreview/ProjectPreview.tsx index c6eda1034e..44416efb52 100644 --- a/client/modules/datafiles/src/projects/ProjectPreview/ProjectPreview.tsx +++ b/client/modules/datafiles/src/projects/ProjectPreview/ProjectPreview.tsx @@ -166,27 +166,29 @@ function RecursiveTree({
      - {(treeData.children ?? []).map((child) => ( -
      - - - - -
      - ))} + {(treeData.children ?? []) + .sort((a, b) => a.order - b.order) + .map((child) => ( +
      + + + + +
      + ))}
    ); diff --git a/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.module.css b/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.module.css index 1e21587944..9b238941e1 100644 --- a/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.module.css +++ b/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.module.css @@ -18,7 +18,6 @@ position: relative; padding: 5px; font-size: 14px; - z-index: 100; } .tree-select-item { position: relative; @@ -37,7 +36,7 @@ .tree-list-item::after, .tree-select-item::after { position: absolute; - height: calc(var(--tree-spacing-y) + 50%); + height: calc(var(--tree-spacing-y) + 50% + 10px); left: calc(-1 * var(--tree-spacing-x)); bottom: 50%; content: ''; @@ -61,8 +60,8 @@ position: absolute; content: ''; left: 0; - top: -5px; - height: calc(100% + var(--tree-spacing-y)); + top: -10px; + height: calc(100% + var(--tree-spacing-y) + 10px); border-left: 1px solid black; } diff --git a/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.tsx b/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.tsx index ad8b07a88c..76208dfeee 100644 --- a/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.tsx +++ b/client/modules/datafiles/src/projects/ProjectTree/ProjectTree.tsx @@ -86,7 +86,7 @@ const ProjectTreeDisplay: React.FC<{ if (!entity) return null; return ( <> -  {entity.value.title}  + {entity.value.title}