Skip to content
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-collection): sign list without candidateid #16154

Merged
merged 8 commits into from
Sep 25, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Sep 25, 2024

Screenshot 2024-09-25 at 12 57 22

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a candidate selection section in the form, allowing users to choose candidates dynamically.
    • Added localized messages to enhance user experience during candidate selection.
  • Bug Fixes

    • Updated the behavior of the back button in the user interface.
  • Chores

    • Removed obsolete items and properties from the form and data schema to streamline functionality.

@albinagu albinagu requested a review from a team as a code owner September 25, 2024 12:56
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Walkthrough

The changes involve modifications to the candidate selection logic in the Draft.ts file, including the removal of the listId property and the introduction of a candidate selection section. The Prerequisites.ts file sees the removal of an unused function call, while the dataSchema.ts file also removes the listId property. New localized messages related to candidate selection are added in messages.ts, and an import statement is modified in signListTemplate.ts. Additionally, the UI components for displaying loading states and skeletons have been adjusted for better layout.

Changes

File Change Summary
libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Draft.ts Modified candidate selection logic, removed listId, and updated renderLastScreenBackButton.
libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Prerequisites.ts Removed buildDataProviderItem function call from form definition.
libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/dataSchema.ts Removed listId property from dataSchema definition.
libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/messages.ts Added new localized messages for candidate selection and recommendations.
libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/signListTemplate.ts Removed import of OwnerRequirementsApi, reducing dependencies.
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx Adjusted UI layout for loading skeletons and increased margin for better spacing.
libs/service-portal/signature-collection/src/skeletons.tsx Simplified the CollectorSkeleton component's return statement by removing unnecessary properties.

Possibly related PRs

Suggested reviewers

  • kksteini
  • juni-haukur

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.66%. Comparing base (e5c7467) to head (9b814af).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16154      +/-   ##
==========================================
+ Coverage   36.64%   36.66%   +0.02%     
==========================================
  Files        6769     6766       -3     
  Lines      139464   139363     -101     
  Branches    39666    39622      -44     
==========================================
- Hits        51100    51099       -1     
+ Misses      88364    88264     -100     
Flag Coverage Δ
portals-admin-regulations-admin 1.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...n/parliamentary-list-signing/src/lib/dataSchema.ts 66.66% <ø> (ø)
...ion/parliamentary-list-signing/src/lib/messages.ts 100.00% <ø> (ø)
...iamentary-list-signing/src/lib/signListTemplate.ts 47.61% <100.00%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5c7467...9b814af. Read the comment docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (2)
libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/messages.ts (1)

104-123: LGTM! Consider adding descriptions for new messages.

The new messages are well-structured and consistent with the existing pattern. They align with the PR objectives by addressing the signing process without requiring a candidate ID.

Consider adding meaningful descriptions to the description field for each new message. This can help provide context for translators and developers. For example:

selectCandidate: {
  id: 'pls.application:selectCandidate',
  defaultMessage: 'Veldu frambjóðanda',
  description: 'Prompt for user to select a candidate',
},
libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Draft.ts (1)

36-36: Update or remove testing comment before merging

The comment /* section used for testing purposes */ suggests that this section is intended for testing. If this section is meant to be included in the production code, consider updating or removing the comment to reflect its actual purpose, preventing potential confusion for other developers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 59391dd and 2a0be84.

📒 Files selected for processing (5)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Draft.ts (5 hunks)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Prerequisites.ts (0 hunks)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/dataSchema.ts (0 hunks)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/messages.ts (1 hunks)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/signListTemplate.ts (1 hunks)
💤 Files not reviewed due to no reviewable changes (2)
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Prerequisites.ts
  • libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/dataSchema.ts
🧰 Additional context used
📓 Path-based instructions (3)
libs/application/templates/signature-collection/parliamentary-list-signing/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."
libs/application/templates/signature-collection/parliamentary-list-signing/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/application/templates/signature-collection/parliamentary-list-signing/src/lib/signListTemplate.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 not posted (2)
libs/application/templates/signature-collection/parliamentary-list-signing/src/lib/signListTemplate.ts (1)

Line range hint 23-158: Approve template configuration and adherence to coding guidelines

The signListTemplate configuration remains unchanged and continues to adhere to the coding guidelines:

  1. It uses TypeScript for defining props and exporting types, enhancing type safety.
  2. The component structure suggests reusability across different NextJS apps.
  3. The state machine configuration provides a clear and maintainable structure for the application flow.

These aspects contribute to the overall quality and maintainability of the code.

libs/application/templates/signature-collection/parliamentary-list-signing/src/forms/Draft.ts (1)

23-23: Update to 'renderLastScreenBackButton' aligns with intended UI behavior

Changing renderLastScreenBackButton to false ensures that the back button is not displayed on the last screen. This aligns with the intended user experience for the signing process, preventing users from navigating back after completing the signing.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 25, 2024

Datadog Report

Branch report: parliamentary_signlist
Commit report: 4e53146
Test service: portals-admin-regulations-admin

✅ 0 Failed, 24 Passed, 0 Skipped, 16.76s Total Time
➡️ Test Sessions change in coverage: 1 no change

@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Sep 25, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (1)

188-192: LGTM: Improved skeleton layout.

The modification to render separate CollectorSkeleton components in individual table cells better represents the actual data structure and improves the visual representation of the loading state.

Consider adding aria-busy="true" to the table row or its parent container during the loading state to improve accessibility:

-              <T.Row>
+              <T.Row aria-busy="true">
                 <T.Data>
                   <CollectorSkeleton />
                 </T.Data>
                 <T.Data>
                   <CollectorSkeleton />
                 </T.Data>
               </T.Row>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2a0be84 and b5a138f.

📒 Files selected for processing (2)
  • libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (3 hunks)
  • libs/service-portal/signature-collection/src/skeletons.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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/skeletons.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 (4)
libs/service-portal/signature-collection/src/skeletons.tsx (1)

26-26: Simplified CollectorSkeleton component: Verify intended design

The CollectorSkeleton component has been simplified to render a single skeleton loader instead of multiple ones. This change maintains the same appearance for a single item but removes the ability to display multiple loading placeholders.

Pros:

  • Simplified and potentially more performant component.
  • Maintains the same visual appearance for a single skeleton loader.

Cons:

  • Removes the ability to show multiple skeleton loaders, which might affect the user experience if multiple items were expected to load.

Please confirm that this simplification aligns with the intended design and user experience. If multiple items are expected to be loaded in this component, consider keeping the repeat property or adjusting the parent component to render multiple CollectorSkeleton instances as needed.

The changes adhere to the coding guidelines for the libs directory:

  • The component remains reusable across different NextJS apps.
  • It uses TypeScript (implicit through the .tsx extension).
  • The simplification may improve tree-shaking and bundling.
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (3)

43-43: LGTM: Minor formatting improvement.

The addition of a blank line after variable declarations improves code readability without affecting functionality.


91-91: LGTM: UI spacing adjustment.

The increase in top margin for the loading skeleton improves the visual spacing of the component.


Line range hint 1-240: Overall assessment: Minor improvements to component structure and visual representation.

The changes in this file are minor but positive:

  1. Improved code readability with added spacing.
  2. Better UI spacing for the loading skeleton.
  3. Enhanced representation of the collector skeletons in the table structure.

These modifications align with the coding guidelines for the libs directory, maintaining the component's reusability across different NextJS apps. The use of TypeScript for props and types remains consistent, and there are no apparent issues with tree-shaking or bundling practices.

@kodiakhq kodiakhq bot merged commit abd67fa into main Sep 25, 2024
30 checks passed
@kodiakhq kodiakhq bot deleted the parliamentary_signlist branch September 25, 2024 14:40
thoreyjona pushed a commit that referenced this pull request Oct 2, 2024
* fix(signature-collection): sign list without candidateid

* temp

* tweak

* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants