Skip to content

Commit c6f18c6

Browse files
committed
#1644: proposed solutions redesign
1 parent d4bb4e6 commit c6f18c6

4 files changed

Lines changed: 18 additions & 25 deletions

File tree

src/frontend/src/pages/ChangeRequestDetailPage/ProposedSolutionView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ProposedSolutionView: React.FC<ProposedSolutionViewProps> = ({
2929
}) => {
3030
const faded = crReviewed != null && proposedSolution.approved === false;
3131
const theme = useTheme();
32+
const isDark = theme.palette.mode === 'dark';
3233

3334
return (
3435
<Grid
@@ -44,10 +45,10 @@ const ProposedSolutionView: React.FC<ProposedSolutionViewProps> = ({
4445
}}
4546
>
4647
<Grid container rowSpacing={1}>
47-
<Grid item xs={12} sx={{ p: 2, mt: 1, minHeight: 100, borderRadius: 1, bgcolor: '#474848' }}>
48+
<Grid item xs={12} sx={{ p: 2, mt: 1, minHeight: 100, borderRadius: 1, bgcolor: isDark ? '#474848' : 'white' }}>
4849
<DetailDisplay label="Description" content={proposedSolution.description} />
4950
</Grid>
50-
<Grid item xs={12} sx={{ p: 2, mt: 2, minHeight: 100, borderRadius: 1, bgcolor: '#474848' }}>
51+
<Grid item xs={12} sx={{ p: 2, mt: 2, minHeight: 100, borderRadius: 1, bgcolor: isDark ? '#474848' : 'white' }}>
5152
<DetailDisplay label="Scope Impact" content={proposedSolution.scopeImpact} />
5253
</Grid>
5354
<Grid item xs={7} display="flex" sx={{ marginTop: 0.5 }}>

src/frontend/src/pages/CreateChangeRequestPage/CreateChangeRequestView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ const CreateChangeRequestsView: React.FC<CreateChangeRequestViewProps> = ({
230230
rules={{ required: true }}
231231
render={({ field: { onChange, value } }) => (
232232
<RadioGroup onChange={onChange} value={value}>
233-
<Grid display="flex" flexDirection={{ xs: 'column', md: 'row' }}>
233+
<Box display="flex" flexDirection={{ xs: 'column', md: 'row' }} sx={{ gap: 2 }}>
234234
{permittedTypes.map((t) => (
235235
<NERButton
236236
sx={{
237-
mr: { xs: 0, md: 2 },
237+
// mr: { xs: 0, md: 2 },
238238
fontSize: { xs: '0.8rem', md: '1rem' },
239239
width: { xs: '83%', md: 'auto' }
240240
}}
@@ -245,7 +245,7 @@ const CreateChangeRequestsView: React.FC<CreateChangeRequestViewProps> = ({
245245
{t}
246246
</NERButton>
247247
))}
248-
</Grid>
248+
</Box>
249249
</RadioGroup>
250250
)}
251251
/>

src/frontend/src/pages/CreateChangeRequestPage/CreateProposedSolutionsList.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { isGuest, ProposedSolution } from 'shared';
77
import ProposedSolutionForm from '../ChangeRequestDetailPage/ProposedSolutionForm';
88
import { useState } from 'react';
99
import ProposedSolutionView from '../ChangeRequestDetailPage/ProposedSolutionView';
10-
import { Button, Grid, Typography } from '@mui/material';
10+
import { Button, Typography } from '@mui/material';
1111
import { useCurrentUser } from '../../hooks/users.hooks';
12+
import { Box } from '@mui/system';
1213

1314
interface CreateProposedSolutionsListProps {
1415
proposedSolutions: ProposedSolution[];
@@ -34,23 +35,14 @@ const CreateProposedSolutionsList: React.FC<CreateProposedSolutionsListProps> =
3435
return (
3536
<>
3637
{!isGuest(user.role) && (
37-
<Grid container columnSpacing={5}>
38-
<Grid item>
39-
<Typography variant="h5" sx={{ mt: 2 }}>
40-
Proposed Solutions
41-
</Typography>
42-
</Grid>
43-
<Grid item>
44-
<Button
45-
onClick={() => setShowEditableForm(true)}
46-
variant="contained"
47-
color="success"
48-
sx={{ mt: 2, maxHeight: { xs: 105, md: 35 }, height: {} }}
49-
>
50-
+ Add Proposed Solution
51-
</Button>
52-
</Grid>
53-
</Grid>
38+
<Box display="flex" justifyContent="space-between">
39+
<Typography variant="h5" sx={{ mt: 2 }}>
40+
Proposed Solutions
41+
</Typography>
42+
<Button onClick={() => setShowEditableForm(true)} variant="contained" color="success" sx={{ mt: 2 }}>
43+
+ Add Solution
44+
</Button>
45+
</Box>
5446
)}
5547
<div style={{ marginTop: '30px' }}>
5648
{proposedSolutions.map((proposedSolution, i) => (

src/frontend/src/tests/pages/CreateChangeRequestPage/CreateProposedSolutionsList.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Proposed Solutions List Test Suite', () => {
3333

3434
it('Renders correctly when empty', () => {
3535
renderComponent();
36-
expect(screen.getByText('+ Add Proposed Solution')).toBeInTheDocument();
36+
expect(screen.getByText('+ Add Solution')).toBeInTheDocument();
3737
expect(screen.queryAllByText('Description').length).toBe(0);
3838
expect(screen.queryAllByText('Scope Impact').length).toBe(0);
3939
expect(screen.queryAllByText('Budget Impact').length).toBe(0);
@@ -47,7 +47,7 @@ describe('Proposed Solutions List Test Suite', () => {
4747
expect(screen.queryByText('Budget Impact')).not.toBeInTheDocument();
4848
expect(screen.queryByText('Timeline Impact')).not.toBeInTheDocument();
4949
expect(screen.queryByText('Add')).not.toBeInTheDocument();
50-
screen.getByText('+ Add Proposed Solution').click();
50+
screen.getByText('+ Add Solution').click();
5151
expect(screen.getByText('Description')).toBeInTheDocument();
5252
expect(screen.getByText('Scope Impact')).toBeInTheDocument();
5353
expect(screen.getByText('Budget Impact')).toBeInTheDocument();

0 commit comments

Comments
 (0)