mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
refactor: fix instance status modal close button (#1115)
* refactor: fix instance status modal close button * refactor: only close the modal on button click
This commit is contained in:
parent
9ca2b6fc46
commit
625a92ca74
@ -27,6 +27,15 @@ const TrialDialog: VFC<ITrialDialogProps> = ({
|
||||
const expired = trialHasExpired(instanceStatus);
|
||||
const [dialogOpen, setDialogOpen] = useState(expired);
|
||||
|
||||
const onClose = (event: React.SyntheticEvent, muiCloseReason?: string) => {
|
||||
if (!muiCloseReason) {
|
||||
setDialogOpen(false);
|
||||
if (canExtendTrial(instanceStatus)) {
|
||||
onExtendTrial().catch(console.error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setDialogOpen(expired);
|
||||
const interval = setInterval(() => {
|
||||
@ -49,15 +58,7 @@ const TrialDialog: VFC<ITrialDialogProps> = ({
|
||||
navigate('/admin/billing');
|
||||
setDialogOpen(false);
|
||||
}}
|
||||
onClose={(_: any, reason?: string) => {
|
||||
if (
|
||||
reason !== 'backdropClick' &&
|
||||
reason !== 'escapeKeyDown'
|
||||
) {
|
||||
onExtendTrial();
|
||||
setDialogOpen(false);
|
||||
}
|
||||
}}
|
||||
onClose={onClose}
|
||||
title={`Your free ${instanceStatus.plan} trial has expired!`}
|
||||
>
|
||||
<Typography>
|
||||
|
Loading…
Reference in New Issue
Block a user