@@ -25,25 +25,84 @@ const Result: React.FC<LayoutProps> = ({
25
25
< div >
26
26
< b > Status: </ b >
27
27
{ status }
28
- < br />
29
- < b > Message: </ b >
30
- { message }
31
- < br />
32
- < b > Error: </ b >
33
- { error }
34
- < br />
35
- < b > Stdout: </ b >
36
- < pre > { stdout } </ pre >
37
- < b > Stderr: </ b >
38
- < pre > { stderr } </ pre >
39
- < b > Execution duration (μs): </ b >
40
- < pre > { execDuration } </ pre >
41
- < b > Quality score: </ b >
42
- < pre > { qualityScore } </ pre >
43
- < b > Quality lint: </ b >
44
- < pre > { lintScore } </ pre >
28
+ < div className = "flex justify-between" >
29
+ < b > Execution duration (μs): </ b >
30
+ < div className = { execDuration == null || execDuration === 0 ? "animate-pulse h w-48 bg-gray-800 rounded-lg text-white text-cente" : "h w-48 bg-gray-800 rounded-lg text-white text-cente" } > { execDuration === 0 ? null : execDuration } </ div >
31
+ </ div >
32
+ < OutputsComponent text = { "Message" } value = { message } />
33
+ < OutputsComponent text = { "Error" } value = { error } />
34
+ < OutputsComponent text = { "Stdout" } value = { stdout } />
35
+ < OutputsComponent text = { "Stderr" } value = { stderr } />
36
+
37
+ < ScoresComponent qualityScore = { qualityScore } lintScore = { lintScore } />
38
+
45
39
</ div >
46
40
) ;
47
41
} ;
48
42
43
+ interface OutputsComponentProps {
44
+ text ?: string ;
45
+ value ?: string ;
46
+ }
47
+
48
+ const OutputsComponent : React . FC < OutputsComponentProps > = ( { text, value} ) => {
49
+ return (
50
+ < div >
51
+ < b > { text } :</ b >
52
+ < div className = { value == null ? "animate-pulse h-10 w-full bg-gray-800 rounded-lg text-white" : "h-10 w-full bg-gray-800 rounded-lg text-white" } > { value } </ div >
53
+ </ div >
54
+ ) ;
55
+ }
56
+
57
+ interface ScoresComponentProps {
58
+ qualityScore : number | undefined ,
59
+ lintScore : number | undefined ,
60
+ }
61
+
62
+ const ScoresComponent : React . FC < ScoresComponentProps > = ( { qualityScore, lintScore} ) => {
63
+
64
+ return (
65
+ < div className = "relative flex flex-col min-w-0 mb-4 lg:mb-0 break-words bg-gray-50 dark:bg-gray-800 w-full shadow-lg rounded" >
66
+ < div className = "rounded-t mb-0 px-0 border-0" >
67
+ < div className = "flex flex-wrap items-center px-4 py-2" >
68
+ < div className = "relative w-full max-w-full flex-grow flex-1" >
69
+ < h2 className = "font-semibold text-base text-gray-900 dark:text-gray-50" > Results</ h2 >
70
+ </ div >
71
+ </ div >
72
+ < div className = "block w-full overflow-x-auto" >
73
+ < table className = "items-center w-full bg-transparent border-collapse" >
74
+ < tbody >
75
+ < tr className = "text-gray-700 dark:text-gray-100" >
76
+ < th className = "border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left" > Quality score</ th >
77
+ < td className = "border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4" >
78
+ < div className = "flex items-center" >
79
+ < span className = "mr-2" > { qualityScore } </ span >
80
+ < div className = "relative w-full" >
81
+ < div className = "overflow-hidden h-2 text-xs flex rounded bg-blue-200" >
82
+ < div style = { { width : `${ qualityScore } %` } } className = 'shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-600' />
83
+ </ div >
84
+ </ div >
85
+ </ div >
86
+ </ td >
87
+ </ tr >
88
+ < tr className = "text-gray-700 dark:text-gray-100" >
89
+ < th className = "border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left" > Lint score</ th >
90
+ < td className = "border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4" >
91
+ < div className = "flex items-center" >
92
+ < span className = "mr-2" > { lintScore } </ span >
93
+ < div className = "relative w-full" >
94
+ < div className = "overflow-hidden h-2 text-xs flex rounded bg-blue-200" >
95
+ < div style = { { width : `${ lintScore } %` } } className = 'shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500' />
96
+ </ div >
97
+ </ div >
98
+ </ div >
99
+ </ td >
100
+ </ tr >
101
+ </ tbody >
102
+ </ table >
103
+ </ div >
104
+ </ div >
105
+ </ div > ) ;
106
+ }
107
+
49
108
export default Result ;
0 commit comments