-
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(service-portal): Signee view for parliamentary signature collection #16019
Conversation
WalkthroughThe pull request includes modifications to various components within the application, focusing on the Changes
Possibly related PRs
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: 1
Outside diff range and nitpick comments (2)
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (1)
32-37
: Remove the console log statement before deploying to production.The changes introduce new functionality to the
OwnerView
component, allowing it to interact with user and owner data more effectively. This is a good enhancement.However, please remember to remove the console log statement that outputs the
listsForOwner
before deploying to production, as it may expose sensitive data.Apply this diff to remove the console log statement:
- console.log(listsForOwner)
libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx (1)
51-53
: Consider providing more specific error messages.To improve the user experience, consider providing more specific error messages based on the type of error encountered during the unsigning process. This will help users understand the issue better and take appropriate actions if needed.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts (1 hunks)
- libs/service-portal/signature-collection/src/lib/constants.ts (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (1 hunks)
Additional context used
Path-based instructions (6)
libs/service-portal/signature-collection/src/lib/constants.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/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/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.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/SigneeView/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/SignedList/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 not posted (12)
libs/service-portal/signature-collection/src/lib/constants.ts (1)
3-3
: LGTM!The change updates the representation of a specific collection type, potentially indicating a new testing phase or a different context for parliamentary elections. The change adheres to the TypeScript usage for defining constants and does not affect the overall structure or logic of the code.
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (5)
13-15
: Effective use of custom hooks for data management.The introduction of the
useIsOwner
anduseGetCurrentCollection
custom hooks is a good approach for managing the loading states and fetching the necessary data (ownership status and current collection) for the component.Encapsulating this logic in separate hooks improves code readability and reusability.
19-22
: Improved generalization of the IntroHeader component.The modifications to the
IntroHeader
component's title and description, using more general messages from them
module, make the component more context-agnostic and reusable across different scenarios.Using the
formatMessage
function with theuseLocale
hook ensures proper localization of the title and description.
23-33
: Improved rendering logic based on loading states and user ownership.The updated rendering logic in the
SignatureListsParliamentary
component enhances the user experience by considering the loading states and user ownership status.
- Checking the
loadingIsOwner
andloadingCurrentCollection
states before rendering the views ensures that the component waits for the necessary data to be available.- Rendering either the
OwnerView
orSigneeView
based on theisOwner.success
status allows for a dynamic display of the appropriate content.- Passing the
currentCollection
as a prop to both views ensures that the latest collection data is available to them.- Rendering a
Skeleton
component during loading states provides visual feedback to the user, indicating that data is being fetched.These changes improve the overall user experience and make the component more robust in handling different scenarios.
7-8
: Good organization of custom hooks in a separate module.Importing the
useGetCurrentCollection
anduseIsOwner
hooks from the../../hooks
module promotes code organization and reusability.Keeping custom hooks in a separate module allows for better maintainability and makes it easier to share the hooks across different components within the same feature or module.
3-3
: Verify the reusability and consistency of the IntroHeader component.The
IntroHeader
component is imported from the@island.is/service-portal/core
module, which suggests it is a shared component used across the service portal.Please ensure that the
IntroHeader
component is consistently used and styled across different pages and features within the service portal to maintain a cohesive user experience.Verification successful
IntroHeader component usage is consistent and widespread
The verification process confirms that the
IntroHeader
component is indeed a widely used, shared component across the service portal. It is consistently imported from the core modules and used in various screens and features, including user information, health, education, assets, and more.Key observations:
- Imported from '@island.is/portals/core' or '@island.is/service-portal/core'
- Used in multiple modules and screens throughout the project
- Consistent usage pattern with props like 'title' and 'intro'
This widespread and consistent usage promotes a cohesive user experience across different parts of the service portal, as initially suggested in the review comment.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and consistency of the IntroHeader component across the service portal. # Test: Search for the IntroHeader component usage. Expect: Consistent usage across different pages and features. rg --type tsx -A 5 $'IntroHeader'Length of output: 60
Script:
#!/bin/bash # Description: Verify the usage and consistency of the IntroHeader component across the service portal. # Find all .tsx and .ts files, then search for IntroHeader usage fd '\.(tsx|ts)$' | xargs rg 'IntroHeader' -n | grep -v '//' | grep -v '^\s*\*' # If no results are found, search for the import statement to verify the component exists if [ $? -ne 0 ]; then echo "No direct usage of IntroHeader found. Searching for import statements:" fd '\.(tsx|ts)$' | xargs rg "import.*IntroHeader.*from.*'@island.is/service-portal/core'" -n fiLength of output: 19356
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (3)
17-21
: LGTM!The imported hooks are relevant to the component's functionality and the relative import path is a good practice.
22-23
: LGTM!The imported
useAuth
hook andSignatureCollection
type are relevant to the component's functionality and the external imports are a good practice.
25-29
: Verify the parent component is updated to pass thecurrentCollection
prop.The
OwnerView
component now accepts a new propcurrentCollection
of typeSignatureCollection
, which enhances its functionality. This is a good change and the prop type is defined using TypeScript, which is a best practice.Please ensure that the parent component that renders
OwnerView
is updated to pass thecurrentCollection
prop.Run the following script to verify the parent component usage:
Verification successful
The parent components have been correctly updated to pass the
currentCollection
prop.Our verification process has confirmed that the
OwnerView
component is being used correctly in both the Parliamentary and Presidential screens. In both cases, thecurrentCollection
prop is being passed to theOwnerView
component as required:
In
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx
:<OwnerView currentCollection={currentCollection} />In
libs/service-portal/signature-collection/src/screens/Presidential/index.tsx
:<OwnerView currentCollection={currentCollection} />The import statements in both files also confirm that the
OwnerView
component is being imported correctly from the local directory.This verification confirms that the changes to the
OwnerView
component have been properly implemented in the parent components, ensuring that thecurrentCollection
data is available where needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the parent component passes the `currentCollection` prop to `OwnerView`. # Test: Search for the `OwnerView` component usage. Expect: `currentCollection` prop is passed. rg --type tsx -A 5 $'<OwnerView'Length of output: 61
Script:
#!/bin/bash # Description: Verify the parent component passes the `currentCollection` prop to `OwnerView`. # Search for files containing 'OwnerView' in their name echo "Files containing 'OwnerView' in their name:" fd -e ts -e tsx OwnerView # Search for usage of <OwnerView> component in .ts and .tsx files echo "Usage of <OwnerView> component:" rg -t ts -t tsx '<OwnerView' -A 5 # Search for import statements of OwnerView echo "Import statements for OwnerView:" rg -t ts -t tsx 'import.*OwnerView'Length of output: 408
Script:
#!/bin/bash # Description: Verify the parent component passes the `currentCollection` prop to `OwnerView` using a more inclusive search strategy. # Check repository structure echo "Repository structure:" tree -L 3 # Search for files containing 'OwnerView' in their name (case-insensitive) echo "Files containing 'OwnerView' in their name (case-insensitive):" find . -iname "*ownerview*" # Search for usage of OwnerView component without specifying file types echo "Usage of OwnerView component:" grep -r -n -A 5 "<OwnerView" . # Search for import statements of OwnerView without specifying file types echo "Import statements for OwnerView:" grep -r -n "import.*OwnerView" .Length of output: 22936
libs/service-portal/signature-collection/src/screens/Parliamentary/SigneeView/index.tsx (1)
Line range hint
1-120
: Great work on enhancing the SigneeView component! The changes significantly improve the user experience and provide a personalized view based on user roles and data availability.The component now efficiently retrieves user-specific data using custom hooks and conditionally renders the appropriate content. The rendering logic is well-structured and handles different scenarios effectively, such as displaying an empty state when no lists are available, rendering the signed list and user-specific action cards when lists are present, showing a warning message for actors, and presenting a loading skeleton while data is being fetched.
The use of TypeScript for defining props and importing types ensures type safety and improves code maintainability. The component also follows good practices by importing only the necessary modules, which helps with tree-shaking and optimizing the bundle size.
Overall, the changes are well-implemented and align with the goals of providing a user-centric experience in the SigneeView component.
libs/service-portal/signature-collection/src/screens/Parliamentary/SignedList/index.tsx (2)
15-144
: LGTM!The
SignedList
component is well-structured and follows best practices for reusability and TypeScript usage. It effectively uses hooks for data fetching and state management, and provides a good user experience with clear feedback and updates.
15-144
: Adheres to the additional instructions.The component adheres to the guidelines mentioned in the additional instructions:
- It is reusable across different NextJS apps.
- It uses TypeScript for defining props and exporting types.
- It follows effective tree-shaking and bundling practices.
libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Done.ts
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: 1
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Done.ts (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/ViewList/Signees.tsx (1 hunks)
Additional context used
Path-based instructions (2)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Done.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/ViewList/Signees.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 not posted (1)
libs/application/templates/signature-collection/parliamentary-list-creation/src/forms/Done.ts (1)
65-65
: LGTM!The change to the button URL aligns with the PR objective of implementing a signee view for parliamentary signature collection. It should redirect users to the new signee view without introducing any breaking changes or errors.
...service-portal/signature-collection/src/screens/Parliamentary/OwnerView/ViewList/Signees.tsx
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16019 +/- ##
=======================================
Coverage 36.81% 36.81%
=======================================
Files 6721 6721
Lines 137879 137874 -5
Branches 39204 39202 -2
=======================================
+ Hits 50761 50762 +1
+ Misses 87118 87112 -6
Flags with carried forward coverage won't be shown. Click here to find out more. see 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 14 Total Test Services: 0 Failed, 14 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (3) |
...
Attach a link to issue if relevant
What
Specify what you're trying to achieve
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
isPresidential
field to the current collection query for enhanced data context.Bug Fixes
Improvements