@@ -15,8 +15,15 @@ const CustomBar: React.FC<{
1515 name : string
1616 value : number
1717 testCaseSelection : Record < string , boolean > | null
18+ failedForCurrentImplementation : boolean | null
1819 handleOnBarClick : ( name : string ) => void
19- } > = ( { name, value, testCaseSelection, handleOnBarClick } ) => {
20+ } > = ( {
21+ name,
22+ value,
23+ testCaseSelection,
24+ failedForCurrentImplementation,
25+ handleOnBarClick,
26+ } ) => {
2027 const selectedColor = "purple.500"
2128 const unselectedColor = "purple.200"
2229
@@ -38,9 +45,19 @@ const CustomBar: React.FC<{
3845 < Text justifyContent = { "center" } pl = { 2 } position = { "absolute" } zIndex = { 1 } >
3946 { name }
4047 </ Text >
41- < Text position = { "absolute" } right = { 2 } zIndex = { 1 } >
42- { value . toFixed ( ) } %
43- </ Text >
48+ < Flex position = { "absolute" } right = { 2 } zIndex = { 1 } align = { "center" } gap = { 2 } >
49+ < Text > { value . toFixed ( ) } %</ Text >
50+ { failedForCurrentImplementation !== null ? (
51+ < Box
52+ height = { 2 }
53+ width = { 2 }
54+ borderRadius = { "full" }
55+ background = {
56+ failedForCurrentImplementation ? "red.500" : "green.500"
57+ }
58+ />
59+ ) : null }
60+ </ Flex >
4461 < Flex
4562 flex = { Math . max ( value , 1 ) }
4663 height = { 10 }
@@ -62,8 +79,14 @@ type BarChartData = {
6279const CustomBarChart : React . FC < {
6380 data : BarChartData [ ]
6481 testCaseSelection : Record < string , boolean > | null
82+ namedTestsPassedCurrentSubmission : Record < string , boolean > | null
6583 handleOnBarClick : ( name : string ) => void
66- } > = ( { data, testCaseSelection, handleOnBarClick } ) => {
84+ } > = ( {
85+ data,
86+ testCaseSelection,
87+ namedTestsPassedCurrentSubmission,
88+ handleOnBarClick,
89+ } ) => {
6790 return (
6891 < VStack width = { "full" } overflow = { "auto" } align = { "space-around" } gap = { 3 } >
6992 { data . map ( ( entry , i ) => (
@@ -72,6 +95,11 @@ const CustomBarChart: React.FC<{
7295 value = { entry . value }
7396 testCaseSelection = { testCaseSelection }
7497 handleOnBarClick = { handleOnBarClick }
98+ failedForCurrentImplementation = {
99+ namedTestsPassedCurrentSubmission
100+ ? ! namedTestsPassedCurrentSubmission [ entry . name ]
101+ : null
102+ }
75103 key = { i }
76104 />
77105 ) ) }
@@ -85,6 +113,8 @@ export const TestCaseBarChart: React.FC<{
85113 passRatePerTestCase : Record < string , number >
86114 exactMatch : boolean
87115 testCaseSelection : Record < string , boolean > | null
116+ namedTestsPassedCurrentSubmission : Record < string , boolean > | null
117+
88118 setTestCaseSelection : React . Dispatch <
89119 SetStateAction < Record < string , boolean > | null >
90120 >
@@ -93,6 +123,7 @@ export const TestCaseBarChart: React.FC<{
93123 passRatePerTestCase,
94124 exactMatch,
95125 testCaseSelection,
126+ namedTestsPassedCurrentSubmission,
96127 setTestCaseSelection,
97128 setExactMatch,
98129} ) => {
@@ -187,6 +218,7 @@ export const TestCaseBarChart: React.FC<{
187218 data = { sortedData }
188219 testCaseSelection = { testCaseSelection }
189220 handleOnBarClick = { handleOnBarClick }
221+ namedTestsPassedCurrentSubmission = { namedTestsPassedCurrentSubmission }
190222 />
191223 </ Box >
192224
0 commit comments