11import Box from "@mui/material/Box" ;
22import Divider from "@mui/material/Divider" ;
3- import ContentPasteIcon from "@mui/icons-material/ContentPaste" ;
43import { useState , type ReactNode } from "react" ;
54import { format } from "date-fns" ;
65import Typography from "@mui/material/Typography" ;
7-
6+ import Chip from "../design_system/chip/Chip" ;
7+ import LogicChip from "./BenchmarkChipController" ;
88import Button from "@/components/design_system/button/Button" ;
99import { BenchmarkAssignmentModal } from "./BenchmarkAssignmentModal" ;
1010import BenchmarkAssignees from "./BenchmarkAssignees" ;
1111import { Benchmark } from "@/types/global" ;
1212import Link from "next/link" ;
1313import { useRouter } from "next/router" ;
1414
15+ import ContentPasteOutlinedIcon from "@mui/icons-material/ContentPasteOutlined" ;
16+
1517interface BenchmarkProps {
1618 benchmark : Benchmark ;
1719 index ?: number ;
@@ -34,15 +36,49 @@ const Info = ({ description, children }: InfoProps) => {
3436 textAlign : "center" ,
3537 } }
3638 >
37- < Typography
38- sx = { { marginBottom : "0.5em" } }
39- variant = "overline"
40- display = "block"
41- gutterBottom
42- >
43- { description }
44- </ Typography >
39+ { description . includes ( "Assigned STAFF" ) ||
40+ description . includes ( "DATA" ) ? (
41+ < Typography
42+ sx = { {
43+ marginTop : "1em" ,
44+ color : "gray" ,
45+ fontWeight : "600" ,
46+ fontStyle : "semi bold" ,
47+ fontSize : "12px" ,
48+ lineHeight : "100%" ,
49+ letterSpacing : "0%" ,
50+ } }
51+ variant = "overline"
52+ display = "block"
53+ gutterBottom
54+ >
55+ { description }
56+ </ Typography >
57+ ) : (
58+ ""
59+ ) }
4560 { children }
61+ { description . includes ( "Assigned STAFF" ) ||
62+ description . includes ( "DATA" ) ? (
63+ ""
64+ ) : (
65+ < Typography
66+ sx = { {
67+ marginTop : "1em" ,
68+ color : "gray" ,
69+ fontWeight : "600" ,
70+ fontStyle : "semi bold" ,
71+ fontSize : "12px" ,
72+ lineHeight : "100%" ,
73+ letterSpacing : "0%" ,
74+ } }
75+ variant = "overline"
76+ display = "block"
77+ gutterBottom
78+ >
79+ { description }
80+ </ Typography >
81+ ) }
4682 </ Box >
4783 ) ;
4884} ;
@@ -77,27 +113,15 @@ const BenchmarkListElement = ({
77113 padding : "1rem" ,
78114 } }
79115 >
80- < Typography
81- sx = { { color : "var(--primary-40)" } }
82- variant = "overline"
83- display = "block"
84- gutterBottom
85- >
86- #{ ( index ?? 0 ) + 1 } created on { format ( benchmark ?. created_at , "P" ) }
87- </ Typography >
116+ < Chip
117+ variant = "calendar"
118+ label = { `Created on: ${ format ( benchmark ?. created_at , "MMM, d, yyyy" ) } ` }
119+ />
120+
88121 < Box sx = { { display : "flex" , justifyContent : "space-between" } } >
89122 < Box sx = { { display : "flex" } } >
90- < ContentPasteIcon
91- sx = { {
92- color : "var(--grey-10)" ,
93- fontSize : 12 ,
94- margin : "1.25rem" ,
95- marginLeft : "0.5rem" ,
96- marginRight : "0.5rem" ,
97- } }
98- />
99-
100- < Box sx = { { margin : "1rem" , marginLeft : ".5rem" } } >
123+ < Box sx = { { marginTop : "1.5rem" } } >
124+ < Chip label = { ( index ?? 0 ) + 1 } variant = "task" />
101125 { benchmark . description }
102126 </ Box >
103127 </ Box >
@@ -118,23 +142,21 @@ const BenchmarkListElement = ({
118142 >
119143 < Info description = { "BASELINE LEVEL" } >
120144 { " " }
121- { benchmark ?. baseline_level } %{ " " }
145+ < LogicChip data = { benchmark ?. baseline_level } />
146+ </ Info >
147+ < Info description = { "TARGET LEVEL" } >
148+ { " " }
149+ < LogicChip data = { benchmark ?. target_level } />
122150 </ Info >
123- < Info description = { "TARGET LEVEL" } > { benchmark ?. target_level } % </ Info >
124151 < Info description = { "CURRENT LEVEL" } >
125152 { " " }
126- { benchmark ?. current_level || "N/A" } { " " }
153+ < LogicChip data = { benchmark ?. current_level } />
127154 </ Info >
128155 < Info description = { "# OF TRIALS" } >
129156 { " " }
130- { benchmark ?. number_of_trials || "N/A" }
131- </ Info >
132- < Info description = { "STAFF" } >
133- < BenchmarkAssignees
134- benchmark = { benchmark }
135- onAssign = { ( ) => setIsAssignmentModalOpen ( true ) }
136- />
157+ < LogicChip data = { benchmark ?. number_of_trials } notifier = { true } />
137158 </ Info >
159+
138160 < Info description = "DATA" >
139161 < Box
140162 sx = { {
@@ -151,7 +173,12 @@ const BenchmarkListElement = ({
151173 } }
152174 >
153175 < Link href = { `/benchmarks/${ benchmark . benchmark_id } ` } >
154- < Button variant = "tertiary" > Collect Data</ Button >
176+ < Button
177+ variant = "tertiary"
178+ startIcon = { < ContentPasteOutlinedIcon fontSize = "medium" /> }
179+ >
180+ Collect Data
181+ </ Button >
155182 </ Link >
156183 </ Box >
157184 < Box
@@ -170,6 +197,12 @@ const BenchmarkListElement = ({
170197 </ Box >
171198 </ Box >
172199 </ Info >
200+ < Info description = { "Assigned STAFF" } >
201+ < BenchmarkAssignees
202+ benchmark = { benchmark }
203+ onAssign = { ( ) => setIsAssignmentModalOpen ( true ) }
204+ />
205+ </ Info >
173206 </ Box >
174207 </ Box >
175208 { isAssignmentModalOpen && (
0 commit comments