diff --git a/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx b/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx index c91880fcb5..dc22b2ad5a 100644 --- a/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestSidebar/ChangeRequestSidebar.tsx @@ -1,4 +1,4 @@ -import { VFC } from 'react'; +import { FC, VFC } from 'react'; import { Box, Button, @@ -58,6 +58,15 @@ const BackButton = styled(Button)(({ theme }) => ({ marginLeft: 'auto', })); +const SubmitChangeRequestButton: FC<{ onClick: () => void; count: number }> = ({ + onClick, + count, +}) => ( + +); + export const ChangeRequestSidebar: VFC = ({ open, project, @@ -218,17 +227,18 @@ export const ChangeRequestSidebar: VFC = ({ } show={ <> - + count={ + environmentChangeRequest + .features.length + } + /> + + + + + ); +}; + +const StickyBanner = styled(Box)(({ theme }) => ({ + position: 'sticky', + top: -1, + zIndex: theme.zIndex.appBar, + borderTop: `1px solid ${theme.palette.warning.border}`, + borderBottom: `1px solid ${theme.palette.warning.border}`, + backgroundColor: theme.palette.warning.light, +})); + +export const DraftBanner: VFC = ({ project }) => { const [isSidebarOpen, setIsSidebarOpen] = useState(false); const { draft, loading } = useChangeRequestOpen(project); - const environment = ''; if ((!loading && !draft) || draft?.length === 0) { return null; } return ( - theme.zIndex.appBar, - borderTop: theme => `1px solid ${theme.palette.warning.border}`, - borderBottom: theme => - `1px solid ${theme.palette.warning.border}`, - backgroundColor: theme => theme.palette.warning.light, - }} - > - - theme.palette.warning.main, - }} - > - - - Draft mode! – You have changes{' '} - - in {environment} - - } + + {draft && + draft + .filter(changeRequest => + ['Draft', 'In review'].includes(changeRequest.state) + ) + .map(changeRequest => ( + { + setIsSidebarOpen(true); + }} /> - that need to be reviewed - - - - - + ))} + = ({ project }) => { setIsSidebarOpen(false); }} /> - + ); }; diff --git a/frontend/src/component/common/SidebarModal/SidebarModal.styles.ts b/frontend/src/component/common/SidebarModal/SidebarModal.styles.ts deleted file mode 100644 index c63fb8c13c..0000000000 --- a/frontend/src/component/common/SidebarModal/SidebarModal.styles.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { makeStyles } from 'tss-react/mui'; - -export const useStyles = makeStyles()(() => ({ - modal: { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - height: '100vh', - maxWidth: '98vw', - width: 1300, - overflow: 'auto', - boxShadow: '0 0 1rem rgba(0, 0, 0, 0.25)', - }, -})); diff --git a/frontend/src/component/common/SidebarModal/SidebarModal.tsx b/frontend/src/component/common/SidebarModal/SidebarModal.tsx index 8c27e629d4..59d9813bf7 100644 --- a/frontend/src/component/common/SidebarModal/SidebarModal.tsx +++ b/frontend/src/component/common/SidebarModal/SidebarModal.tsx @@ -1,7 +1,6 @@ import { ReactNode } from 'react'; -import { Modal, Backdrop } from '@mui/material'; +import { Modal, Backdrop, styled } from '@mui/material'; import Fade from '@mui/material/Fade'; -import { useStyles } from 'component/common/SidebarModal/SidebarModal.styles'; import { SIDEBAR_MODAL_ID } from 'utils/testIds'; interface ISidebarModalProps { @@ -13,14 +12,24 @@ interface ISidebarModalProps { const TRANSITION_DURATION = 250; +const ModalContentWrapper = styled('div')({ + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + height: '100vh', + maxWidth: '98vw', + width: 1300, + overflow: 'auto', + boxShadow: '0 0 1rem rgba(0, 0, 0, 0.25)', +}); + export const SidebarModal = ({ open, onClose, label, children, }: ISidebarModalProps) => { - const { classes: styles } = useStyles(); - return ( -
{children}
+ {children}
);