|
1 | 1 | import React from 'react'; |
2 | 2 | import { Link, Box, Typography, Grid } from '@mui/material'; |
3 | | -import { Review_Status } from 'shared'; |
4 | 3 | import { fullNamePipe } from '../../../utils/pipes'; |
5 | 4 | import { useSinglePart } from '../../../hooks/part-review.hooks'; |
6 | 5 | import LoadingIndicator from '../../../components/LoadingIndicator'; |
7 | 6 | import ErrorPage from '../../ErrorPage'; |
8 | 7 | import { Link as RouterLink } from 'react-router-dom'; |
| 8 | +import { getReviewStatusDisplayName, getStatusColor } from '../../../utils/part.utils'; |
9 | 9 |
|
10 | 10 | interface PartDisplayProps { |
11 | 11 | index: number; |
12 | 12 | wbsNum: string; |
13 | 13 | formatStyle: 'compact' | 'standard' | 'full'; |
14 | 14 | } |
15 | 15 |
|
16 | | -const getReviewStatusColor = (status: Review_Status) => { |
17 | | - return { |
18 | | - IN_PROGRESS: '#959696', |
19 | | - READY_FOR_REVIEW: '#F61517', |
20 | | - IN_REVIEW: '#F57600', |
21 | | - REVIEWED: '#3CA848', |
22 | | - APPROVED: '#D633FF', |
23 | | - default: '#535151' |
24 | | - }[status]; |
25 | | -}; |
26 | | - |
27 | | -const getReviewStatusDisplayName = (status: Review_Status): string => { |
28 | | - return { |
29 | | - IN_PROGRESS: 'In Progress', |
30 | | - READY_FOR_REVIEW: 'Ready for Review', |
31 | | - IN_REVIEW: 'In Review', |
32 | | - REVIEWED: 'Reviewed', |
33 | | - APPROVED: 'Approved', |
34 | | - default: 'Unknown' |
35 | | - }[status]; |
36 | | -}; |
37 | | - |
38 | 16 | // defined a Pill shape for the review status display |
39 | 17 | const Pill = ({ label = '', bgColor = 'background.paper' }) => { |
40 | 18 | return ( |
@@ -200,7 +178,7 @@ const PartDisplay: React.FC<PartDisplayProps> = ({ index, wbsNum, formatStyle: c |
200 | 178 | justifyContent: 'center' |
201 | 179 | }} |
202 | 180 | > |
203 | | - <Pill label={getReviewStatusDisplayName(part.status)} bgColor={getReviewStatusColor(part.status)} /> |
| 181 | + <Pill label={getReviewStatusDisplayName(part.status)} bgColor={getStatusColor(part.status)} /> |
204 | 182 | </Grid> |
205 | 183 | </Grid> |
206 | 184 | </Link> |
|
0 commit comments