Client: PortalSettings: DeleteData: fix button size
This commit is contained in:
parent
5b4b68d0f5
commit
e53bfda10c
@ -1,4 +1,4 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { withRouter } from "react-router";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { inject } from "mobx-react";
|
||||
@ -8,9 +8,11 @@ import toastr from "@docspace/components/toast/toastr";
|
||||
import { MainContainer } from "./StyledDeleteData";
|
||||
import { setDocumentTitle } from "../../../../helpers/utils";
|
||||
import { sendSuspendPortalEmail } from "@docspace/common/api/portal";
|
||||
import { isDesktop } from "@docspace/components/utils/device";
|
||||
|
||||
const PortalDeactivation = (props) => {
|
||||
const { t, getPortalOwner, owner } = props;
|
||||
const [isDesktopView, setIsDesktopView] = useState(false);
|
||||
|
||||
const fetchData = async () => {
|
||||
await getPortalOwner();
|
||||
@ -19,8 +21,16 @@ const PortalDeactivation = (props) => {
|
||||
useEffect(() => {
|
||||
setDocumentTitle(t("PortalDeactivation"));
|
||||
fetchData();
|
||||
onCheckView();
|
||||
window.addEventListener("resize", onCheckView);
|
||||
return () => window.removeEventListener("resize", onCheckView);
|
||||
}, []);
|
||||
|
||||
const onCheckView = () => {
|
||||
if (isDesktop()) setIsDesktopView(true);
|
||||
else setIsDesktopView(false);
|
||||
};
|
||||
|
||||
const onDeactivateClick = async () => {
|
||||
try {
|
||||
await sendSuspendPortalEmail();
|
||||
@ -45,7 +55,7 @@ const PortalDeactivation = (props) => {
|
||||
className="button"
|
||||
label={t("Deactivate")}
|
||||
primary
|
||||
size="normal"
|
||||
size={isDesktopView ? "small" : "normal"}
|
||||
onClick={onDeactivateClick}
|
||||
/>
|
||||
</MainContainer>
|
||||
|
@ -12,11 +12,13 @@ import {
|
||||
getPaymentAccount,
|
||||
sendDeletePortalEmail,
|
||||
} from "@docspace/common/api/portal";
|
||||
import { isDesktop } from "@docspace/components/utils/device";
|
||||
|
||||
const PortalDeletion = (props) => {
|
||||
const { t, getPortalOwner, owner } = props;
|
||||
const [isDialogVisible, setIsDialogVisible] = useState(false);
|
||||
const [stripeUrl, setStripeUrl] = useState(null);
|
||||
const [isDesktopView, setIsDesktopView] = useState(false);
|
||||
|
||||
const fetchData = async () => {
|
||||
await getPortalOwner();
|
||||
@ -27,8 +29,16 @@ const PortalDeletion = (props) => {
|
||||
useEffect(() => {
|
||||
setDocumentTitle(t("DeleteDocSpace"));
|
||||
fetchData();
|
||||
onCheckView();
|
||||
window.addEventListener("resize", onCheckView);
|
||||
return () => window.removeEventListener("resize", onCheckView);
|
||||
}, []);
|
||||
|
||||
const onCheckView = () => {
|
||||
if (isDesktop()) setIsDesktopView(true);
|
||||
else setIsDesktopView(false);
|
||||
};
|
||||
|
||||
const onDeleteClick = async () => {
|
||||
if (stripeUrl) {
|
||||
setIsDialogVisible(true);
|
||||
@ -57,7 +67,7 @@ const PortalDeletion = (props) => {
|
||||
className="button"
|
||||
label={t("Common:Delete")}
|
||||
primary
|
||||
size="normal"
|
||||
size={isDesktopView ? "small" : "normal"}
|
||||
onClick={onDeleteClick}
|
||||
/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user