diff --git a/frontend/src/component/application/ApplicationOverview.tsx b/frontend/src/component/application/ApplicationOverview.tsx index 9800925831..d4ce2589f0 100644 --- a/frontend/src/component/application/ApplicationOverview.tsx +++ b/frontend/src/component/application/ApplicationOverview.tsx @@ -11,8 +11,9 @@ import { import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; import { useNavigate } from 'react-router-dom'; import Check from '@mui/icons-material/CheckCircle'; +import Warning from '@mui/icons-material/Warning'; import { ArcherContainer, ArcherElement } from 'react-archer'; -import { useLayoutEffect, useRef, useState } from 'react'; +import { FC, useLayoutEffect, useRef, useState } from 'react'; const StyledTable = styled('table')(({ theme }) => ({ fontSize: theme.fontSizes.smallerBody, @@ -31,34 +32,41 @@ const StyleApplicationContainer = styled(Box)(({ theme }) => ({ justifyContent: 'center', })); -const StyledApplicationBox = styled(Box)(({ theme }) => ({ - borderRadius: theme.shape.borderRadiusMedium, - border: '1px solid', - borderColor: theme.palette.success.border, - backgroundColor: theme.palette.success.light, - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - padding: theme.spacing(1.5, 3, 2, 3), -})); +const StyledApplicationBox = styled(Box)<{ mode: 'success' | 'warning' }>( + ({ theme, mode }) => ({ + borderRadius: theme.shape.borderRadiusMedium, + border: '1px solid', + borderColor: theme.palette[mode].border, + backgroundColor: theme.palette[mode].light, + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + padding: theme.spacing(1.5, 3, 2, 3), + }), +); -const StyledOkStatus = styled(Typography)(({ theme }) => ({ - gap: theme.spacing(0.5), - fontSize: theme.fontSizes.smallBody, - color: theme.palette.success.dark, - display: 'flex', - alignItems: 'center', -})); +const StyledStatus = styled(Typography)<{ mode: 'success' | 'warning' }>( + ({ theme, mode }) => ({ + gap: theme.spacing(1), + fontSize: theme.fontSizes.smallBody, + color: theme.palette[mode].dark, + display: 'flex', + alignItems: 'center', + }), +); -const StyledEnvironmentBox = styled(Box)(({ theme }) => ({ - borderRadius: theme.shape.borderRadiusMedium, - border: '1px solid', - borderColor: theme.palette.secondary.border, - backgroundColor: theme.palette.secondary.light, - display: 'inline-block', - padding: theme.spacing(1.5, 0, 1.5, 1), - minWidth: '270px', -})); +const StyledEnvironmentBox = styled(Box)<{ mode: 'success' | 'warning' }>( + ({ theme, mode }) => ({ + borderRadius: theme.shape.borderRadiusMedium, + border: '1px solid', + borderColor: + theme.palette[mode === 'success' ? 'secondary' : 'warning'].border, + backgroundColor: + theme.palette[mode === 'success' ? 'secondary' : 'warning'].light, + display: 'inline-block', + padding: theme.spacing(1.5, 0, 1.5, 1.5), + }), +); const StyledDivider = styled(Divider)(({ theme }) => ({ marginTop: theme.spacing(2), @@ -72,6 +80,33 @@ const StyledEnvironmentsContainer = styled(Box)({ gap: '20px', }); +const EnvironmentHeader = styled(Typography)(({ theme }) => ({ + fontSize: theme.fontSizes.smallerBody, + fontWeight: theme.fontWeight.bold, +})); + +const SuccessStatus = () => ( + + ({ + color: theme.palette.success.main, + })} + />{' '} + Everything looks good! + +); + +const WarningStatus: FC = ({ children }) => ( + + ({ + color: theme.palette.warning.main, + })} + />{' '} + {children} + +); + const useElementWidth = () => { const elementRef = useRef(null); const [width, setWidth] = useState('100%'); @@ -120,6 +155,8 @@ export const ApplicationOverview = () => { const { elementRef, width } = useElementWidth(); + const mode: 'success' | 'warning' = 'success'; + return ( { targetId: environment.name, targetAnchor: 'top', sourceAnchor: 'bottom', + style: { + strokeColor: + mode === 'success' + ? theme.palette.secondary + .border + : theme.palette.warning + .border, + }, }), )} > - + ({ fontSize: @@ -162,35 +207,29 @@ export const ApplicationOverview = () => { - - ({ - color: theme.palette.success - .main, - })} - />{' '} - Everything looks good! - + } + elseShow={ + + 3 issues detected + + } + /> - {app.environments.map((environment, index) => ( + {app.environments.map((environment) => ( - ({ - fontSize: - theme.fontSizes.smallerBody, - fontWeight: - theme.fontWeight.bold, - })} - > + {environment.name} environment - +