@@ -8,7 +8,6 @@ import { Box, useTheme, Collapse, Tabs, Tab, Typography } from '@mui/material';
88import { ChangeRequest , wbsPipe } from 'shared' ;
99import ChangeRequestDetailCard from '../../components/ChangeRequestDetailCard' ;
1010import { useAllChangeRequests } from '../../hooks/change-requests.hooks' ;
11- import { ExpandLess , ExpandMore } from '@mui/icons-material' ;
1211import LoadingIndicator from '../../components/LoadingIndicator' ;
1312import ErrorPage from '../ErrorPage' ;
1413import { fullNamePipe } from '../../utils/pipes' ;
@@ -19,8 +18,7 @@ interface OtherChangeRequestsPopupTabsProps {
1918}
2019
2120const 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