Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/cr UI fixes #2675

Merged
merged 6 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const Change: FC<{
</StyledAlert>
}
/>
<Box sx={{ p: 2 }}>
<Box sx={theme => ({ padding: theme.spacing(3) })}>
{change.action === 'updateEnabled' && (
<ToggleStatusChange
enabled={change.payload.enabled}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import { Box, Link, styled, Typography } from '@mui/material';
import { Box, styled, Typography } from '@mui/material';
import { FC, ReactNode } from 'react';

export const ChangeItemWrapper = styled(Box)(({ theme }) => ({
export const ChangeItemWrapper = styled(Box)({
display: 'flex',
justifyContent: 'space-between',
padding: theme.spacing(1),
alignItems: 'center',
});

export const ChangeItemCreateEditWrapper = styled(Box)(({ theme }) => ({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: theme.spacing(2),
}));

const ChangeItemInfo: FC = styled(Box)(({ theme }) => ({
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1),
}));

Expand All @@ -17,17 +25,19 @@ export const StrategyAddedChange: FC<{ discard?: ReactNode }> = ({
discard,
}) => {
return (
<ChangeItemWrapper>
<ChangeItemCreateEditWrapper>
<ChangeItemInfo>
<Typography
sx={theme => ({ color: theme.palette.success.dark })}
sx={theme => ({
color: theme.palette.success.dark,
})}
>
+ Adding strategy:
</Typography>
{children}
</ChangeItemInfo>
{discard}
</ChangeItemWrapper>
</ChangeItemCreateEditWrapper>
);
};

Expand All @@ -36,13 +46,13 @@ export const StrategyEditedChange: FC<{ discard?: ReactNode }> = ({
discard,
}) => {
return (
<ChangeItemWrapper>
<ChangeItemCreateEditWrapper>
<ChangeItemInfo>
<Typography>Editing strategy:</Typography>
{children}
</ChangeItemInfo>
{discard}
</ChangeItemWrapper>
</ChangeItemCreateEditWrapper>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ export const ToggleStatusChange: VFC<IToggleStatusChange> = ({
}) => {
return (
<ChangeItemWrapper>
<Box>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
New status:{' '}
<Badge color={enabled ? 'success' : 'error'}>
<Badge
sx={theme => ({ marginLeft: theme.spacing(1) })}
color={enabled ? 'success' : 'error'}
>
{enabled ? ' Enabled' : 'Disabled'}
</Badge>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react';
import { Link } from 'react-router-dom';
import { Alert, Box, Card, Typography } from '@mui/material';
import { Link as RouterLink } from 'react-router-dom';
import { Alert, Box, Card, Typography, Link } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';

interface IFeatureToggleChanges {
Expand Down Expand Up @@ -28,14 +28,14 @@ export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
sx={theme => ({
backgroundColor: Boolean(conflict)
? theme.palette.neutral.light
: theme.palette.tableHeaderBackground,
: theme.palette.neutral.light,
borderRadius: theme =>
`${theme.shape.borderRadiusLarge}px ${theme.shape.borderRadiusLarge}px 0 0`,
border: '1px solid',
borderColor: theme =>
conflict
? theme.palette.warning.border
: theme.palette.divider,
: theme.palette.tertiary.main,
borderBottom: 'none',
overflow: 'hidden',
})}
Expand Down Expand Up @@ -65,15 +65,22 @@ export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
}}
>
<Typography>Feature toggle name: </Typography>
<Typography
component={Link}

<Link
component={RouterLink}
to={`/projects/${projectId}/features/${featureName}`}
color="primary"
sx={{ textDecoration: 'none', marginLeft: 1 }}
underline="hover"
sx={{
marginLeft: 1,
'& :hover': {
textDecoration: 'underline',
},
}}
onClick={onNavigate}
>
<strong>{featureName}</strong>
</Typography>
</Link>
</Box>
</Box>
<Box>{children}</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const StyledCard = styled(Card)(({ theme }) => ({
}));

export const StyledAvatar = styled(Avatar)(({ theme }) => ({
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
height: '24px',
width: '24px',
}));
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ export const ChangeRequestHeader: FC<{ changeRequest: IChangeRequest }> = ({
Created <TimeAgo date={new Date(changeRequest.createdAt)} />{' '}
by
</Typography>
<Tooltip title={changeRequest?.createdBy?.username}>
<StyledAvatar src={changeRequest?.createdBy?.imageUrl} />
</Tooltip>
<Box
sx={theme => ({
marginLeft: theme.spacing(1),
})}
>
<Tooltip title={changeRequest?.createdBy?.username}>
<StyledAvatar
src={changeRequest?.createdBy?.imageUrl}
/>
</Tooltip>
</Box>
<Box sx={{ ml: 1.5 }}>
<StyledCard variant="outlined">
<Typography variant="body2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ const StyledBox = styled(Box)(({ theme }) => ({

export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({
color: theme.palette.success.main,
height: '25px',
width: '25px',
marginRight: theme.spacing(1),
marginLeft: 'auto',
}));

Expand All @@ -31,7 +28,16 @@ export const ChangeRequestReviewer: FC<IChangeRequestReviewerProps> = ({
return (
<StyledBox>
<StyledAvatar src={imageUrl} />
<Typography variant="body1" color="text.secondary">
<Typography
variant="body1"
color="text.primary"
sx={{
maxWidth: '170px',
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
}}
>
{name}
</Typography>
<StyledSuccessIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StyledPageContent = styled(PageContent)(({ theme }) => ({
height: '100vh',
overflow: 'auto',
minWidth: '50vw',
padding: theme.spacing(4, 6),
padding: theme.spacing(6),
[theme.breakpoints.down('md')]: {
padding: theme.spacing(4, 2),
},
Expand All @@ -42,8 +42,8 @@ const BackButton = styled(Button)(({ theme }) => ({

export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({
color: theme.palette.success.main,
height: '25px',
width: '25px',
height: '32px',
width: '32px',
marginRight: theme.spacing(1),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const StyledHelpOutline = styled(HelpOutline)(({ theme }) => ({
}));

const StyledHeaderHint = styled('div')(({ theme }) => ({
marginTop: theme.spacing(0.5),
color: theme.palette.text.secondary,
fontSize: theme.fontSizes.smallBody,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useStyles = makeStyles()(theme => ({
marginBottom: '8px',
},
title: {
marginBottom: '1.5rem',
marginBottom: theme.fontSizes.mainHeader,
fontWeight: 'normal',
},
subtitle: {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/utils/strategyNames.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, ElementType } from 'react';
import { SvgIcon } from '@mui/material';
import { SvgIcon, useTheme } from '@mui/material';
import LocationOnIcon from '@mui/icons-material/LocationOn';
import PeopleIcon from '@mui/icons-material/People';
import LanguageIcon from '@mui/icons-material/Language';
Expand Down Expand Up @@ -39,8 +39,9 @@ export const getFeatureStrategyIcon = (strategyName: string): ElementType => {
export const GetFeatureStrategyIcon: FC<{ strategyName: string }> = ({
strategyName,
}) => {
const theme = useTheme();
const Icon = getFeatureStrategyIcon(strategyName);
return <Icon />;
return <Icon style={{ color: theme.palette.neutral.main }} />;
};

export const formattedStrategyNames: Record<string, string> = {
Expand Down