diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js index 4520262df..2a784a66b 100644 --- a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js +++ b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js @@ -28,7 +28,12 @@ function PdfFileComponent({ const [isOpenMoveModal, setIsOpenMoveModal] = useState(false); const [selectDoc, setSelectDoc] = useState(); const [isDeleteDoc, setIsDeleteDoc] = useState(false); - const contextMenu = ["Download", "Rename", "Move", "Delete"]; + const contextMenu = [ + { type: "Download", icon: "fa-solid fa-arrow-down" }, + { type: "Rename", icon: "fa-solid fa-font" }, + { type: "Move", icon: "fa-solid fa-file-export" }, + { type: "Delete", icon: "fa-solid fa-trash" } + ]; const navigate = useNavigate(); //to focus input box on press rename to change doc name @@ -478,7 +483,8 @@ function PdfFileComponent({ onClick={() => handleMenuItemClick("Rename", data)} className="ContextMenuItem" > - Rename + + Rename @@ -542,7 +548,8 @@ function PdfFileComponent({ onClick={() => handleMenuItemClick("Rename", data)} className="ContextMenuItem" > - Rename + + Rename @@ -620,15 +627,15 @@ function PdfFileComponent({ sideOffset={5} align="end" > - {contextMenu.map((menuType, ind) => { + {contextMenu.map((menu, ind) => { return ( handleMenuItemClick(menuType, data)} - // onSelect={(e) => console.log("event", e)} + onClick={() => handleMenuItemClick(menu, data)} className="ContextMenuItem" > - {menuType} + + {menu.type} ); })} diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css index 1d8e4149d..2997553ce 100644 --- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css +++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css @@ -6,7 +6,7 @@ .ContextMenuContent, .ContextMenuSubContent { - min-width: 150px; + min-width: 135px; background-color: white; border-radius: 6px; overflow: hidden; @@ -28,7 +28,7 @@ height: 25px; padding: 0 5px; position: relative; - padding-left: 25px; + padding-left: 15px; user-select: none; outline: none; } diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js index 21d6a9e4c..8a37610dd 100644 --- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js +++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js @@ -64,6 +64,7 @@ function PdfFile() { if (driveDetails) { if (driveDetails.length > 0) { setPdfData(driveDetails); + sortApps(null, null, driveDetails); } const data = [ { @@ -98,6 +99,7 @@ function PdfFile() { if (driveDetails) { if (driveDetails.length > 0) { setPdfData(driveDetails); + sortApps(null, null, driveDetails); } else { setPdfData([]); } @@ -120,11 +122,6 @@ function PdfFile() { }; //function for handle folder name path const handleRoute = (index) => { - let loadObj = { - isLoad: true, - message: "This might take some time" - }; - const updateFolderName = folderName.filter((x, i) => { if (i <= index) { return x; @@ -217,11 +214,11 @@ function PdfFile() { } }; - const sortApps = () => { - const selectedSortType = selectedSort; - const sortOrder = sortingOrder; + const sortApps = (type, order, driveDetails) => { + const selectedSortType = type ? type : "Date"; + const sortOrder = order ? order : "Decending"; - let sortingData = pdfData; + let sortingData = pdfData?.length === 0 ? driveDetails : pdfData; if (selectedSortType === "Name") { sortingApp(sortingData, "Name", sortOrder); } else if (selectedSortType === "Date") { @@ -283,9 +280,9 @@ function PdfFile() { useEffect(() => { const closeMenuOnOutsideClick = (e) => { if (isShowSort && !e.target.closest("#menu-container")) { - setIsShowSort(false); + setIsShowSort(!isShowSort); } else if (isNewFol && !e.target.closest("#folder-menu")) { - setIsNewFol(false); + setIsNewFol(!isNewFol); } }; @@ -295,14 +292,13 @@ function PdfFile() { // Cleanup the event listener when the component unmounts document.removeEventListener("click", closeMenuOnOutsideClick); }; - }, [isShowSort]); + }, [isShowSort || isNewFol]); const handleFolderTab = (folderData, isMove) => { return folderData.map((data, id) => { return ( - <> + handleRoute(id)} style={{ color: "#a64b4e", @@ -322,7 +318,7 @@ function PdfFile() { > - + ); }); }; @@ -363,7 +359,13 @@ function PdfFile() { ) : ( -
+
{ + e.preventDefault(); + handleAddFolder(); + }} + style={{ display: "flex", flexDirection: "column" }} + >
+ )} @@ -568,7 +565,7 @@ function PdfFile() { { setSelectedSort("Name"); - sortApps(); + sortApps("Name"); }} className="dropdown-item itemColor" > @@ -590,7 +587,7 @@ function PdfFile() { { setSelectedSort("Date"); - sortApps(); + sortApps("Date"); }} className="dropdown-item itemColor" > @@ -613,7 +610,7 @@ function PdfFile() { { setSortingOrder("Accending"); - sortApps(); + sortApps(null, "Accending", null); }} className="dropdown-item itemColor" > @@ -635,7 +632,7 @@ function PdfFile() { { setSortingOrder("Decending"); - sortApps(); + sortApps(null, "Decending", null); }} className="dropdown-item itemColor" > diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index 0e0a1f129..471d2bf1f 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -736,7 +736,7 @@ function PdfRequestFiles() {