-
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
fix(signature-collections): ongoing updates #16409
Conversation
WalkthroughThe changes in this pull request involve the addition of a new message for localization and modifications to the Changes
Possibly related PRs
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
|
Datadog ReportAll test runs ✅ 4 Total Test Services: 0 Failed, 4 Passed Test Services
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16409 +/- ##
==========================================
- Coverage 36.73% 36.71% -0.02%
==========================================
Files 6809 6810 +1
Lines 141088 141133 +45
Branches 40225 40235 +10
==========================================
- Hits 51826 51819 -7
- Misses 89262 89314 +52
Flags with carried forward coverage won't be shown. Click here to find out more. see 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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: 1
🧹 Outside diff range and nitpick comments (3)
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (2)
36-40
: LGTM! Consider using interface for props.The addition of the
isListHolder
prop and its TypeScript annotation is good. It enhances the component's reusability across different NextJS apps, as per our guidelines.Consider defining an interface for the component props to improve code readability and maintainability:
interface OwnerViewProps { currentCollection: SignatureCollection; isListHolder: boolean; } const OwnerView = ({ currentCollection, isListHolder }: OwnerViewProps) => { // ... }
Line range hint
133-180
: LGTM! Consider simplifying the conditional logic.The changes to the ActionCard tag rendering logic are good. They properly utilize the
isListHolder
prop and provide better user feedback based on the list's state.To improve readability, consider simplifying the conditional logic:
tag={ list.active ? (isListHolder ? { label: 'Cancel collection', renderTag: () => ( // ... existing cancel collection dialog ... ), } : undefined) : { label: formatMessage(m.listSubmitted), variant: 'blueberry', } }This structure more clearly represents the three possible states: active and list holder, active but not list holder, and inactive.
libs/service-portal/signature-collection/src/lib/messages.ts (1)
364-368
: LGTM! Consider adding a description for clarity.The new
noSupervisors
message follows the existing structure and naming conventions. It's correctly defined using TypeScript and appears to be reusable across different NextJS apps within the signature collection feature.Consider adding a brief description to the
description
field to provide context for translators or other developers. For example:noSupervisors: { id: 'sp.signatureCollection:noSupervisors', defaultMessage: 'Enginn umsjónaraðili skráður', - description: '', + description: 'Message displayed when no supervisors are registered for a signature collection.', },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
- libs/service-portal/signature-collection/src/lib/messages.ts (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (5 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
libs/service-portal/signature-collection/src/lib/messages.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/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.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."
libs/service-portal/signature-collection/src/screens/Parliamentary/index.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 (5)
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (2)
12-13
: LGTM: New imports enhance functionality and type safetyThe added imports for
useUserInfo
andAuthDelegationType
are appropriate for the new functionality. They align with the guidelines for reusability and TypeScript usage.
20-20
: LGTM: User info retrieval addedThe addition of
userInfo
using theuseUserInfo
hook is a good practice for accessing user-specific data. This aligns with React best practices and enhances the component's functionality.libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (3)
Line range hint
86-92
: LGTM! Improved conditional rendering.The changes to the AddConstituency component's rendering logic are well-implemented. The use of
isListHolder
and!loadingOwnerLists
ensures that the component is only rendered when appropriate, improving the overall user experience.
220-228
: LGTM! Improved handling of empty collectors list.The changes to the collectors rendering logic are well-implemented. The addition of a fallback text for when there are no supervisors improves the user experience and provides clear feedback. The use of
formatMessage
ensures proper localization, which is excellent.
Line range hint
1-265
: Overall, excellent improvements to the OwnerView component.The changes in this file enhance the functionality and flexibility of the OwnerView component. The addition of the
isListHolder
prop and the corresponding logic changes improve the component's ability to handle different user roles. The use of TypeScript for prop definitions and the consistent application of localization throughformatMessage
align well with our coding guidelines.These changes maintain the component's reusability across different NextJS apps while adding more nuanced behavior based on user roles. The improved conditional rendering and better handling of edge cases (like empty collectors list) contribute to a better user experience.
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx
Show resolved
Hide resolved
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: 0
🧹 Outside diff range and nitpick comments (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (1)
284-287
: LGTM! Consider improving readability.The use of
getValueViaPath
for dynamic heading construction is a good improvement. It enhances flexibility and reusability of the component.Consider using template literals for better readability:
heading: `${getValueViaPath(answers, 'list.name')} - ${c.split('|')[1]}`,
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.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."
🔇 Additional comments (2)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (2)
Line range hint
1-338
: Overall changes improve form structure and flexibility.The modifications to this file, including the removal of the managers and supervisors section (as mentioned in the AI summary) and the enhancements to dynamic field construction, align well with the PR objectives. These changes simplify the form structure while improving its flexibility and reusability.
Some key points:
- The removal of unused sections reduces complexity.
- The use of
getValueViaPath
for dynamic content generation enhances flexibility.- The overall structure maintaining list information, constituency selection, and overview sections remains intact.
These changes should contribute to a more maintainable and adaptable signature collection process.
16-19
: LGTM! Verify usage of new imports.The removal of
buildTableRepeaterField
and addition ofApplication
andUserProfile
imports align with the changes in the form structure. These changes appear to be correct.Let's verify the usage of the new imports:
✅ Verification successful
Verification Successful: Imports are Used Correctly.
TheApplication
andUserProfile
imports are actively utilized in the codebase as confirmed by the shell script results.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of Application and UserProfile types # Test: Search for usage of Application and UserProfile types rg --type typescript 'Application' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts rg --type typescript 'UserProfile' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.tsLength of output: 329
Script:
#!/bin/bash # Description: Verify usage of Application and UserProfile types # Test: Search for usage of Application and UserProfile types in TypeScript files rg --type ts 'Application' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts rg --type ts 'UserProfile' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.tsLength of output: 881
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: 1
🧹 Outside diff range and nitpick comments (2)
libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx (2)
17-17
: Approve dynamic URL construction with a minor suggestion.The dynamic URL construction is a good improvement. However, to ensure proper URL formatting, consider adding a leading slash to the slug if it's not already present.
You could modify the URL construction like this:
`${document.location.origin}/${slug.startsWith('/') ? slug.slice(1) : slug}`
This ensures that there's always exactly one slash between the origin and the slug.
Line range hint
1-24
: Enhance TypeScript usage for better type safety and documentation.While the component adheres to the coding guidelines for
libs/**/*
files, there's room for improvement in TypeScript usage.Consider the following enhancements:
Define a more specific type for the
application
prop instead of usingFieldBaseProps
. This will provide better type safety and documentation.Export the component's prop type for reuse in other components.
Example:
import { Application } from '@island.is/application/types' export interface CopyLinkProps { application: Application & { externalData: { createLists: { data: { slug: string } } } } } export const CopyLink: FC<CopyLinkProps> = ({ application }) => { // ... component logic }This change will improve type safety, make the component's requirements more explicit, and enhance reusability across different NextJS apps.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.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."
...ion/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx
Show resolved
Hide resolved
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: 0
🧹 Outside diff range and nitpick comments (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (1)
281-284
: Improved heading clarity, consider extracting constituency name.The changes enhance the heading by combining the list name and constituency name, which improves clarity for users. Good use of
getValueViaPath
for safe property access.Consider extracting the constituency name for improved readability:
const constituencyName = c.split('|')[1]; heading: `${getValueViaPath(answers, 'list.name')} - ${constituencyName}`,This minor refactoring would make the code slightly more readable and easier to maintain.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx (1 hunks)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/fields/CopyLink/index.tsx
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.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."
🔇 Additional comments (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts (1)
Line range hint
1-324
: Verify removal of managers and supervisors sections.The AI-generated summary mentioned the removal of sections related to managers and supervisors. However, these sections are not visible in the provided code snippet.
To ensure all changes are accounted for, please run the following script:
If the script returns any results, please review those sections to ensure they have been properly removed or updated as intended.
✅ Verification successful
Verify removal of managers and supervisors sections.
The search for "manager" and "supervisor" terms returned no results in
Draft.ts
, confirming that these sections have been successfully removed.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining references to managers or supervisors in the file # Test: Search for manager or supervisor related terms rg --type typescript -i '(manager|supervisor)' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts # If no results are found, it confirms the removal of these sectionsLength of output: 178
Script:
#!/bin/bash # Description: Check for any remaining references to managers or supervisors in the file # Test: Search for manager or supervisor related terms rg -i '(manager|supervisor)' libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Draft.ts # If no results are found, it confirms the removal of these sectionsLength of output: 125
* tweaks * tweak - create list * copylink * chore: nx format:write update dirty files --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix(service-portal): company route signature collections (#16382) * draft * chore: nx format:write update dirty files * fix: company path * tweaks * p * view list company path * chore: nx format:write update dirty files * nav tweak --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: Ásdís Erna Guðmundsdóttir <[email protected]> * fix(service-portal): sp list submitted (#16383) * fix(service-portal): sp list submitted * tweak * chore: nx format:write update dirty files --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: andes-it <[email protected]> * fix(portals-admin): adding report date (#16384) * fix(portals-admin): adding report date * chore: nx format:write update dirty files * tweak * tweak supervisors info * chore: nx format:write update dirty files * tweak * message - company card * tweak * t * t * chore: nx format:write update dirty files --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(signature-collection): tweaks 15.10 (#16402) * tweaka * chore: nx format:write update dirty files --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(signature-collection): Tweaks for parliamentary collection (#16407) * Tweaks for parliamentary collection * revertt' * Update libs/api/domains/signature-collection/src/lib/signatureCollection.service.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * managers should see other managers --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(signature-collection): Fix paper signatures for candidacy (#16411) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(signature-collections): ongoing updates (#16409) * tweaks * tweak - create list * copylink * chore: nx format:write update dirty files --------- Co-authored-by: andes-it <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --------- Co-authored-by: albinagu <[email protected]> Co-authored-by: andes-it <[email protected]> Co-authored-by: Ásdís Erna Guðmundsdóttir <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: juni-haukur <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Checklist:
Summary by CodeRabbit
OwnerView
component to conditionally render elements based on user status as a list holder.CopyLink
component to dynamically construct URLs based on application data.