feat: create purpose first step API thresholds (PIN-9125)#1663
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements API threshold information and alerts for the purpose creation flow. It adds visual feedback to help users understand e-service provider thresholds and whether their estimated API calls require approval. The changes include updated localization, a new custom hook for threshold validation, comprehensive tests, and UI components to display threshold information.
Changes:
- Updated navigation breadcrumb label from "Finalità inoltrate"/"Submitted Purposes" to "Le tue finalità"/"Your Purposes"
- Added new localization keys for API call estimation section including threshold information and alert messages
- Created
useGetConsumerPurporseEditPageInfoAlertPropshook to determine which alert to show based on daily call thresholds - Enhanced the purpose edit form with threshold display, alerts, and required field indicators
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/static/locales/it/shared-components.json | Updated breadcrumb label for purpose list page |
| src/static/locales/it/purpose.json | Added Italian translations for required label, revised field labels, and new load estimation section with threshold info |
| src/static/locales/en/shared-components.json | Updated breadcrumb label for purpose list page |
| src/static/locales/en/purpose.json | Added English translations for required label, revised field labels, and new load estimation section with threshold info |
| src/pages/ConsumerPurposeEditPage/hooks/useGetConsumerPurporseEditPageInfoAlertProps.tsx | New hook to determine appropriate alert based on threshold comparisons |
| src/pages/ConsumerPurposeEditPage/hooks/tests/useGetConsumerPurposeEditPageInfoAlertProps.test.ts | Test coverage for the new threshold alert hook |
| src/pages/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx | Integrated threshold display, alerts, and added required props to form fields |
| src/pages/ConsumerPurposeEditPage/ConsumerPurposeEdit.page.tsx | Added required fields label at the top of the form |
Comments suppressed due to low confidence (1)
src/pages/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx:122
- The isFreeOfCharge field label ends with an asterisk (*) indicating it's required, but the field lacks validation rules. Consider adding rules={{ required: true }} for consistency and to ensure proper form validation, even though a default value is always provided.
<RHFRadioGroup
name="isFreeOfCharge"
label={t('edit.stepGeneral.isFreeOfChargeField.label')}
options={[
{ label: t('edit.stepGeneral.isFreeOfChargeField.options.YES'), value: 'YES' },
{ label: t('edit.stepGeneral.isFreeOfChargeField.options.NO'), value: 'NO' },
]}
/>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/pages/ConsumerPurposeEditPage/hooks/useGetConsumerPurporseEditPageInfoAlertProps.tsx
Outdated
Show resolved
Hide resolved
.../ConsumerPurposeEditPage/hooks/__tests__/useGetConsumerPurposeEditPageInfoAlertProps.test.ts
Outdated
Show resolved
Hide resolved
...ges/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx
Outdated
Show resolved
Hide resolved
...ges/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx
Show resolved
Hide resolved
...ges/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx
Outdated
Show resolved
Hide resolved
...ges/ConsumerPurposeEditPage/components/PurposeEditStepGeneral/PurposeEditStepGeneralForm.tsx
Outdated
Show resolved
Hide resolved
src/pages/ConsumerPurposeEditPage/hooks/useGetConsumerPurposeEditPageInfoAlertProps.tsx
Show resolved
Hide resolved
|
34d884e
into
feature/PIN-8882_soglie_differenziate


Issue
Description / Context / Why