Skip to content

Commit ce18100

Browse files
committed
#1642-pr-comments
1 parent 5f25dbd commit ce18100

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ const ChangeRequestDetailsView: React.FC<ChangeRequestDetailsProps> = ({
153153
{deleteModalShow && (
154154
<DeleteChangeRequest modalShow={deleteModalShow} handleClose={handleDeleteClose} cr={changeRequest} />
155155
)}
156-
<Grid container spacing={1} style={{ display: 'flex' }}>
157-
<OtherChangeRequestsPopupTabs changeRequest={changeRequest} fromSubmitter={true} />
158-
</Grid>
156+
<OtherChangeRequestsPopupTabs changeRequest={changeRequest} fromSubmitter={true} />
159157
</PageLayout>
160158
);
161159
};

src/frontend/src/pages/ChangeRequestDetailPage/OtherChangeRequestsPopupTabs.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { Box, useTheme, Collapse, Tabs, Tab, Typography } from '@mui/material';
88
import { ChangeRequest, wbsPipe } from 'shared';
99
import ChangeRequestDetailCard from '../../components/ChangeRequestDetailCard';
1010
import { useAllChangeRequests } from '../../hooks/change-requests.hooks';
11-
import { ExpandLess, ExpandMore } from '@mui/icons-material';
1211
import LoadingIndicator from '../../components/LoadingIndicator';
1312
import ErrorPage from '../ErrorPage';
1413
import { fullNamePipe } from '../../utils/pipes';
@@ -19,8 +18,7 @@ interface OtherChangeRequestsPopupTabsProps {
1918
}
2019

2120
const OtherChangeRequestsPopupTabs: React.FC<OtherChangeRequestsPopupTabsProps> = ({
22-
changeRequest,
23-
fromSubmitter
21+
changeRequest
2422
}: OtherChangeRequestsPopupTabsProps) => {
2523
const theme = useTheme();
2624
const [tab, setTab] = useState(0);
@@ -40,20 +38,14 @@ const OtherChangeRequestsPopupTabs: React.FC<OtherChangeRequestsPopupTabsProps>
4038
return b.dateSubmitted.getTime() - a.dateSubmitted.getTime();
4139
});
4240

43-
const crsFromWbs = changeRequests?.filter((cr) => cr.wbsName === changeRequest.wbsName);
41+
const crsFromWbs = changeRequests
42+
?.filter((cr) => cr.wbsName === changeRequest.wbsName)
43+
.sort((a: ChangeRequest, b: ChangeRequest) => {
44+
return b.dateSubmitted.getTime() - a.dateSubmitted.getTime();
45+
});
4446

4547
const displayTab = (value: number, title: string) => (
46-
<Tab
47-
value={value}
48-
sx={{ borderRadius: '16px 16px 0 0' }}
49-
label={
50-
<Typography sx={{ display: 'flex' }}>
51-
{title}
52-
{tab === value ? <ExpandMore sx={{ pl: 0.5 }} /> : <ExpandLess sx={{ pl: 0.5 }} />}
53-
</Typography>
54-
}
55-
onClick={() => tab === value && setTab(0)}
56-
/>
48+
<Tab value={value} sx={{ borderRadius: '16px 16px 0 0' }} label={title} onClick={() => tab === value && setTab(0)} />
5749
);
5850

5951
const displayCRCards = (crList: ChangeRequest[]) => (
@@ -117,7 +109,7 @@ const OtherChangeRequestsPopupTabs: React.FC<OtherChangeRequestsPopupTabsProps>
117109
mb: '-1px'
118110
}}
119111
>
120-
{displayTab(1, `Other CR's from ${wbsPipe(changeRequest.wbsNum)}`)}
112+
{displayTab(1, `Other CR's on ${wbsPipe(changeRequest.wbsNum)}`)}
121113
{displayTab(2, `Other CR's from ${fullNamePipe(changeRequest.submitter)}`)}
122114
</Tabs>
123115
<Collapse in={tab !== 0}>

0 commit comments

Comments
 (0)