-
Notifications
You must be signed in to change notification settings - Fork 21
Mar 1888 #1535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
william-schlegel
wants to merge
44
commits into
main
Choose a base branch
from
MAR-1888
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mar 1888 #1535
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
ec25a46
reorder steppers
william-schlegel ec031cc
reorder steps and mock config
william-schlegel c203ba2
list selection with checkboxes
william-schlegel ff841db
improve ui
william-schlegel 2daedea
improve display of the confg keys
william-schlegel 64207c6
prepare a normalze function to handle filters or sections (format not…
william-schlegel 0f9e6c8
fix recap capsule and auto selection when an option is selected and d…
william-schlegel ec29283
refactor DatasetSelection component to simplify section handling and …
william-schlegel bc560d1
field mapping suggestions
william-schlegel 5ed708d
remove console log
william-schlegel e6acae1
Add OpenAPI spec for new APIs around screening filters.
apognu 8c8ca42
adapt to the new api return format
william-schlegel 2707a1f
Enhance DatasetSelection component with conditional topics and improv…
william-schlegel 52afad5
adapt tag group to a single line depending of the viewport width
william-schlegel 78eca6a
refactor list configuration and untie it from screening configuration…
william-schlegel d7ca2c6
fix minor display bugs
william-schlegel 07b2bf7
change colors of tags as in figma
william-schlegel 8fd5ea1
selection in manual search
william-schlegel af624d0
update openapi
william-schlegel b52b535
list selection on scenario rules
william-schlegel 10c354b
Enhance DatasetSelectionContent component with expanded section and i…
william-schlegel 28faa9e
remove unnecessary expansion of collapsible management
william-schlegel f8ba2ed
Merge branch 'main' into MAR-1835
william-schlegel 233a4e1
fix the unexpected collapse at first option selection
william-schlegel 8475157
remove test data
william-schlegel bad2c25
checkbox click
william-schlegel 1191e68
fix relevant coderabbit review
william-schlegel b8f6f0b
fix more coderabbit review
william-schlegel a8b676a
last coderabbit review (hopefully)
william-schlegel 9b88097
Add new filter in configuration
william-schlegel 5563e2c
fix filters initialisations
william-schlegel 6c38453
Merge branch 'main' into MAR-1835
william-schlegel 4a2b598
update open api schema for CreateContinuousScreeningConfigDto
william-schlegel 8831f78
name and enities
william-schlegel 95ed04c
entity filter form, threshold component
william-schlegel 180a90f
Added support for disabled states in popovers, integrated tag compone…
william-schlegel e2ce55d
popover variant for the dataset selection
william-schlegel bbbe5b8
search input in datasets
william-schlegel bbc0a5c
actions in submenu
william-schlegel 1335fdf
section switch
william-schlegel 9c4af15
title format + label click with checkboxes
william-schlegel fc929b7
menu alignment
william-schlegel 4c55732
update threshold values
william-schlegel d553460
remove testing data
william-schlegel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/app-builder/src/components/ContinuousScreening/CopyToClipboardChip.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...der/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]); | ||
|
|
||
| return ( | ||
| <ListAndTopicDatasetConfiguration.Provider value={listSharp}>{children}</ListAndTopicDatasetConfiguration.Provider> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 25 additions & 46 deletions
71
...ages/app-builder/src/components/ContinuousScreening/form/recaps/DatasetSelectionRecap.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| ); | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect runs on every render due to listSharp dependency.
Since
listSharpis created on every render (line 13), and it's included in theuseEffectdependency array, the effect will execute on every render rather than only whenwizardModechanges.If the intent is to synchronize mode only when
wizardModechanges, consider whetherlistSharpcan be safely omitted from the dependencies. Alternatively, verify this pattern is correct forsharpstateusage.🤖 Prompt for AI Agents