Client:Section:Header:Added a context menu to the room name in the navigation in the archive. Corrected actions in the context menu for the archive to be correct.

This commit is contained in:
Vlada Gazizova 2024-04-05 18:34:56 +03:00
parent ec28800c59
commit 8f6a08df3f
2 changed files with 43 additions and 22 deletions

View File

@ -137,6 +137,13 @@ const DeleteDialogComponent = (props) => {
}; };
const onClose = () => { const onClose = () => {
if (
selection.length === 1 &&
selection[0].isArchive &&
selection[0].isRootFolder === false
) {
setSelected("none");
}
setBufferSelection(null); setBufferSelection(null);
setRemoveMediaItem(null); setRemoveMediaItem(null);
setIsRoomDelete(false); setIsRoomDelete(false);

View File

@ -146,11 +146,6 @@ const StyledContainer = styled.div`
min-height: 33px; min-height: 33px;
align-items: center; align-items: center;
${(props) =>
props.hideContextMenuInsideArchiveRoom &&
`.option-button {
display: none;}`}
@media ${tablet} { @media ${tablet} {
height: 61px; height: 61px;
} }
@ -238,7 +233,6 @@ const SectionHeaderContent = (props) => {
isGroupMenuBlocked, isGroupMenuBlocked,
onClickBack, onClickBack,
hideContextMenuInsideArchiveRoom,
activeFiles, activeFiles,
activeFolders, activeFolders,
selectedFolder, selectedFolder,
@ -312,6 +306,8 @@ const SectionHeaderContent = (props) => {
onClickCreateRoom, onClickCreateRoom,
onCreateAndCopySharedLink, onCreateAndCopySharedLink,
showNavigationButton, showNavigationButton,
deleteRooms,
setSelection,
} = props; } = props;
const navigate = useNavigate(); const navigate = useNavigate();
@ -685,6 +681,11 @@ const SectionHeaderContent = (props) => {
toastr.success(t("Translations:LinkCopySuccess")); toastr.success(t("Translations:LinkCopySuccess"));
}; };
const onDeleteRoomInArchive = () => {
setSelection([selectedFolder]);
deleteRooms(t);
};
const getContextOptionsFolder = () => { const getContextOptionsFolder = () => {
const { const {
t, t,
@ -709,6 +710,8 @@ const SectionHeaderContent = (props) => {
isPublicRoom, isPublicRoom,
} = props; } = props;
const isArchive = selectedFolder.rootFolderType === FolderType.Archive;
if (isPublicRoom) { if (isPublicRoom) {
return [ return [
{ {
@ -778,7 +781,9 @@ const SectionHeaderContent = (props) => {
disabled: disabled:
isRecycleBinFolder || isRecycleBinFolder ||
isPersonalRoom || isPersonalRoom ||
((isPublicRoomType || isCustomRoomType) && haveLinksRight), ((isPublicRoomType || isCustomRoomType) &&
haveLinksRight &&
!isArchive),
icon: InvitationLinkReactSvgUrl, icon: InvitationLinkReactSvgUrl,
}, },
{ {
@ -839,7 +844,10 @@ const SectionHeaderContent = (props) => {
} }
} }
}, },
disabled: (!isPublicRoomType && !isCustomRoomType) || !haveLinksRight, disabled:
(!isPublicRoomType && !isCustomRoomType) ||
!haveLinksRight ||
isArchive,
}, },
{ {
id: "header_option_invite-users-to-room", id: "header_option_invite-users-to-room",
@ -870,7 +878,7 @@ const SectionHeaderContent = (props) => {
label: t("MoveToArchive"), label: t("MoveToArchive"),
icon: RoomArchiveSvgUrl, icon: RoomArchiveSvgUrl,
onClick: onClickArchiveAction, onClick: onClickArchiveAction,
disabled: !isRoom || !security?.Move, disabled: !isRoom || !security?.Move || isArchive,
"data-action": "archive", "data-action": "archive",
action: "archive", action: "archive",
}, },
@ -891,7 +899,7 @@ const SectionHeaderContent = (props) => {
label: t("LeaveTheRoom"), label: t("LeaveTheRoom"),
icon: LeaveRoomSvgUrl, icon: LeaveRoomSvgUrl,
onClick: onLeaveRoom, onClick: onLeaveRoom,
disabled: isArchiveFolder || !inRoom || isPublicRoom, disabled: isArchive || !inRoom || isPublicRoom,
}, },
{ {
id: "header_option_download", id: "header_option_download",
@ -901,6 +909,14 @@ const SectionHeaderContent = (props) => {
disabled: !security?.Download, disabled: !security?.Download,
icon: DownloadReactSvgUrl, icon: DownloadReactSvgUrl,
}, },
{
id: "header_option_unarchive-room",
key: "unarchive-room",
label: t("Common:Restore"),
onClick: onClickArchiveAction,
disabled: !isArchive || !isRoom,
icon: MoveReactSvgUrl,
},
{ {
id: "header_option_move-to", id: "header_option_move-to",
key: "move-to", key: "move-to",
@ -914,7 +930,9 @@ const SectionHeaderContent = (props) => {
key: "copy", key: "copy",
label: t("Common:Copy"), label: t("Common:Copy"),
onClick: onCopyAction, onClick: onCopyAction,
disabled: isDisabled || !security?.CopyTo, disabled:
isDisabled || (isArchive ? !security?.Copy : !security?.CopyTo),
icon: CopyReactSvgUrl, icon: CopyReactSvgUrl,
}, },
{ {
@ -935,8 +953,8 @@ const SectionHeaderContent = (props) => {
id: "header_option_delete", id: "header_option_delete",
key: "delete", key: "delete",
label: t("Common:Delete"), label: t("Common:Delete"),
onClick: onDeleteAction, onClick: isArchive ? onDeleteRoomInArchive : onDeleteAction,
disabled: isDisabled || !security?.Delete, disabled: isArchive ? !isRoom : isDisabled || !security?.Delete,
icon: CatalogTrashReactSvgUrl, icon: CatalogTrashReactSvgUrl,
}, },
]; ];
@ -1190,10 +1208,7 @@ const SectionHeaderContent = (props) => {
return ( return (
<Consumer key="header"> <Consumer key="header">
{(context) => ( {(context) => (
<StyledContainer <StyledContainer isRecycleBinFolder={isRecycleBinFolder}>
isRecycleBinFolder={isRecycleBinFolder}
hideContextMenuInsideArchiveRoom={hideContextMenuInsideArchiveRoom}
>
{tableGroupMenuVisible ? ( {tableGroupMenuVisible ? (
<TableGroupMenu {...tableGroupMenuProps} withComboBox /> <TableGroupMenu {...tableGroupMenuProps} withComboBox />
) : ( ) : (
@ -1314,6 +1329,7 @@ export default inject(
clearFiles, clearFiles,
categoryType, categoryType,
getPrimaryLink, getPrimaryLink,
setSelection,
} = filesStore; } = filesStore;
const { const {
@ -1364,6 +1380,7 @@ export default inject(
emptyTrashInProgress, emptyTrashInProgress,
moveToPublicRoom, moveToPublicRoom,
onClickCreateRoom, onClickCreateRoom,
deleteRooms,
} = filesActionsStore; } = filesActionsStore;
const { oformsFilter } = oformsStore; const { oformsFilter } = oformsStore;
@ -1421,10 +1438,6 @@ export default inject(
const isEmptyArchive = !canRestoreAll && !canDeleteAll; const isEmptyArchive = !canRestoreAll && !canDeleteAll;
const hideContextMenuInsideArchiveRoom = isArchiveFolderRoot
? !isArchiveFolder
: false;
const { const {
selectionStore, selectionStore,
headerMenuStore, headerMenuStore,
@ -1523,7 +1536,6 @@ export default inject(
isEmptyArchive, isEmptyArchive,
isPrivacyFolder, isPrivacyFolder,
isArchiveFolder, isArchiveFolder,
hideContextMenuInsideArchiveRoom,
setIsLoading, setIsLoading,
@ -1600,6 +1612,8 @@ export default inject(
onCreateAndCopySharedLink, onCreateAndCopySharedLink,
showNavigationButton, showNavigationButton,
haveLinksRight, haveLinksRight,
deleteRooms,
setSelection,
}; };
}, },
)( )(