@@ -7,7 +7,7 @@ import { scoreChecker } from "../utils/comparator/scoreChecker";
7
7
import CommonError from "./CommonError" ;
8
8
import Collapsible from "./Collapsable" ;
9
9
import Loading from "./Loading" ;
10
-
10
+ import { ComparatorDiff } from "./ComparatorDiff" ;
11
11
import { ScoreElement } from "../types" ;
12
12
13
13
import "../styles/ProjectDetails.css" ;
@@ -22,7 +22,7 @@ function ProjectComparator() {
22
22
queryKey : [ "prevCommit" ] ,
23
23
queryFn : async ( ) => {
24
24
const response = await fetch (
25
- getScorecardUrl ( { platform, org, repo, commitHash : prevCommitHash } )
25
+ getScorecardUrl ( { platform, org, repo, commitHash : prevCommitHash } ) ,
26
26
) ;
27
27
if ( response . status >= 500 ) {
28
28
throw new Error ( "An error ocurred. Invalid response from server" ) ;
@@ -35,7 +35,7 @@ function ProjectComparator() {
35
35
queryKey : [ "currentCommit" ] ,
36
36
queryFn : async ( ) => {
37
37
const response = await fetch (
38
- getScorecardUrl ( { platform, org, repo, commitHash : currentCommitHash } )
38
+ getScorecardUrl ( { platform, org, repo, commitHash : currentCommitHash } ) ,
39
39
) ;
40
40
if ( response . status >= 500 ) {
41
41
throw new Error ( "An error ocurred. Invalid response from server" ) ;
@@ -85,7 +85,7 @@ function ProjectComparator() {
85
85
url : e1 . documentation . url ,
86
86
} ;
87
87
}
88
- }
88
+ } ,
89
89
) ;
90
90
setState ( consolidatedData ) ;
91
91
} ;
@@ -157,23 +157,27 @@ function ProjectComparator() {
157
157
See documentation
158
158
</ a >
159
159
</ p >
160
- < p >
161
- Reasoning: < span > { element ?. reason . toLocaleLowerCase ( ) } </ span >
162
- </ p >
163
- { Array . isArray ( element . details ) && (
164
- < Collapsible details = { element . details } />
165
- ) }
166
160
{ ( element . prevDetails || element . prevReason ) && (
167
- < >
168
- < h4 > Additional details / variations</ h4 >
169
- < p >
170
- Previous revision reasoning:{ " " }
171
- < span > { element . prevReason . toLocaleLowerCase ( ) } </ span >
172
- </ p >
173
- { element . prevDetails && (
174
- < Collapsible details = { element . prevDetails } />
175
- ) }
176
- </ >
161
+ < h4 > Additional details / variations</ h4 >
162
+ ) }
163
+ { element . prevReason && element . reason ? (
164
+ < p >
165
+ Reasoning:{ " " }
166
+ < ComparatorDiff
167
+ previous = { element . prevReason . toLocaleLowerCase ( ) }
168
+ current = { element . reason . toLocaleLowerCase ( ) }
169
+ />
170
+ </ p >
171
+ ) : (
172
+ < p >
173
+ Reasoning: < span > { element ?. reason . toLocaleLowerCase ( ) } </ span >
174
+ </ p >
175
+ ) }
176
+ { Array . isArray ( element . details ) && (
177
+ < Collapsible
178
+ details = { element . details }
179
+ prevDetails = { element . prevDetails }
180
+ />
177
181
) }
178
182
</ div >
179
183
< hr />
0 commit comments