Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ec25a46
reorder steppers
william-schlegel Apr 29, 2026
ec031cc
reorder steps and mock config
william-schlegel Apr 29, 2026
c203ba2
list selection with checkboxes
william-schlegel Apr 29, 2026
ff841db
improve ui
william-schlegel Apr 30, 2026
2daedea
improve display of the confg keys
william-schlegel Apr 30, 2026
64207c6
prepare a normalze function to handle filters or sections (format not…
william-schlegel Apr 30, 2026
0f9e6c8
fix recap capsule and auto selection when an option is selected and d…
william-schlegel May 4, 2026
ec29283
refactor DatasetSelection component to simplify section handling and …
william-schlegel May 4, 2026
bc560d1
field mapping suggestions
william-schlegel May 4, 2026
5ed708d
remove console log
william-schlegel May 4, 2026
e6acae1
Add OpenAPI spec for new APIs around screening filters.
apognu May 5, 2026
8c8ca42
adapt to the new api return format
william-schlegel May 6, 2026
2707a1f
Enhance DatasetSelection component with conditional topics and improv…
william-schlegel May 6, 2026
52afad5
adapt tag group to a single line depending of the viewport width
william-schlegel May 6, 2026
78eca6a
refactor list configuration and untie it from screening configuration…
william-schlegel May 6, 2026
d7ca2c6
fix minor display bugs
william-schlegel May 6, 2026
07b2bf7
change colors of tags as in figma
william-schlegel May 6, 2026
8fd5ea1
selection in manual search
william-schlegel May 7, 2026
af624d0
update openapi
william-schlegel May 7, 2026
b52b535
list selection on scenario rules
william-schlegel May 7, 2026
10c354b
Enhance DatasetSelectionContent component with expanded section and i…
william-schlegel May 7, 2026
28faa9e
remove unnecessary expansion of collapsible management
william-schlegel May 11, 2026
f8ba2ed
Merge branch 'main' into MAR-1835
william-schlegel May 11, 2026
233a4e1
fix the unexpected collapse at first option selection
william-schlegel May 11, 2026
8475157
remove test data
william-schlegel May 11, 2026
bad2c25
checkbox click
william-schlegel May 11, 2026
1191e68
fix relevant coderabbit review
william-schlegel May 11, 2026
b8f6f0b
fix more coderabbit review
william-schlegel May 11, 2026
a8b676a
last coderabbit review (hopefully)
william-schlegel May 11, 2026
9b88097
Add new filter in configuration
william-schlegel May 12, 2026
5563e2c
fix filters initialisations
william-schlegel May 13, 2026
6c38453
Merge branch 'main' into MAR-1835
william-schlegel May 13, 2026
4a2b598
update open api schema for CreateContinuousScreeningConfigDto
william-schlegel May 15, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
PartialCreateContinuousScreeningConfig,
} from './context/CreationStepper';
import { FormPagination } from './context/FormPagination';
import { ListAndTopicDatasetConfigurationBridge } from './context/ListAndTopicDatasetConfigurationBridge';
import { Stepper } from './form/Stepper';
import { DatasetSelection } from './form/steps/DatasetSelection';
import { GeneralInfo } from './form/steps/GeneralInfo';
Expand Down Expand Up @@ -53,16 +54,18 @@ export const ConfigurationPanel = ({
return (
<PanelContainer size="max" className="p-0 bg-surface-page overflow-y-auto flex flex-col">
<ContinuousScreeningConfigurationStepper.Provider value={configurationStepper}>
<ConfigurationPanelHeader />
<div className="p-v2-lg grow">
{match(configurationStepper.value.__internals.currentStep)
.with(0, () => <GeneralInfo stableId={baseConfig.stableId} />)
.with(1, () => <ObjectMapping baseConfig={baseConfig} />)
.with(2, () => <ScoringConfiguration />)
.with(3, () => <DatasetSelection />)
.otherwise(() => null)}
</div>
<FormPagination finalButtonText={t('continuousScreening:edition.validate_button')} />
<ListAndTopicDatasetConfigurationBridge>
<ConfigurationPanelHeader />
<div className="p-v2-lg grow">
{match(configurationStepper.value.__internals.currentStep)
.with(0, () => <GeneralInfo stableId={baseConfig.stableId} />)
.with(1, () => <ObjectMapping baseConfig={baseConfig} />)
.with(2, () => <DatasetSelection useCase="continuous_monitoring" />)
.with(3, () => <ScoringConfiguration />)
.otherwise(() => null)}
</div>
<FormPagination finalButtonText={t('continuousScreening:edition.validate_button')} />
</ListAndTopicDatasetConfigurationBridge>
</ContinuousScreeningConfigurationStepper.Provider>
</PanelContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ import QueryString from 'qs';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { match } from 'ts-pattern';
import { Button } from 'ui-design-system';
import { Button, Tag } from 'ui-design-system';
import { Icon } from 'ui-icons';
import { CopyToClipboardButton } from '../CopyToClipboardButton';
import GridTable from '../GridTable';
import { Page } from '../Page';
import { PanelRoot } from '../Panel/Panel';
import { Spinner } from '../Spinner';
import { ConfigurationPanel } from './ConfigurationPanel';
import { CopyToClipboardChip } from './CopyToClipboardChip';
import { CreationModal } from './CreationModal';
import { PartialCreateContinuousScreeningConfig } from './context/CreationStepper';
import { EditionValidationPanel } from './EditionValidationPanel';
import { Capsule } from './shared/Capsule';

const CellCapsule = ({ children }: { children: React.ReactNode }) => {
return <Capsule className="max-w-50 truncate">{children}</Capsule>;
return (
<Tag color="grey" className="max-w-50 truncate">
{children}
</Tag>
);
};

export const ConfigurationsPage = ({ canEdit }: { canEdit: boolean }) => {
Expand Down Expand Up @@ -125,7 +128,9 @@ export const ConfigurationsPage = ({ canEdit }: { canEdit: boolean }) => {
>
<GridTable.Cell className="flex gap-v2-md items-center justify-between">
<span className="truncate">{item.name}</span>
<CopyToClipboardChip value={item.stableId} className="min-w-40" />
<CopyToClipboardButton toCopy={item.stableId} className="min-w-40" size="chip" rounded>
<span className="text-xs">{item.stableId}</span>
</CopyToClipboardButton>
</GridTable.Cell>
<GridTable.Cell>
{item.datasets[0] ? <CellCapsule>{item.datasets[0]}</CellCapsule> : null}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useGetCopyToClipboard } from '@app-builder/utils/use-get-copy-to-clipboard';
import { cn } from 'ui-design-system';
import { Icon } from 'ui-icons';

/**
* @deprecated use CopyToClipboardButton instead (with size = chip and rounded = true)
*/
export const CopyToClipboardChip = ({
value,
className,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
import { BreadCrumbs } from '../Breadcrumbs';
import { Page } from '../Page';
import { ContinuousScreeningConfigurationStepper } from './context/CreationStepper';
import { ListAndTopicDatasetConfigurationBridge } from './context/ListAndTopicDatasetConfigurationBridge';
import { CreationContent } from './form/Content';
import { Stepper } from './form/Stepper';

Expand Down Expand Up @@ -42,17 +43,19 @@ export const CreationPage = ({ name, description }: { name: string; description:

return (
<ContinuousScreeningConfigurationStepper.Provider value={creationStepper}>
<Page.Main>
<Page.Header className="justify-between">
<BreadCrumbs />
<Stepper fromZero getStepLabel={(stepName) => t(`continuousScreening:creation.stepper.${stepName}`)} />
</Page.Header>
<Page.Container>
<Page.ContentV2 paddingLess>
<CreationContent />
</Page.ContentV2>
</Page.Container>
</Page.Main>
<ListAndTopicDatasetConfigurationBridge>
<Page.Main>
<Page.Header className="justify-between">
<BreadCrumbs />
<Stepper fromZero getStepLabel={(stepName) => t(`continuousScreening:creation.stepper.${stepName}`)} />
</Page.Header>
<Page.Container>
<Page.ContentV2 paddingLess>
<CreationContent />
</Page.ContentV2>
</Page.Container>
</Page.Main>
</ListAndTopicDatasetConfigurationBridge>
</ContinuousScreeningConfigurationStepper.Provider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export const ContinuousScreeningConfigurationStepper = buildStepper({
steps: [
{ name: 'generalInfo', schema: generalInfoStepSchema },
{ name: 'objectMapping', schema: objectMappingStepSchema },
{ name: 'scoringConfiguration', schema: scoringConfigurationStepSchema },
{ name: 'datasetSelection', schema: datasetSelectionStepSchema },
{ name: 'scoringConfiguration', schema: scoringConfigurationStepSchema },
] as const,
validator: createContinuousScreeningConfigSchema,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ListAndTopicDatasetConfiguration } from '@app-builder/components/ListAndTopicConfiguration';
import { type ReactNode, useEffect } from 'react';
import { ContinuousScreeningConfigurationStepper } from './CreationStepper';

/*
this component is used to bridge the ListAndTopicDatasetConfiguration context with the ContinuousScreeningConfigurationStepper context
to ensure that the datasets map is updated when the wizard mode changes
*/
export function ListAndTopicDatasetConfigurationBridge({ children }: { children: ReactNode }) {
const wizard = ContinuousScreeningConfigurationStepper.useSharp();
const wizardMode = ContinuousScreeningConfigurationStepper.select((s) => s.__internals.mode);
const datasetsMap = wizard.value.data.datasets;
const listSharp = ListAndTopicDatasetConfiguration.createSharp({
datasets: datasetsMap,
mode: wizardMode,
});

useEffect(() => {
listSharp.actions.setMode(wizardMode);
}, [listSharp, wizardMode]);
Comment thread
william-schlegel marked this conversation as resolved.

return (
<ListAndTopicDatasetConfiguration.Provider value={listSharp}>{children}</ListAndTopicDatasetConfiguration.Provider>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const CreationContent = () => {
<div className="grow p-v2-lg pb-0 flex flex-col gap-v2-md">
{match(creationStepper.computed.currentStep.value)
.with(1, () => <ObjectMapping />)
.with(2, () => <ScoringConfiguration />)
.with(3, () => <DatasetSelection />)
.with(2, () => <DatasetSelection useCase="continuous_monitoring" />)
.with(3, () => <ScoringConfiguration />)
.otherwise(() => null)}
<CreationContentRecap />
</div>
Expand All @@ -42,8 +42,8 @@ const CreationContentRecap = () => {
})}
>
{currentStep >= 1 ? <ObjectMappingRecap /> : null}
{currentStep >= 2 ? <ScoringConfigurationRecap /> : null}
{currentStep >= 3 ? <DatasetSelectionRecap /> : null}
{currentStep >= 2 ? <DatasetSelectionRecap /> : null}
{currentStep >= 3 ? <ScoringConfigurationRecap /> : null}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,59 +1,38 @@
import { useScreeningDatasetsQuery } from '@app-builder/queries/screening/datasets';
import { OpenSanctionsCatalogSection } from 'marble-api';
import { getSectionLeafNames } from '@app-builder/components/ListAndTopicConfiguration';
import { SCREENING_CATEGORY_I18N_KEY_MAP, type ScreeningCategory } from '@app-builder/models/screening';
import { type ListConfigFilters, useListConfigQuery } from '@app-builder/queries/screening/lists-config';
import { useTranslation } from 'react-i18next';
import { match } from 'ts-pattern';
import { ContinuousScreeningConfigurationStepper } from '../../context/CreationStepper';
import { RecapCapsule, RecapRow } from '../../shared/RecapRow';

const calculateSelectedCountByTags = (sections: OpenSanctionsCatalogSection[], selectedDatasets: string[]) => {
const flatDatasets = sections.flatMap((section) => section.datasets);
const selectedCountByTags: Record<string, number> = {};

selectedDatasets.forEach((datasetName) => {
const dataset = flatDatasets.find((d) => d.name === datasetName);
if (dataset) {
const datasetTag = dataset.tag ? dataset.tag : 'unknown';
selectedCountByTags[datasetTag] = (selectedCountByTags[datasetTag] ?? 0) + 1;
}
});

return selectedCountByTags;
};
type SectionData = NonNullable<ListConfigFilters[keyof ListConfigFilters]>;

export const DatasetSelectionRecap = () => {
const { t } = useTranslation(['continuousScreening', 'scenarios']);
const datasetsQuery = useScreeningDatasetsQuery();
const selectedDatasets = ContinuousScreeningConfigurationStepper.select((state) =>
Object.keys(state.data.datasets).filter((k) => !!state.data.datasets[k]),
);
const listConfigQuery = useListConfigQuery('continuous_monitoring');
const datasets = ContinuousScreeningConfigurationStepper.select((state) => state.data.datasets);

const enabledSections = Object.entries(listConfigQuery.data ?? {}).filter(
([key, section]) => !!datasets[key] && section != null,
) as [ScreeningCategory, SectionData][];

return (
<RecapRow>
<span>{t('continuousScreening:creation.datasetSelection.recap.title', { count: selectedDatasets.length })}</span>
{match(datasetsQuery)
.with({ isPending: true }, () => <div>Loading...</div>)
.with({ isError: true }, () => <div>Error</div>)
.with({ isSuccess: true }, ({ data }) => {
const selectedCountByTags = calculateSelectedCountByTags(data.datasets.sections, selectedDatasets);
const entries = Object.entries(selectedCountByTags);

return (
<div className="flex flex-row items-center gap-v2-xs">
{entries.map(([tag, count]) => (
<RecapCapsule key={tag}>
{count}{' '}
{match(tag)
.with('peps', () => t(`scenarios:sanction.lists.peps`))
.with('third-parties', () => t(`scenarios:sanction.lists.third_parties`))
.with('sanctions', () => t(`scenarios:sanction.lists.sanctions`))
.with('adverse-media', () => t(`scenarios:sanction.lists.adverse_media`))
.otherwise(() => t(`scenarios:sanction.lists.other`))}
</RecapCapsule>
))}
</div>
);
})
.exhaustive()}
<span>{t('continuousScreening:creation.datasetSelection.recap.title', { count: enabledSections.length })}</span>
{enabledSections.map(([key, section]) => {
const leafCount = getSectionLeafNames(section).filter((n) => !!datasets[n]).length;
const sectionLabel = t(`scenarios:sanction.lists.${SCREENING_CATEGORY_I18N_KEY_MAP[key]}`);
return (
<RecapCapsule key={key}>
<span className="flex flex-row items-center gap-v2-xs">
<span>{sectionLabel}</span>
<span>
{t('continuousScreening:creation.datasetSelection.recap.section_items', { count: leafCount })}
</span>
</span>
</RecapCapsule>
);
})}
</RecapRow>
);
};
Loading