2022-10-26 13:57:59 +02:00
|
|
|
import { FC } from 'react';
|
2022-10-28 09:37:55 +02:00
|
|
|
import { Alert, Typography } from '@mui/material';
|
2022-10-26 13:57:59 +02:00
|
|
|
import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
|
|
|
|
2022-11-02 07:34:14 +01:00
|
|
|
interface IChangeRequestDialogueProps {
|
2022-10-26 13:57:59 +02:00
|
|
|
isOpen: boolean;
|
|
|
|
onConfirm: () => void;
|
|
|
|
onClose: () => void;
|
|
|
|
environment?: string;
|
2022-11-04 10:33:07 +01:00
|
|
|
showBanner?: boolean;
|
|
|
|
messageComponent: JSX.Element;
|
2022-10-26 13:57:59 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 07:34:14 +01:00
|
|
|
export const ChangeRequestDialogue: FC<IChangeRequestDialogueProps> = ({
|
2022-10-26 13:57:59 +02:00
|
|
|
isOpen,
|
|
|
|
onConfirm,
|
|
|
|
onClose,
|
2022-11-04 10:33:07 +01:00
|
|
|
showBanner,
|
2022-10-26 13:57:59 +02:00
|
|
|
environment,
|
2022-11-04 10:33:07 +01:00
|
|
|
messageComponent,
|
2022-10-28 09:37:55 +02:00
|
|
|
}) => (
|
|
|
|
<Dialogue
|
|
|
|
open={isOpen}
|
2022-11-04 10:33:07 +01:00
|
|
|
primaryButtonText="Add suggestion to draft"
|
2022-10-28 09:37:55 +02:00
|
|
|
secondaryButtonText="Cancel"
|
|
|
|
onClick={onConfirm}
|
|
|
|
onClose={onClose}
|
2022-11-02 07:34:14 +01:00
|
|
|
title="Request changes"
|
2022-11-04 10:33:07 +01:00
|
|
|
fullWidth
|
2022-10-28 09:37:55 +02:00
|
|
|
>
|
2022-11-04 10:33:07 +01:00
|
|
|
{showBanner && (
|
|
|
|
<Alert severity="info" sx={{ mb: 2 }}>
|
|
|
|
Change requests feature is enabled for {environment}. Your
|
|
|
|
changes needs to be approved before they will be live. All the
|
|
|
|
changes you do now will be added into a draft that you can
|
|
|
|
submit for review.
|
|
|
|
</Alert>
|
|
|
|
)}
|
2022-10-28 09:37:55 +02:00
|
|
|
<Typography variant="body2" color="text.secondary">
|
2022-11-04 10:33:07 +01:00
|
|
|
Your suggestion:
|
2022-10-28 09:37:55 +02:00
|
|
|
</Typography>
|
2022-11-04 10:33:07 +01:00
|
|
|
{messageComponent}
|
2022-10-28 09:37:55 +02:00
|
|
|
</Dialogue>
|
|
|
|
);
|