Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/app-builder/src/components/Cases/RequiredActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ export const RequiredActions = ({
const hasPendingScreening = decision.screenings.some((s) => s.status === 'in_review');
const isPendingDecision =
decision.reviewStatus === 'pending' && decision.outcome === 'block_and_review';
const isThereSanctionChecks = decision.screenings.length > 0;
const areThereScreenings = decision.screenings.length > 0;

return isPendingDecision || isThereSanctionChecks ? (
return isPendingDecision || areThereScreenings ? (
<div className="bg-grey-98 group-hover:bg-grey-95 flex flex-col gap-2.5 rounded-sm p-4 transition-colors">
<span className="text-grey-50 text-xs">{t('sanctions:required_actions.title')}</span>
{isThereSanctionChecks ? (
<span className="text-grey-50 text-xs">{t('screenings:required_actions.title')}</span>
{areThereScreenings ? (
<div className="flex flex-col gap-1.5">
<div className="flex items-center gap-2">
<Checkbox disabled={true} size="small" checked={!hasPendingScreening} />
<span className="text-xs font-medium">
{t('sanctions:required_actions.review_pending_screening_count')}
{t('screenings:required_actions.review_pending_screening_count')}
</span>
</div>
<div className="flex flex-col">
Expand All @@ -62,10 +62,10 @@ export const RequiredActions = ({
})}
>
{s.status === 'in_review'
? t('sanctions:required_actions.review')
? t('screenings:required_actions.review')
: s.status === 'error'
? t('sanctions:required_actions.view_error')
: t('sanctions:required_actions.view')}
? t('screenings:required_actions.view_error')
: t('screenings:required_actions.view')}
</Link>
{s.status !== 'error' && s.status !== 'in_review' ? (
<span
Expand All @@ -74,7 +74,7 @@ export const RequiredActions = ({
'text-grey-50 bg-grey-90': s.status === 'no_hit',
})}
>
{t(`sanctions:status.${s.status}`)}
{t(`screenings:status.${s.status}`)}
</span>
) : null}
</span>
Expand All @@ -96,7 +96,7 @@ export const RequiredActions = ({
<ReviewDecisionModal
decisionId={decision.id}
store={reviewDecisionModalStore}
sanctionCheck={decision.screenings[0]}
screening={decision.screenings[0]}
/>
</div>
) : null}
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder/src/components/Cases/cases-i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { type Namespace } from 'i18next';

import { decisionsI18n } from '../Decisions/decisions-i18n';
import { filtersI18n } from '../Filters/filters-i18n';
import { sanctionsI18n } from '../Sanctions/sanctions-i18n';
import { screeningsI18n } from '../Screenings/screenings-i18n';

export const casesI18n = [
'cases',
...filtersI18n,
...decisionsI18n,
...sanctionsI18n,
...screeningsI18n,
] satisfies Namespace;
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import { decisionsI18n } from '@app-builder/components';
import { isSanctionCheckError, type SanctionCheck } from '@app-builder/models/sanction-check';
import { isScreeningError, type Screening } from '@app-builder/models/screening';
import { useTranslation } from 'react-i18next';
import * as R from 'remeda';
import { Collapsible } from 'ui-design-system';
import { Icon } from 'ui-icons';

import { MatchCard } from '../Sanctions/MatchCard';
import { SanctionCheckErrors } from '../Sanctions/SanctionCheckErrors';
import { SanctionStatusTag } from '../Sanctions/SanctionStatusTag';
import { MatchCard } from '../Screenings/MatchCard';
import { ScreeningErrors } from '../Screenings/ScreeningErrors';
import { ScreeningStatusTag } from '../Screenings/ScreeningStatusTag';

export function SanctionCheckDetail({ sanctionCheck }: { sanctionCheck: SanctionCheck }) {
const hasError = isSanctionCheckError(sanctionCheck);
export function ScreeningDetail({ screening }: { screening: Screening }) {
const hasError = isScreeningError(screening);

return (
<Collapsible.Container className="bg-grey-100">
<Collapsible.Title>
<div className="flex grow items-center justify-between">
<span>{sanctionCheck.config.name}</span>
<SanctionStatusTag status={sanctionCheck.status} border="square" className="h-8" />
<span>{screening.config.name}</span>
<ScreeningStatusTag status={screening.status} border="square" className="h-8" />
</div>
</Collapsible.Title>
<Collapsible.Content>
<div className="flex flex-col gap-4">
{hasError ? <SanctionCheckErrors sanctionCheck={sanctionCheck} /> : null}
{sanctionCheck.request ? <SearchInput request={sanctionCheck.request} /> : null}
{hasError ? <ScreeningErrors screening={screening} /> : null}
{screening.request ? <SearchInput request={screening.request} /> : null}
<div className="flex flex-col gap-2">
{sanctionCheck.matches.map((match) => (
{screening.matches.map((match) => (
<MatchCard
readonly
key={match.id}
unreviewable={hasError || sanctionCheck.partial}
unreviewable={hasError || screening.partial}
match={match}
/>
))}
Expand All @@ -40,7 +40,7 @@ export function SanctionCheckDetail({ sanctionCheck }: { sanctionCheck: Sanction
);
}

const SearchInput = ({ request }: { request: NonNullable<SanctionCheck['request']> }) => {
const SearchInput = ({ request }: { request: NonNullable<Screening['request']> }) => {
const { t } = useTranslation(decisionsI18n);
const searchInputList = R.pipe(
R.values(request.queries),
Expand All @@ -50,7 +50,7 @@ const SearchInput = ({ request }: { request: NonNullable<SanctionCheck['request'

return (
<div className="flex items-center gap-2">
<span>{t('sanctions:search_input')}</span>
<span>{t('screenings:search_input')}</span>
{searchInputList.map((input, i) => (
<div key={i} className="border-grey-90 flex items-center gap-2 rounded-sm border p-2">
<span className="bg-grey-95 size-6 rounded-xs p-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export const decisionsI18n = [
'common',
'scenarios',
'cases',
'sanctions',
'screenings',
...filtersI18n,
] satisfies Namespace;

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import { Icon } from 'ui-icons';
export function DeleteScreeningRule({
scenarioId,
iterationId,
sanctionId,
screeningId,
children,
}: {
scenarioId: string;
iterationId: string;
sanctionId: string;
screeningId: string;
children: React.ReactElement;
}) {
const { t } = useTranslation(['common', 'scenarios']);
const deleteScreeningRuleMutation = useDeleteScreeningRuleMutation(scenarioId, iterationId);
const revalidate = useLoaderRevalidator();

const handleDeleteScreeningRule = () => {
deleteScreeningRuleMutation.mutateAsync(sanctionId).then(() => {
deleteScreeningRuleMutation.mutateAsync(screeningId).then(() => {
revalidate();
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const FieldAstFormula = ({
onBlur,
defaultValue,
}: {
type: 'rule' | 'sanction';
type: 'rule' | 'screening';
astNode?: AstNode;
onChange?: (node?: AstNode) => void;
onBlur?: () => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Callout } from '@app-builder/components/Callout';
import { DatasetTag } from '@app-builder/components/Sanctions/DatasetTag';
import { type ScreeningCategory } from '@app-builder/models/sanction-check';
import { DatasetTag } from '@app-builder/components/Screenings/DatasetTag';
import { type ScreeningCategory } from '@app-builder/models/screening';
import { useEditorMode } from '@app-builder/services/editor/editor-mode';
import clsx from 'clsx';
import Fuse from 'fuse.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatasetTag } from '@app-builder/components/Sanctions/DatasetTag';
import { type ScreeningCategory } from '@app-builder/models/sanction-check';
import { DatasetTag } from '@app-builder/components/Screenings/DatasetTag';
import { type ScreeningCategory } from '@app-builder/models/screening';
import { type OpenSanctionsCatalogSection } from 'marble-api';
import { toggle } from 'radash';
import { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type SEARCH_ENTITIES } from '@app-builder/constants/sanction-check-entity';
import { type SEARCH_ENTITIES } from '@app-builder/constants/screening-entity';
import { useEditorMode } from '@app-builder/services/editor/editor-mode';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OutcomeBadge } from '@app-builder/components/Decisions';
import { type SanctionOutcome } from '@app-builder/models/outcome';
import { type ScreeningOutcome } from '@app-builder/models/outcome';
import { matchSorter } from 'match-sorter';
import { useDeferredValue, useMemo, useState } from 'react';
import { Input, SelectWithCombobox } from 'ui-design-system';
Expand All @@ -12,11 +12,11 @@ export const FieldOutcomes = ({
onChange,
onBlur,
}: {
selectedOutcome?: SanctionOutcome;
outcomes: SanctionOutcome[];
selectedOutcome?: ScreeningOutcome;
outcomes: ScreeningOutcome[];
disabled?: boolean;
name?: string;
onChange?: (value: SanctionOutcome) => void;
onChange?: (value: ScreeningOutcome) => void;
onBlur?: () => void;
}) => {
const [searchValue, setSearchValue] = useState('');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
SCREENING_CATEGORY_COLORS,
type ScreeningCategory,
} from '@app-builder/models/sanction-check';
import { SCREENING_CATEGORY_COLORS, type ScreeningCategory } from '@app-builder/models/screening';
import { useTranslation } from 'react-i18next';
import { match } from 'ts-pattern';
import { cn } from 'ui-design-system';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ScreeningCategory } from '@app-builder/models/sanction-check';
import { type ScreeningCategory } from '@app-builder/models/screening';
import { toggle } from 'radash';
import { type Dispatch, type SetStateAction, useMemo } from 'react';
import { Button, Checkbox, MenuCommand } from 'ui-design-system';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sanctionsI18n } from '@app-builder/components/Sanctions/sanctions-i18n';
import { screeningsI18n } from '@app-builder/components/Screenings/screenings-i18n';
import { useLoaderRevalidator } from '@app-builder/contexts/LoaderRevalidatorContext';
import { useEnrichMatchMutation } from '@app-builder/queries/screening/enrich-match';
import { useCallbackRef } from '@app-builder/utils/hooks';
Expand All @@ -7,7 +7,7 @@ import { Button } from 'ui-design-system';
import { Icon } from 'ui-icons';

export function EnrichMatchButton({ matchId }: { matchId: string }) {
const { t } = useTranslation(sanctionsI18n);
const { t } = useTranslation(screeningsI18n);
const enrichMatchMutation = useEnrichMatchMutation();
const revalidate = useLoaderRevalidator();

Expand All @@ -20,7 +20,7 @@ export function EnrichMatchButton({ matchId }: { matchId: string }) {
return (
<Button type="button" variant="secondary" className="h-8" onClick={handleButtonClick}>
<Icon icon="download" className="size-5" />
{t('sanctions:enrich_button')}
{t('screenings:enrich_button')}
</Button>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import {
createPropertyTransformer,
getSanctionEntityProperties,
type PropertyForSchema,
type SanctionCheckEntityProperty,
} from '@app-builder/constants/sanction-check-entity';
import { type OpenSanctionEntity } from '@app-builder/models/sanction-check';
type ScreeningEntityProperty,
} from '@app-builder/constants/screening-entity';
import { type OpenSanctionEntity } from '@app-builder/models/screening';
import { useFormatLanguage } from '@app-builder/utils/format';
import { Fragment, type ReactNode, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';

import { sanctionsI18n } from './sanctions-i18n';
import { screeningsI18n } from './screenings-i18n';

export function EntityProperties<T extends OpenSanctionEntity>({
entity,
Expand All @@ -24,12 +24,12 @@ export function EntityProperties<T extends OpenSanctionEntity>({
before?: ReactNode;
after?: ReactNode;
}) {
const [displayAll, setDisplayAll] = useState<
Partial<Record<SanctionCheckEntityProperty, boolean>>
>({});
const [displayAll, setDisplayAll] = useState<Partial<Record<ScreeningEntityProperty, boolean>>>(
{},
);

const displayProperties = forcedProperties ?? getSanctionEntityProperties(entity.schema);
const { t, i18n } = useTranslation(sanctionsI18n);
const { t, i18n } = useTranslation(screeningsI18n);
const language = useFormatLanguage();
const entityPropertyList = displayProperties
.map((property) => {
Expand Down Expand Up @@ -63,7 +63,7 @@ export function EntityProperties<T extends OpenSanctionEntity>({
return (
<Fragment key={property}>
<span className="font-bold">
{t(`sanctions:entity.property.${property}`, {
{t(`screenings:entity.property.${property}`, {
defaultValue: property,
})}
</span>
Expand Down
Loading
Loading