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(portals-admin): signature collection overview search #16268

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Oct 4, 2024

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

    • Enhanced localization messages for the signature collection interface.
    • Introduced a new GraphQL query for retrieving signature collection details.
    • Added a loading state with a skeleton loader for improved user experience during data fetching.
  • Bug Fixes

    • Updated placeholder text for better user guidance in the search functionality.
  • Documentation

    • Improved clarity and specificity of messages related to signature management.

@albinagu albinagu requested a review from a team as a code owner October 4, 2024 11:57
Copy link
Contributor

coderabbitai bot commented Oct 4, 2024

Walkthrough

The changes in this pull request include updates to localization strings in the messages.ts file for the admin portal's signature collection feature, introducing new messages and modifying existing ones. Additionally, a new GraphQL query named SignatureCollectionSignatureLookup is added to retrieve signature collection details. The index.tsx component is updated to manage state and fetch data using the new query, while a new SkeletonSingleRow component is introduced for loading states.

Changes

File Change Summary
libs/portals/admin/signature-collection/src/lib/messages.ts Updated searchNationalIdPlaceholder and added new messages related to signature management.
libs/portals/admin/signature-collection/src/screens-parliamentary/findSignature.graphql Added new GraphQL query SignatureCollectionSignatureLookup to fetch signature collection details.
libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx Updated ParliamentaryRoot component to manage state, fetch signatures, and render loading and data display logic.
libs/portals/admin/signature-collection/src/shared-components/compareLists/skeleton.tsx Introduced new SkeletonSingleRow component for loading states while fetching signature data.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • kksteini

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
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: 1

🧹 Outside diff range and nitpick comments (4)
libs/portals/admin/signature-collection/src/shared-components/compareLists/skeleton.tsx (2)

22-24: Consider adding TypeScript type annotations and verify prop values.

The new SkeletonSingleRow component looks good, but there are a couple of points to consider:

  1. TypeScript: Add explicit type annotations to improve type safety and documentation. For example:
export const SkeletonSingleRow: React.FC = () => {
  return <SkeletonLoader height={90} width="100%" borderRadius="large" />
}
  1. Props: The height prop is set to 90, while in the Skeleton component it's set to 50. Verify if this difference is intentional and aligns with the design requirements.

Line range hint 1-24: Ensure full adherence to coding guidelines for libs directory

The changes generally follow the guidelines for files in the libs directory:

  1. Reusability: Both components are exported, allowing for reuse across different NextJS apps.
  2. TypeScript usage: While TypeScript is used, explicit type annotations for props and exported types could be improved.
  3. Tree-shaking: The components are simple and focused, which should allow for effective tree-shaking and bundling.

To fully adhere to the guidelines, consider:

  • Adding explicit type annotations to both Skeleton and SkeletonSingleRow components.
  • If there are any prop types or interfaces used by these components, export them for use in other parts of the application.
libs/portals/admin/signature-collection/src/lib/messages.ts (1)

363-397: Comprehensive set of messages for signee list details.

The addition of these new messages greatly enhances the ability to display detailed information about the signee list. This includes list type, status, signature method, and validity, which are crucial for administrative purposes. The implementation is consistent with the existing message definition pattern.

However, there's a minor typo in two message ids:

Please correct the following typos in the message ids:

-    id: 'admin-portal.signature-collection:signeeSigntaureValid',
+    id: 'admin-portal.signature-collection:signeeSignatureValid',
-    id: 'admin-portal.signature-collection:signeeSigntaureInvalid',
+    id: 'admin-portal.signature-collection:signeeSignatureInvalid',
libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx (1)

133-134: Explicitly define the type of 's' in the map function for clarity

Currently, the variable s in the map function is implicitly typed. Explicitly specifying the type can improve code readability and type safety.

Apply this diff to define the type:

-{data?.signatureCollectionSignatureLookup?.map((s) => (
+{data?.signatureCollectionSignatureLookup?.map((s: Signature) => (

Ensure that Signature is correctly imported or defined in your types.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4a78b1f and d94319a.

📒 Files selected for processing (4)
  • libs/portals/admin/signature-collection/src/lib/messages.ts (2 hunks)
  • libs/portals/admin/signature-collection/src/screens-parliamentary/findSignature.graphql (1 hunks)
  • libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx (5 hunks)
  • libs/portals/admin/signature-collection/src/shared-components/compareLists/skeleton.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
libs/portals/admin/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/portals/admin/signature-collection/src/screens-parliamentary/findSignature.graphql (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/portals/admin/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/portals/admin/signature-collection/src/shared-components/compareLists/skeleton.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/portals/admin/signature-collection/src/screens-parliamentary/findSignature.graphql (1)

1-18: Well-structured GraphQL query that adheres to coding guidelines.

The SignatureCollectionSignatureLookup query is well-defined and follows GraphQL best practices. It's located in the libs directory, which aligns with the coding guidelines for reusable components across different NextJS apps. The query structure supports effective tree-shaking and bundling.

A few points to note:

  1. The use of a single input type (SignatureCollectionSignatureLookupInput) allows for easy expansion of input parameters in the future.
  2. The queried fields provide comprehensive information for a signature lookup, including nested objects.
  3. While there's no explicit TypeScript usage, GraphQL schemas are inherently typed, which aligns with the TypeScript usage guideline.
libs/portals/admin/signature-collection/src/lib/messages.ts (2)

315-317: Improved clarity in search placeholder text.

The update to the searchNationalIdPlaceholder message enhances user understanding by specifying that the search is for a supporter's national ID. This change improves the user interface's clarity and usability.


318-322: Enhanced user feedback for empty search results.

The addition of the noSigneeFoundOverviewText message improves the user experience by providing clear feedback when no supporter is found in a search. This follows good UX practices by keeping users informed about the system status.

libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx (1)

97-99: Verify the parameter type for 'onChange' handler in 'FilterInput'

Ensure that the onChange prop in FilterInput accepts a function that receives the new value directly. If it provides an event object instead, this could cause unexpected behavior.

Run the following script to verify the onChange prop type in the FilterInput component:

✅ Verification successful

Re-verify the 'onChange' prop type in 'FilterInput'


The 'onChange' prop in 'FilterInput' correctly accepts a function that receives the new value directly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the 'onChange' prop type in 'FilterInput'

# Test: Search for 'onChange' prop in the 'FilterInput' component definition.
# Expected result: 'onChange' accepts a function that receives the new value directly.

fd --type f --name 'FilterInput.tsx' | xargs grep -A 5 'onChange'

Length of output: 314


Script:

#!/bin/bash
# Description: Check the 'onChange' prop type in 'FilterInput'

# Test: Search for 'onChange' prop in the 'FilterInput' component definition.
# Expected result: 'onChange' accepts a function that receives the new value directly.

fd --type f 'FilterInput.tsx' | xargs grep -A 5 'onChange'

Length of output: 2264

@albinagu albinagu added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Oct 4, 2024
@datadog-island-is
Copy link

Datadog Report

All test runs 175e0c5 🔗

2 Total Test Services: 0 Failed, 2 Passed
➡️ Test Sessions change in coverage: 4 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-backend 0 0 0 21145 0 20m 25.6s 1 no change Link
judicial-system-xrd-api 0 0 0 6 0 5.72s 1 no change Link

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.92%. Comparing base (ead8e77) to head (1afa830).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16268   +/-   ##
=======================================
  Coverage   36.92%   36.92%           
=======================================
  Files        6781     6781           
  Lines      140031   140031           
  Branches    39816    39816           
=======================================
  Hits        51705    51705           
  Misses      88326    88326           
Flag Coverage Δ
judicial-system-backend 55.24% <ø> (ø)

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


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 ead8e77...1afa830. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants