Compare commits

...

3 Commits

Author SHA1 Message Date
Akmal Isomadinov
e2df5f2816 Client:Components:Dialogs:RestoreDialog Added description 2024-05-22 11:49:26 +05:00
Akmal Isomadinov
e20bf63ca2 Client:Components: Added restore dialog 2024-05-20 20:28:13 +05:00
Akmal Isomadinov
18cc3b357e Client:Public:Locales: Added translations 2024-05-20 20:27:28 +05:00
7 changed files with 174 additions and 2 deletions

View File

@ -0,0 +1,4 @@
{
"ConfirmationRestoreFile": "Are you sure you want to restore this file?",
"ConfirmationRestoreMultipleFiles": "You are about to restore these items to their original location. Are you sure you want to continue?"
}

View File

@ -76,6 +76,7 @@ import LeaveRoomDialog from "../dialogs/LeaveRoomDialog";
import ChangeRoomOwnerPanel from "../panels/ChangeRoomOwnerPanel";
import { CreatedPDFFormDialog } from "../dialogs/CreatedPDFFormDialog";
import { PDFFormEditingDialog } from "../dialogs/PDFFormEditingDialog";
import { RestoreDialog } from "../dialogs/RestoreDialog";
const Panels = (props) => {
const {
@ -130,6 +131,7 @@ const Panels = (props) => {
shareFolderDialogVisible,
pdfFormEditVisible,
selectFileFormRoomOpenRoot,
restoreDialogVisible,
} = props;
const [createPDFFormFile, setCreatePDFFormFile] = useState({
@ -317,6 +319,7 @@ const Panels = (props) => {
/>
),
pdfFormEditVisible && <PDFFormEditingDialog key="pdf-form-edit-dialog" />,
restoreDialogVisible && <RestoreDialog key="restore-dialog" />,
];
};
@ -377,6 +380,7 @@ export default inject(
shareFolderDialogVisible,
pdfFormEditVisible,
selectFileFormRoomOpenRoot,
restoreDialogVisible,
} = dialogsStore;
const { preparationPortalDialogVisible } = backup;
@ -393,6 +397,7 @@ export default inject(
} = pluginStore;
return {
restoreDialogVisible,
preparationPortalDialogVisible,
uploadPanelVisible,
ownerPanelVisible,

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, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { observer, inject } from "mobx-react";
import {
ModalDialog,
ModalDialogType,
} from "@docspace/shared/components/modal-dialog";
import { Button, ButtonSize } from "@docspace/shared/components/button";
import { RestoreDialogProps } from "./RestoreDialog.types";
export const RestoreDialog = inject<TStore>(({ dialogsStore, filesStore }) => {
const { setRestoreDialogVisible } = dialogsStore;
const { selection, bufferSelection } = filesStore;
const items = selection.length > 0 ? selection : [bufferSelection];
return { setRestoreDialogVisible, items };
})(
observer(({ setRestoreDialogVisible, items }: RestoreDialogProps) => {
const { t } = useTranslation(["RestoreDialog", "Common"]);
const onClose = () => {
setRestoreDialogVisible?.(false);
};
const onSubmit = () => {
// TODO!
onClose();
};
const description = useMemo(
() =>
t(
items.length > 1
? "RestoreDialog:ConfirmationRestoreMultipleFiles"
: "RestoreDialog:ConfirmationRestoreFile",
),
[items.length, t],
);
return (
<ModalDialog
visible
autoMaxHeight
onClose={onClose}
displayType={ModalDialogType.modal}
>
<ModalDialog.Header>{t("Common:Restore")}</ModalDialog.Header>
<ModalDialog.Body>{description}</ModalDialog.Body>
<ModalDialog.Footer>
<Button
scale
primary
tabIndex={0}
size={ButtonSize.normal}
label={t("Common:Restore")}
onClick={onSubmit}
/>
<Button
scale
tabIndex={0}
onClick={onClose}
size={ButtonSize.normal}
label={t("Common:Cancel")}
/>
</ModalDialog.Footer>
</ModalDialog>
);
}),
);

View File

@ -0,0 +1,32 @@
// (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
import type { TFile } from "@docspace/shared/api/files/types";
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
export interface RestoreDialogProps
extends Partial<Pick<TStore["dialogsStore"], "setRestoreDialogVisible">> {
items: TFile[];
}

View File

@ -0,0 +1,26 @@
// (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
export { RestoreDialog } from "./RestoreDialog";

View File

@ -304,8 +304,10 @@ class ContextOptionsStore {
onRestoreAction = () => {
const { setIsMobileHidden } = this.infoPanelStore;
setIsMobileHidden(true);
console.log("Click");
this.dialogsStore.setRestorePanelVisible(true);
this.dialogsStore.setRestoreDialogVisible(true);
// this.dialogsStore.setRestorePanelVisible(true);
};
onCopyAction = () => {

View File

@ -119,6 +119,8 @@ class DialogsStore {
selectFileFormRoomFilterParam = FilesSelectorFilterTypes.DOCX;
selectFileFormRoomOpenRoot = false;
restoreDialogVisible = false;
constructor(
authStore,
treeFoldersStore,
@ -521,6 +523,10 @@ class DialogsStore {
this.pdfFormEditVisible = visible;
this.pdfFormEditData = data;
};
setRestoreDialogVisible = (visible) => {
this.restoreDialogVisible = visible;
};
}
export default DialogsStore;