diff --git a/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx b/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx index 167a8cbf..3dcfd337 100644 --- a/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx +++ b/frontend/src/components/Modals/MangeWorkspace/Documents/index.jsx @@ -16,6 +16,7 @@ export default function DocumentSettings({ workspace }) { const [originalDocuments, setOriginalDocuments] = useState([]); const [selectedFiles, setSelectFiles] = useState([]); const [hasFiles, setHasFiles] = useState(true); + const [canDelete, setCanDelete] = useState(false); useEffect(() => { async function fetchKeys() { @@ -24,6 +25,9 @@ export default function DocumentSettings({ workspace }) { const hasAnyFiles = localFiles.items.some( (folder) => folder?.items?.length > 0 ); + + const canDelete = await System.getCanDeleteWorkspaces(); + setCanDelete(canDelete); setDirectories(localFiles); setOriginalDocuments([...originalDocs]); setSelectFiles([...originalDocs]); @@ -92,13 +96,6 @@ export default function DocumentSettings({ workspace }) { : selectedFiles.some((doc) => doc.includes(filepath)); }; - const isOriginalDoc = (filepath) => { - const isFolder = !filepath.includes("/"); - return isFolder - ? originalDocuments.some((doc) => doc.includes(filepath.split("/")[0])) - : originalDocuments.some((doc) => doc.includes(filepath)); - }; - const toggleSelection = (filepath) => { const isFolder = !filepath.includes("/"); const parent = isFolder ? filepath : filepath.split("/")[0]; @@ -179,14 +176,19 @@ export default function DocumentSettings({ workspace }) { -
+
+