Skip to content

Commit 79abdd4

Browse files
committed
#1640: reformat the layout and modify tests
1 parent 890cb12 commit 79abdd4

8 files changed

Lines changed: 30 additions & 27 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import Typography from '@mui/material/Typography';
77
import { Grid } from '@mui/material';
88

9-
interface CRBlockProps {
9+
interface InfoBlockProps {
1010
title: string;
1111
}
1212

@@ -15,17 +15,17 @@ interface CRBlockProps {
1515
* @param title The title of the block on the page
1616
* @param children The children of the block
1717
*/
18-
const CRBlock: React.FC<CRBlockProps> = ({ title, children }) => {
18+
const InfoBlock: React.FC<InfoBlockProps> = ({ title, children }) => {
1919
return (
2020
<Grid container spacing={1}>
2121
<Grid item xs={12}>
22-
<Typography sx={{ fontWeight: 'bold', fontSize: '22px' }}>{title}</Typography>
22+
<Typography sx={{ fontWeight: 'bold', fontSize: '19px' }}>{title}</Typography>
2323
</Grid>
2424
<Grid item xs={12}>
25-
<Typography sx={{ fontSize: '15px' }}>{children}</Typography>
25+
{children}
2626
</Grid>
2727
</Grid>
2828
);
2929
};
3030

31-
export default CRBlock;
31+
export default InfoBlock;

src/frontend/src/layouts/PageTitle/PageTitle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const PageTitle: React.FC<PageTitleProps> = ({ title, previousPages, headerRight
2727
<>
2828
<PageBreadcrumbs currentPageTitle={title} previousPages={previousPages} />
2929
<Box sx={{ mb: 2 }}>
30-
<Grid container>
30+
<Grid container alignItems="center">
3131
<Grid item xs={6} md={8}>
3232
<Typography variant="h4" fontSize={30}>
3333
{title}

src/frontend/src/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,19 @@ const ChangeRequestDetailsView: React.FC<ChangeRequestDetailsProps> = ({
107107
/>
108108
}
109109
>
110-
<Grid container rowGap={4}>
110+
<Grid container rowGap={3}>
111111
<Grid container columnSpacing={3}>
112112
<Grid item xs={'auto'}>
113-
<Typography sx={{ fontWeight: 'normal', fontSize: '24px' }}>
114-
<b>WBS: </b>{' '}
113+
<Typography sx={{ fontWeight: 'normal', fontSize: '21px' }}>
114+
<b>WBS: </b>
115115
<Link component={RouterLink} to={`${routes.PROJECTS}/${wbsPipe(changeRequest.wbsNum)}`}>
116116
{wbsPipe(changeRequest.wbsNum)} - {projectName}
117117
{isProject(changeRequest.wbsNum) ? '' : ' - ' + changeRequest.wbsName}
118118
</Link>
119119
</Typography>
120120
</Grid>
121121
<Grid item xs={'auto'}>
122-
<Typography sx={{ fontWeight: 'normal', fontSize: '24px' }}>
122+
<Typography sx={{ fontWeight: 'normal', fontSize: '21px' }}>
123123
<b>Submitter: </b>
124124
{fullNamePipe(changeRequest.submitter)} on {datePipe(changeRequest.dateSubmitted)}
125125
</Typography>
@@ -132,14 +132,14 @@ const ChangeRequestDetailsView: React.FC<ChangeRequestDetailsProps> = ({
132132
<Grid item xs={12}>
133133
{buildProposedSolutions(changeRequest)}
134134
</Grid>
135-
<Grid item xs={12}>
135+
<Grid item xs={5}>
136136
<ReviewNotes
137137
reviewer={changeRequest.reviewer}
138138
reviewNotes={changeRequest.reviewNotes}
139139
dateReviewed={changeRequest.dateReviewed}
140140
/>
141141
</Grid>
142-
<Grid item xs={12}>
142+
<Grid item xs={6}>
143143
<ImplementedChangesList
144144
changes={changeRequest.implementedChanges || []}
145145
overallDateImplemented={changeRequest.dateImplemented}

src/frontend/src/pages/ChangeRequestDetailPage/ImplementedChangesList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import { routes } from '../../utils/routes';
99
import { Link, ListItem, List, Typography } from '@mui/material';
1010
import { Link as RouterLink } from 'react-router-dom';
1111
import DynamicTooltip from '../../components/DynamicTooltip';
12-
import CRBlock from '../../layouts/CRBlock';
12+
import InfoBlock from '../../layouts/InfoBlock';
1313

1414
interface ImplementedChangesListProps {
1515
changes: ImplementedChange[];
1616
overallDateImplemented?: Date;
1717
}
1818

19-
const ImplementedChangesList: React.FC<ImplementedChangesListProps> = ({ changes, overallDateImplemented }) => {
19+
const ImplementedChangesList: React.FC<ImplementedChangesListProps> = ({ changes }) => {
2020
return (
21-
<CRBlock
21+
<InfoBlock
2222
title={'Implemented Changes'}
2323
children={
2424
<List>
@@ -45,7 +45,7 @@ const ImplementedChangesList: React.FC<ImplementedChangesListProps> = ({ changes
4545
)}
4646
</List>
4747
}
48-
></CRBlock>
48+
></InfoBlock>
4949
);
5050
};
5151

src/frontend/src/pages/ChangeRequestDetailPage/ReviewNotes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { User } from 'shared';
77
import { datePipe, emDashPipe, fullNamePipe } from '../../utils/pipes';
88
import { Tooltip, Typography } from '@mui/material';
9-
import CRBlock from '../../layouts/CRBlock';
9+
import InfoBlock from '../../layouts/InfoBlock';
1010

1111
interface ReviewNotesProps {
1212
reviewer?: User;
@@ -16,7 +16,7 @@ interface ReviewNotesProps {
1616

1717
const ReviewNotes: React.FC<ReviewNotesProps> = ({ reviewer, reviewNotes, dateReviewed }: ReviewNotesProps) => {
1818
return (
19-
<CRBlock
19+
<InfoBlock
2020
title={'Review Notes'}
2121
children={
2222
<Typography>
@@ -36,10 +36,10 @@ const ReviewNotes: React.FC<ReviewNotesProps> = ({ reviewer, reviewNotes, dateRe
3636
>
3737
<span>{fullNamePipe(reviewer)}</span>
3838
</Tooltip>
39-
{reviewNotes ? reviewNotes : 'There are no review notes for this change request.'}
39+
{reviewNotes ?? 'There are no review notes for this change request.'}
4040
</Typography>
4141
}
42-
></CRBlock>
42+
></InfoBlock>
4343
);
4444
};
4545

src/frontend/src/pages/ChangeRequestDetailPage/StageGateDetails.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55

66
import { StageGateChangeRequest } from 'shared';
77
import { booleanPipe } from '../../utils/pipes';
8-
import CRBlock from '../../layouts/CRBlock';
8+
import InfoBlock from '../../layouts/InfoBlock';
9+
import { Typography } from '@mui/material';
910

1011
interface StageGateDetailsProps {
1112
cr: StageGateChangeRequest;
1213
}
1314

1415
const StageGateDetails: React.FC<StageGateDetailsProps> = ({ cr }) => {
15-
return <CRBlock title={'Confirm WP Completed'} children={booleanPipe(cr.confirmDone)}></CRBlock>;
16+
return (
17+
<InfoBlock title={'Confirm WP Completed'} children={<Typography>{booleanPipe(cr.confirmDone)}</Typography>}></InfoBlock>
18+
);
1619
};
1720

1821
export default StageGateDetails;

src/frontend/src/tests/pages/ChangeRequestDetailPage/ImplementedChangesList.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const renderComponent = (changes: ImplementedChange[] = [], overallDate?: Date)
2222

2323
describe('Rendering Implemented Changes List Component', () => {
2424
it('renders everything', () => {
25-
renderComponent(exampleStandardImplementedChangeRequest.implementedChanges, new Date('2020-01-02 12:00:00'));
25+
renderComponent(exampleStandardImplementedChangeRequest.implementedChanges);
2626

2727
expect(screen.getByText(`Implemented Changes`)).toBeInTheDocument();
2828

@@ -31,6 +31,6 @@ describe('Rendering Implemented Changes List Component', () => {
3131
expect(screen.getByText('1.23.4')).toBeInTheDocument();
3232
expect(screen.getByText(/Adjust description/i)).toBeInTheDocument();
3333

34-
expect(screen.getByText('01/02/2020')).toBeInTheDocument();
34+
3535
});
3636
});

src/frontend/src/tests/pages/ChangeRequestDetailPage/ReviewNotes.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ describe('Change request review notes test', () => {
4747

4848
it('renders tooltip on hover', async () => {
4949
renderComponent(cr[0]);
50-
fireEvent.mouseOver(screen.getByText(fullNamePipe(exampleAppAdminUser)));
50+
fireEvent.mouseOver(screen.getByText(`${fullNamePipe(exampleAppAdminUser)}—`));
5151

5252
expect(await screen.findByText(/Reviewed On: /i)).toBeInTheDocument();
5353
});
5454

5555
it('renders no date tooltip on hover', async () => {
5656
renderComponent(cr[2]);
57-
fireEvent.mouseOver(screen.getByText('—'));
57+
fireEvent.mouseOver(screen.getByText('—'));
5858

5959
expect(await screen.findByText('Reviewed on: —')).toBeInTheDocument();
6060
});
6161

6262
it('renders review date tooltip on hover', async () => {
6363
renderComponent(cr[0]);
64-
fireEvent.mouseOver(screen.getByText(fullNamePipe(exampleAppAdminUser)));
64+
fireEvent.mouseOver(screen.getByText(`${fullNamePipe(exampleAppAdminUser)}—`));
6565

6666
expect(
6767
await screen.findByText(`Reviewed on: ${datePipe(exampleStandardChangeRequest.dateReviewed!)}`)

0 commit comments

Comments
 (0)