2021-05-14 08:15:15 +00:00
|
|
|
import { DialogContentText } from "@material-ui/core";
|
2020-07-22 10:54:15 +00:00
|
|
|
import ActionDialog from "@saleor/components/ActionDialog";
|
2022-01-28 12:34:20 +00:00
|
|
|
import { ConfirmButtonTransitionState } from "@saleor/macaw-ui";
|
2020-07-22 10:54:15 +00:00
|
|
|
import { getStringOrPlaceholder } from "@saleor/misc";
|
|
|
|
import React from "react";
|
|
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
|
|
|
|
export interface AppActivateDialogProps {
|
|
|
|
confirmButtonState: ConfirmButtonTransitionState;
|
|
|
|
open: boolean;
|
|
|
|
name: string;
|
|
|
|
onClose: () => void;
|
|
|
|
onConfirm: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const AppActivateDialog: React.FC<AppActivateDialogProps> = ({
|
|
|
|
confirmButtonState,
|
|
|
|
open,
|
|
|
|
name,
|
|
|
|
onClose,
|
|
|
|
onConfirm
|
|
|
|
}) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ActionDialog
|
|
|
|
confirmButtonLabel={intl.formatMessage({
|
|
|
|
defaultMessage: "Activate",
|
|
|
|
description: "button label"
|
|
|
|
})}
|
|
|
|
confirmButtonState={confirmButtonState}
|
|
|
|
open={open}
|
|
|
|
onClose={onClose}
|
|
|
|
onConfirm={onConfirm}
|
|
|
|
title={intl.formatMessage({
|
|
|
|
defaultMessage: "Activate App",
|
|
|
|
description: "dialog header"
|
|
|
|
})}
|
|
|
|
variant="default"
|
|
|
|
>
|
|
|
|
<DialogContentText>
|
|
|
|
{["", null].includes(name) ? (
|
|
|
|
<FormattedMessage
|
2021-04-26 07:49:55 +00:00
|
|
|
defaultMessage="Are you sure you want to activate this app? Activating will start gathering events."
|
2020-07-22 10:54:15 +00:00
|
|
|
description="activate app"
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<FormattedMessage
|
|
|
|
defaultMessage="Are you sure you want to activate {name}? Activating will start gathering events."
|
|
|
|
description="activate app"
|
|
|
|
values={{
|
|
|
|
name: <strong>{getStringOrPlaceholder(name)}</strong>
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</DialogContentText>
|
|
|
|
</ActionDialog>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
AppActivateDialog.displayName = "AppActivateDialog";
|
|
|
|
export default AppActivateDialog;
|