-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(application-system): Remove phone input feature flag #16372
Conversation
WalkthroughThe changes in this pull request primarily involve the modification of the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (4)
libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx (3)
35-35
: LGTM! Consider updating the Props interface for clarity.The addition of
enableCountrySelector
with a default value offalse
aligns well with the PR objective of making country selection an opt-in feature. This maintains backwards compatibility while allowing for the new functionality.Consider updating the
Props
interface to explicitly includeenableCountrySelector
as an optional boolean property. This would improve type safety and make the component's API more clear to other developers. You can add the following line to theProps
interface:enableCountrySelector?: boolean;
69-69
: LGTM! Consider renaming the prop for clarity.The replacement of the feature flag logic with
disableDropdown={!enableCountrySelector}
simplifies the component and aligns with the PR objectives. This change makes the component more self-contained and easier to understand.To improve clarity, consider renaming the
disableDropdown
prop in thePhoneInputController
component toenableDropdown
. This would allow you to pass theenableCountrySelector
value directly without negation:enableDropdown={enableCountrySelector}This change would make the code more intuitive and reduce the cognitive load of understanding the inverted logic.
Line range hint
1-82
: LGTM! Consider optimizing imports for better tree-shaking.The
PhoneFormField
component is well-structured, uses TypeScript effectively, and is designed for reusability across different NextJS apps. It adheres to the coding guidelines for files in thelibs
directory.To further improve tree-shaking and bundling, consider updating the import from '@island.is/island-ui/core' to only import the specific component you need:
import { Box } from '@island.is/island-ui/core/Box'This change can help reduce the bundle size by ensuring only the necessary components are imported.
libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (1)
71-71
: LGTM! Consider adding a comment for clarity.The change from
disableDropdown: false
toenableCountrySelector: true
aligns with the PR objective of making country selection an "opt-in" feature. This modification enhances the configurability of the phone field component.Consider adding a brief comment explaining the purpose of
enableCountrySelector: true
to improve code readability:buildPhoneField({ id: 'applicant.phone', title: m.phone, width: 'half', required: true, + // Enable country selection for phone input enableCountrySelector: true, defaultValue: (application: Application) => { // ... (rest of the code) }, }),
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (10)
- libs/application/core/src/lib/fieldBuilders.ts (2 hunks)
- libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (1 hunks)
- libs/application/templates/estate/src/forms/Sections/representative.ts (0 hunks)
- libs/application/templates/inheritance-report/src/forms/sections/applicant.ts (1 hunks)
- libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1 hunks)
- libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (1 hunks)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (0 hunks)
- libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts (0 hunks)
- libs/application/types/src/lib/Fields.ts (1 hunks)
- libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx (2 hunks)
💤 Files with no reviewable changes (3)
- libs/application/templates/estate/src/forms/Sections/representative.ts
- libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts
- libs/application/templates/signature-collection/presidential-list-creation/src/forms/Draft.ts
🧰 Additional context used
📓 Path-based instructions (7)
libs/application/core/src/lib/fieldBuilders.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/estate/src/forms/Sections/announcerInfo.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/applicant.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/types/src/lib/Fields.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
libs/application/ui-fields/src/lib/PhoneFormField/PhoneFormField.tsx (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
🔇 Additional comments (4)
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1)
32-32
: Change aligns with PR objectives, but consider potential impactsThe modification from
disableDropdown: false
toenableCountrySelector: true
aligns with the PR objective of making country selection an "opt-in" feature. This change effectively removes the feature flag and enables the country selector by default.However, please consider the following points:
- This change might affect existing implementations that relied on the default behavior. Ensure that all consumers of this component are aware of and prepared for this change.
- The new property name
enableCountrySelector
is more descriptive and better reflects the functionality, which is a good improvement.To ensure this change doesn't introduce unexpected behavior in other parts of the application, please run the following verification:
✅ Verification successful
Verification Successful: No issues found
The change from
disableDropdown: false
toenableCountrySelector: true
inapplicant.ts
aligns with the PR objective of making country selection an "opt-in" feature. The shell script results confirm that other usages ofbuildPhoneField
are compatible with this change and do not require additional updates.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other usages of buildPhoneField to ensure they are updated or compatible with the new property rg --type typescript 'buildPhoneField\(' -A 5 -g '!**/applicant.ts'Length of output: 104
Script:
#!/bin/bash # Search for other usages of buildPhoneField to ensure they are updated or compatible with the new property rg 'buildPhoneField\(' -A 5 -g '*.ts' -g '*.tsx' --iglob '!**/applicant.ts'Length of output: 26595
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (2)
Line range hint
1-89
: Adherence to coding guidelines confirmedThis file adheres to the coding guidelines for
libs/**/*
:
- The
inheritanceExecutor
section is reusable across different NextJS apps.- TypeScript is used effectively for defining props and types.
- The code structure supports efficient tree-shaking and bundling.
44-44
: LGTM: Change aligns with PR objectivesThe modification from
disableDropdown: true
toenableCountrySelector: true
in thebuildPhoneField
function call aligns with the PR objectives. This change implements the new "opt-in" feature for selecting countries other than Iceland for phone input, as described in the PR summary.To ensure consistency across the codebase, let's verify if this change has been applied to all relevant
buildPhoneField
calls:libs/application/core/src/lib/fieldBuilders.ts (1)
319-319
: LGTM! Verify usage across the codebase.The change from
disableDropdown
toenableCountrySelector
improves the API's clarity and aligns with the PR objective of making the country selector an "opt-in" feature. This is a positive change in terms of naming convention and usability.To ensure this change doesn't break existing implementations, please run the following script to check for any occurrences of
disableDropdown
in phone field usage:If any results are found, they will need to be updated to use
enableCountrySelector
instead.Also applies to: 329-329
✅ Verification successful
Verification Successful: No occurrences of 'disableDropdown' found in phone field usage.
This confirms that the change from
disableDropdown
toenableCountrySelector
does not impact other parts of the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usage of 'disableDropdown' in phone fields rg --type typescript --type javascript 'buildPhoneField.*disableDropdown'Length of output: 110
Script:
#!/bin/bash # Search for usage of 'disableDropdown' in phone fields within TypeScript and JavaScript files rg --type ts --type js 'buildPhoneField.*disableDropdown'Length of output: 59
libs/application/templates/inheritance-report/src/forms/sections/applicant.ts
Show resolved
Hide resolved
Datadog ReportAll test runs ✅ 21 Total Test Services: 0 Failed, 21 Passed Test ServicesThis report shows up to 10 services
|
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.
LGTM
Remove phone input feature flag
Attach a link to issue if relevant
What
Remove the feature flag for selecting other countries than iceland
Make selecting other countries an "opt-in" feature with a new prop
enableCountrySelector
Why
Specify why you need to achieve this
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit
New Features
enableCountrySelector
property.Bug Fixes
disableDropdown
property to streamline phone field functionality.Documentation