Client: created ReorderIndexDialog

This commit is contained in:
Dmitry Sychugov 2024-05-31 15:50:28 +05:00
parent 8a8ed799fb
commit ff514b79d3
5 changed files with 117 additions and 7 deletions

View File

@ -76,6 +76,7 @@ import LeaveRoomDialog from "../dialogs/LeaveRoomDialog";
import ChangeRoomOwnerPanel from "../panels/ChangeRoomOwnerPanel"; import ChangeRoomOwnerPanel from "../panels/ChangeRoomOwnerPanel";
import { CreatedPDFFormDialog } from "../dialogs/CreatedPDFFormDialog"; import { CreatedPDFFormDialog } from "../dialogs/CreatedPDFFormDialog";
import { PDFFormEditingDialog } from "../dialogs/PDFFormEditingDialog"; import { PDFFormEditingDialog } from "../dialogs/PDFFormEditingDialog";
import ReorderIndexDialog from "../dialogs/ReorderIndexDialog";
const Panels = (props) => { const Panels = (props) => {
const { const {
@ -130,6 +131,7 @@ const Panels = (props) => {
shareFolderDialogVisible, shareFolderDialogVisible,
pdfFormEditVisible, pdfFormEditVisible,
selectFileFormRoomOpenRoot, selectFileFormRoomOpenRoot,
reorderDialogVisible,
} = props; } = props;
const [createPDFFormFile, setCreatePDFFormFile] = useState({ const [createPDFFormFile, setCreatePDFFormFile] = useState({
@ -310,6 +312,7 @@ const Panels = (props) => {
<ChangeRoomOwnerPanel key="change-room-owner" /> <ChangeRoomOwnerPanel key="change-room-owner" />
), ),
shareFolderDialogVisible && <ShareFolderDialog key="share-folder-dialog" />, shareFolderDialogVisible && <ShareFolderDialog key="share-folder-dialog" />,
reorderDialogVisible && <ReorderIndexDialog key="reorder-index-dialog" />,
createPDFFormFile.visible && ( createPDFFormFile.visible && (
<CreatedPDFFormDialog <CreatedPDFFormDialog
key="created-pdf-form-dialog" key="created-pdf-form-dialog"
@ -377,6 +380,7 @@ export default inject(
shareFolderDialogVisible, shareFolderDialogVisible,
pdfFormEditVisible, pdfFormEditVisible,
selectFileFormRoomOpenRoot, selectFileFormRoomOpenRoot,
reorderDialogVisible,
} = dialogsStore; } = dialogsStore;
const { preparationPortalDialogVisible } = backup; const { preparationPortalDialogVisible } = backup;
@ -444,6 +448,7 @@ export default inject(
shareFolderDialogVisible, shareFolderDialogVisible,
pdfFormEditVisible, pdfFormEditVisible,
selectFileFormRoomOpenRoot, selectFileFormRoomOpenRoot,
reorderDialogVisible,
}; };
}, },
)(observer(Panels)); )(observer(Panels));

View File

@ -0,0 +1,97 @@
// (c) Copyright Ascensio System SIA 2009-2024
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import React from "react";
import { inject, observer } from "mobx-react";
import { useTranslation } from "react-i18next";
import { ModalDialog } from "@docspace/shared/components/modal-dialog";
import { Text } from "@docspace/shared/components/text";
import { Button } from "@docspace/shared/components/button";
import { isMobile } from "react-device-detect";
const ReorderIndexDialog = ({
visible,
setIsVisible,
reorder,
selectedFolder,
}) => {
const { t, ready } = useTranslation(["Files", "Common"]);
const onClose = () => {
setIsVisible(false);
};
const onReorder = () => {
reorder(selectedFolder?.id);
setIsVisible(false);
};
return (
<ModalDialog isLarge isLoading={!ready} visible={visible} onClose={onClose}>
<ModalDialog.Header>{t("Common:Warning")}</ModalDialog.Header>
<ModalDialog.Body>
<Text fontSize="13px" fontWeight={400} noSelect>
{t("Files:ReorderIndex")}
</Text>
</ModalDialog.Body>
<ModalDialog.Footer>
<Button
id="create-room"
key="OkButton"
label={t("Files:Reorder")}
size="normal"
primary
onClick={onReorder}
scale={isMobile}
/>
<Button
id="cancel-share-folder"
key="CancelButton"
label={t("Common:CancelButton")}
size="normal"
onClick={onClose}
scale={isMobile}
/>
</ModalDialog.Footer>
</ModalDialog>
);
};
export default inject(
({ dialogsStore, filesActionsStore, selectedFolderStore }) => {
const { reorderDialogVisible, setReorderDialogVisible } = dialogsStore;
const selectedFolder = selectedFolderStore.getSelectedFolder();
const { reorder } = filesActionsStore;
return {
visible: reorderDialogVisible,
setIsVisible: setReorderDialogVisible,
reorder,
selectedFolder,
};
},
)(observer(ReorderIndexDialog));

View File

@ -232,6 +232,7 @@ const SectionHeaderContent = (props) => {
setRestoreAllPanelVisible, setRestoreAllPanelVisible,
isGracePeriod, isGracePeriod,
setInviteUsersWarningDialogVisible, setInviteUsersWarningDialogVisible,
setReorderDialogVisible,
setRestoreAllArchive, setRestoreAllArchive,
setRestoreRoomDialogVisible, setRestoreRoomDialogVisible,
onCopyLink, onCopyLink,
@ -854,8 +855,7 @@ const SectionHeaderContent = (props) => {
const tableIndexHeaderProps = { const tableIndexHeaderProps = {
setIsIndexEditingMode, setIsIndexEditingMode,
t, t,
reorder, setReorderDialogVisible,
selectedFolder,
}; };
if (isAccountsPage && !(isGroupsPage && isRoomAdmin)) { if (isAccountsPage && !(isGroupsPage && isRoomAdmin)) {
@ -952,7 +952,9 @@ const SectionHeaderContent = (props) => {
<Consumer key="header"> <Consumer key="header">
{(context) => ( {(context) => (
<StyledContainer isRecycleBinFolder={isRecycleBinFolder}> <StyledContainer isRecycleBinFolder={isRecycleBinFolder}>
{isMobile && isIndexEditingMode && <TableIndexHeader {...tableIndexHeaderProps} />} {isMobile && isIndexEditingMode && (
<TableIndexHeader {...tableIndexHeaderProps} />
)}
{tableGroupMenuVisible ? ( {tableGroupMenuVisible ? (
<TableGroupMenu {...tableGroupMenuProps} withComboBox /> <TableGroupMenu {...tableGroupMenuProps} withComboBox />
) : isIndexEditingMode && !isMobile ? ( ) : isIndexEditingMode && !isMobile ? (
@ -1125,6 +1127,7 @@ export default inject(
setLeaveRoomDialogVisible, setLeaveRoomDialogVisible,
setSelectFileFormRoomDialogVisible, setSelectFileFormRoomDialogVisible,
setShareFolderDialogVisible, setShareFolderDialogVisible,
setReorderDialogVisible,
} = dialogsStore; } = dialogsStore;
const { const {
@ -1295,6 +1298,7 @@ export default inject(
setSharingPanelVisible, setSharingPanelVisible,
setMoveToPanelVisible, setMoveToPanelVisible,
setCopyPanelVisible, setCopyPanelVisible,
setReorderDialogVisible,
setBufferSelection, setBufferSelection,
setIsFolderActions, setIsFolderActions,
deleteAction, deleteAction,

View File

@ -33,8 +33,7 @@ import { StyledTableIndexMenu } from "./StyledIndexHeader";
const TableIndexHeader = ({ const TableIndexHeader = ({
setIsIndexEditingMode, setIsIndexEditingMode,
t, t,
reorder, setReorderDialogVisible,
selectedFolder,
}) => { }) => {
return ( return (
<StyledTableIndexMenu> <StyledTableIndexMenu>
@ -46,7 +45,7 @@ const TableIndexHeader = ({
<div className="table-header_index-separator" /> <div className="table-header_index-separator" />
<div <div
className="table-header_reorder-container" className="table-header_reorder-container"
onClick={() => reorder(selectedFolder?.id)} onClick={() => setReorderDialogVisible(true)}
> >
<IconButton <IconButton
className="table-header_reorder-icon" className="table-header_reorder-icon"
@ -57,7 +56,7 @@ const TableIndexHeader = ({
isClickable={false} isClickable={false}
/> />
<Text fontSize="12px" lineHeight="16px" fontWeight={600}> <Text fontSize="12px" lineHeight="16px" fontWeight={600}>
{t("Common:Reorder")} {t("Files:Reorder")}
</Text> </Text>
</div> </div>
</div> </div>

View File

@ -43,6 +43,7 @@ class DialogsStore {
ownerPanelVisible = false; ownerPanelVisible = false;
moveToPanelVisible = false; moveToPanelVisible = false;
restorePanelVisible = false; restorePanelVisible = false;
reorderDialogVisible = false;
copyPanelVisible = false; copyPanelVisible = false;
deleteThirdPartyDialogVisible = false; deleteThirdPartyDialogVisible = false;
connectDialogVisible = false; connectDialogVisible = false;
@ -521,6 +522,10 @@ class DialogsStore {
this.pdfFormEditVisible = visible; this.pdfFormEditVisible = visible;
this.pdfFormEditData = data; this.pdfFormEditData = data;
}; };
setReorderDialogVisible = (visible) => {
this.reorderDialogVisible = visible;
};
} }
export default DialogsStore; export default DialogsStore;