File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { Callout } from '@app-builder/components/Callout' ;
2
2
import {
3
3
isSanctionCheckError ,
4
+ isSanctionCheckReviewCompleted ,
4
5
type SanctionCheck ,
5
6
} from '@app-builder/models/sanction-check' ;
6
7
import { useState } from 'react' ;
@@ -31,6 +32,7 @@ export function SanctionReviewSection({
31
32
( m ) => m . status === 'pending' ,
32
33
) . length ;
33
34
const hasError = isSanctionCheckError ( sanctionCheck ) ;
35
+ const isRefinable = ! isSanctionCheckReviewCompleted ( sanctionCheck ) ;
34
36
35
37
return (
36
38
< div className = "flex h-fit flex-[2] flex-col gap-6" >
@@ -43,14 +45,16 @@ export function SanctionReviewSection({
43
45
totalMatches : sanctionCheck . matches . length ,
44
46
} ) }
45
47
</ span >
46
- < Button
47
- className = "ml-auto"
48
- variant = "secondary"
49
- onClick = { ( ) => setIsRefining ( true ) }
50
- >
51
- < Icon icon = "restart-alt" className = "size-5" />
52
- { t ( 'sanctions:refine_search' ) }
53
- </ Button >
48
+ { isRefinable ? (
49
+ < Button
50
+ className = "ml-auto"
51
+ variant = "secondary"
52
+ onClick = { ( ) => setIsRefining ( true ) }
53
+ >
54
+ < Icon icon = "restart-alt" className = "size-5" />
55
+ { t ( 'sanctions:refine_search' ) }
56
+ </ Button >
57
+ ) : null }
54
58
</ div >
55
59
{ match ( sanctionCheck )
56
60
. when ( isSanctionCheckError , ( sc ) => (
Original file line number Diff line number Diff line change @@ -189,3 +189,10 @@ export function isSanctionCheckError(
189
189
) : sanctionCheck is SanctionCheckError {
190
190
return sanctionCheck . status === 'error' ;
191
191
}
192
+
193
+ export function isSanctionCheckReviewCompleted ( sanctionCheck : SanctionCheck ) {
194
+ return (
195
+ sanctionCheck . status === 'no_hit' ||
196
+ sanctionCheck . status === 'confirmed_hit'
197
+ ) ;
198
+ }
You can’t perform that action at this time.
0 commit comments