@@ -3,7 +3,7 @@ import { Box, Stack } from '@mui/system';
33import { Grid , FormGroup , FormControlLabel , Typography , Link } from '@mui/material' ;
44import { useState , useMemo } from 'react' ;
55import { useCurrentUser } from '../../../../hooks/users.hooks' ;
6- import { Project , rankUserRole , wbsPipe } from 'shared' ;
6+ import { Project , rankUserRole , Review_Status , wbsPipe } from 'shared' ;
77import NERSwitch from '../../../../components/NERSwitch' ;
88import CommonMistakes from './CommonMistakes' ;
99import { usePartsFromProject } from '../../../../hooks/part-review.hooks' ;
@@ -26,27 +26,19 @@ const PartsReviewPage = ({ project }: { project: Project }) => {
2626 return parts ?. filter (
2727 ( part ) =>
2828 part . reviewRequests . some ( ( request ) => request . reviewerRequested . userId === currentUser . userId ) &&
29- // Right now, we have no way to access the reviews for the most recent submission -- thus, we can't check if
30- // the current user specifically reviewed the most recent submission (the part status does not tell us this)
31- // If we could modify the PartPreview type to include reviews for the most recent submission, the below check would work
32- // If that's too complicated, this list won't really be useful
33- // part.submissions[0].reviews.some(review => review.userCreated.userId === currentUser.userId) &&
34- ( part . status === 'READY_FOR_REVIEW' || part . status === 'IN_REVIEW' )
29+ part . status === Review_Status . READY_FOR_REVIEW
3530 ) ;
3631 } , [ parts , currentUser ] ) ;
3732
3833 const myPartsUnderReview = useMemo ( ( ) => {
3934 return parts ?. filter (
40- ( part ) =>
41- part . assignees . some ( ( assignee ) => assignee . userId === currentUser . userId ) &&
42- part . status !== 'APPROVED' &&
43- part . status !== 'IN_PROGRESS'
35+ ( part ) => part . assignees . some ( ( assignee ) => assignee . userId === currentUser . userId ) && part . status !== Review_Status . APPROVED
4436 ) ;
4537 } , [ parts , currentUser ] ) ;
4638
4739 const allPartsUnderReview = useMemo ( ( ) => {
4840 return parts ?. filter (
49- ( part ) => part . status !== ' APPROVED' && part . status !== ' IN_PROGRESS' && isAtLeastRank ( 'LEADERSHIP' , currentUser . role )
41+ ( part ) => part . status !== Review_Status . APPROVED && part . status !== Review_Status . IN_PROGRESS && isAtLeastRank ( 'LEADERSHIP' , currentUser . role )
5042 ) ;
5143 } , [ parts , currentUser ] ) ;
5244
@@ -64,9 +56,6 @@ const PartsReviewPage = ({ project }: { project: Project }) => {
6456
6557 return (
6658 < Box >
67- { /* <PartDisplay part={samplePart} contentAmount="full"></PartDisplay>
68- <PartDisplay part={samplePart} contentAmount="standard"></PartDisplay>
69- <PartDisplay part={samplePart} contentAmount="compact"></PartDisplay> */ }
7059 < CreateMenu wbsNum = { project . wbsNum } partsInProject = { parts } />
7160 < Grid container spacing = { 3 } >
7261 < Grid item xs = { 12 } >
0 commit comments