From b10426a1dfab7f7a68b5bbc84f0794a81a321e05 Mon Sep 17 00:00:00 2001 From: Debove Christopher Date: Wed, 19 Feb 2025 16:44:14 +0100 Subject: [PATCH] fix: show refine button only when review not completed (#707) --- .../components/Sanctions/SanctionReview.tsx | 20 +++++++++++-------- .../app-builder/src/models/sanction-check.ts | 7 +++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/app-builder/src/components/Sanctions/SanctionReview.tsx b/packages/app-builder/src/components/Sanctions/SanctionReview.tsx index 38fc3661c..2bca606b0 100644 --- a/packages/app-builder/src/components/Sanctions/SanctionReview.tsx +++ b/packages/app-builder/src/components/Sanctions/SanctionReview.tsx @@ -1,6 +1,7 @@ import { Callout } from '@app-builder/components/Callout'; import { isSanctionCheckError, + isSanctionCheckReviewCompleted, type SanctionCheck, } from '@app-builder/models/sanction-check'; import { useState } from 'react'; @@ -31,6 +32,7 @@ export function SanctionReviewSection({ (m) => m.status === 'pending', ).length; const hasError = isSanctionCheckError(sanctionCheck); + const isRefinable = !isSanctionCheckReviewCompleted(sanctionCheck); return (
@@ -43,14 +45,16 @@ export function SanctionReviewSection({ totalMatches: sanctionCheck.matches.length, })} - + {isRefinable ? ( + + ) : null}
{match(sanctionCheck) .when(isSanctionCheckError, (sc) => ( diff --git a/packages/app-builder/src/models/sanction-check.ts b/packages/app-builder/src/models/sanction-check.ts index f1c92f956..b5529bfe0 100644 --- a/packages/app-builder/src/models/sanction-check.ts +++ b/packages/app-builder/src/models/sanction-check.ts @@ -189,3 +189,10 @@ export function isSanctionCheckError( ): sanctionCheck is SanctionCheckError { return sanctionCheck.status === 'error'; } + +export function isSanctionCheckReviewCompleted(sanctionCheck: SanctionCheck) { + return ( + sanctionCheck.status === 'no_hit' || + sanctionCheck.status === 'confirmed_hit' + ); +}