From 9c1972cab9e9a6d964f68a4042743ed8ebf27f68 Mon Sep 17 00:00:00 2001 From: DmitrySychugov Date: Wed, 27 Dec 2023 19:55:32 +0500 Subject: [PATCH] Web: Management: added a new modal window with transition to the portal --- .../src/categories/spaces/index.tsx | 22 +++++-- .../dialogs/SpaceCreatedDialog/index.tsx | 59 +++++++++++++++++++ packages/management/src/store/SpacesStore.ts | 33 +++++++---- 3 files changed, 97 insertions(+), 17 deletions(-) create mode 100644 packages/management/src/categories/spaces/sub-components/dialogs/SpaceCreatedDialog/index.tsx diff --git a/packages/management/src/categories/spaces/index.tsx b/packages/management/src/categories/spaces/index.tsx index fc3ddc877e..6760846aa2 100644 --- a/packages/management/src/categories/spaces/index.tsx +++ b/packages/management/src/categories/spaces/index.tsx @@ -9,16 +9,21 @@ import { useStore } from "SRC_DIR/store"; import ChangeDomainDialog from "./sub-components/dialogs/ChangeDomainDialog"; import CreatePortalDialog from "./sub-components/dialogs/CreatePortalDialog"; import DeletePortalDialog from "./sub-components/dialogs/DeletePortalDialog"; +import SpaceCreatedDialog from "./sub-components/dialogs/SpaceCreatedDialog"; import { SpacesLoader } from "./sub-components/SpacesLoader"; - const Spaces = () => { const { t } = useTranslation(["Management", "Common", "Settings"]); const { spacesStore, authStore } = useStore(); - const { isConnected, domainDialogVisible, createPortalDialogVisible, deletePortalDialogVisible } = - spacesStore; + const { + isConnected, + domainDialogVisible, + createPortalDialogVisible, + deletePortalDialogVisible, + spaceCreatedDialogVisible, + } = spacesStore; const { setDocumentTitle } = authStore; const { portals } = authStore.settingsStore; @@ -31,13 +36,20 @@ const Spaces = () => { return ( - {deletePortalDialogVisible && } + {deletePortalDialogVisible && ( + + )} {domainDialogVisible && } + {spaceCreatedDialogVisible && ( + + )} {createPortalDialogVisible && ( )}
- {t("Subheader")} + + {t("Subheader")} +
{isConnected && portals.length > 0 ? ( diff --git a/packages/management/src/categories/spaces/sub-components/dialogs/SpaceCreatedDialog/index.tsx b/packages/management/src/categories/spaces/sub-components/dialogs/SpaceCreatedDialog/index.tsx new file mode 100644 index 0000000000..b4a6eb9799 --- /dev/null +++ b/packages/management/src/categories/spaces/sub-components/dialogs/SpaceCreatedDialog/index.tsx @@ -0,0 +1,59 @@ +import React from "react"; +import ModalDialogContainer from "@docspace/client/src/components/dialogs/ModalDialogContainer"; +import Text from "@docspace/components/text"; +import Button from "@docspace/components/button"; +import { useTranslation } from "react-i18next"; +import { observer } from "mobx-react"; +import ModalDialog from "@docspace/components/modal-dialog"; +import { useStore } from "SRC_DIR/store"; + +const SpaceCreatedDialog = () => { + const { spacesStore } = useStore(); + + const { + spaceCreatedDialogVisible: visible, + setSpaceCreatedDialogVisible, + referenceLink, + } = spacesStore; + + const onClose = () => setSpaceCreatedDialogVisible(false); + + const onClick = () => { + let url = new URL(referenceLink); + url.searchParams.append("referenceUrl", "/management"); + return window.location.replace(url); + }; + + const { t } = useTranslation(["Management", "Common"]); + + return ( + + {t("SpaceCreated")} + + {t("SpaceCreatedTitle")} + + +