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(service-portal): sp list submitted #16383

Merged
merged 5 commits into from
Oct 14, 2024
Merged

fix(service-portal): sp list submitted #16383

merged 5 commits into from
Oct 14, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Oct 14, 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
    • Added new messages for better user guidance in the admin and service portals.
  • Improvements
    • Updated the ActionLockList component to display a more informative message in the modal.
    • Enhanced the OwnerView component to dynamically show or hide action elements based on the list's active state.

@albinagu albinagu requested a review from a team as a code owner October 14, 2024 13:56
@albinagu albinagu added the automerge Merge this PR as soon as all checks pass label Oct 14, 2024
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

This pull request introduces new localized messages for the signature collection feature in both the admin and service portals. It modifies the ActionLockList component to display a new message in the modal and updates the OwnerView component to conditionally render certain properties based on the state of a list. These changes enhance user interaction and provide clearer messaging within the application.

Changes

File Change Summary
libs/portals/admin/signature-collection/src/lib/messages.ts Added new message lockListDescription with ID admin-portal.signature-collection:lockListDescription.
libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx Modified ActionLockList to display lockListDescription in the modal instead of lockList.
libs/service-portal/signature-collection/src/lib/messages.ts Added new message listSubmitted with ID sp.signatureCollection:listSubmitted.
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx Updated OwnerView to conditionally render cta and tag properties based on list.active state.

Possibly related PRs

Suggested reviewers

  • kksteini
  • disaerna

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 Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.75%. Comparing base (ef14e1c) to head (41f5580).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16383   +/-   ##
=======================================
  Coverage   36.75%   36.75%           
=======================================
  Files        6804     6804           
  Lines      140875   140875           
  Branches    40134    40134           
=======================================
  Hits        51782    51782           
  Misses      89093    89093           
Flag Coverage Δ
api 3.37% <ø> (ø)
application-system-api 41.44% <ø> (ø)
application-template-api-modules 27.96% <ø> (-0.02%) ⬇️
application-ui-shell 21.35% <ø> (ø)

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 ef14e1c...41f5580. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 14, 2024

Datadog Report

All test runs 595e20f 🔗

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

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.64s 1 no change Link
application-system-api 0 0 0 120 2 3m 1.72s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 37.19s 1 no change Link
application-templates-health-insurance 0 0 0 0 0 592.38ms 1 no change Link
application-ui-shell 0 0 0 74 0 37.81s 1 no change Link

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 (3)
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (1)

109-175: LGTM! Consider extracting complex props for improved readability.

The changes to the ActionCard component effectively implement conditional rendering based on the list.active state, enhancing the component's flexibility and user experience. The use of TypeScript and localization functions is consistent with best practices.

To further improve code readability and maintainability, consider extracting the complex cta and tag props into separate functions or variables. This would make the JSX more concise and easier to understand at a glance.

Here's a suggested refactoring:

const getCta = (list: SignatureCollectionList) => {
  if (!list.active) return undefined;
  
  return {
    label: formatMessage(m.viewList),
    variant: 'text',
    icon: 'arrowForward',
    onClick: () => {
      const path = location.pathname.includes('fyrirtaeki')
        ? SignatureCollectionPaths.CompanyViewParliamentaryList
        : SignatureCollectionPaths.ViewParliamentaryList
      navigate(path.replace(':id', list.id), {
        state: {
          collectionId: currentCollection?.id || '',
        },
      })
    },
  };
};

const getTag = (list: SignatureCollectionList) => {
  if (!list.active) {
    return {
      label: formatMessage(m.listSubmitted),
      variant: 'blueberry',
    };
  }
  
  return {
    label: 'Cancel collection',
    renderTag: () => (
      <DialogPrompt
        // ... (rest of the DialogPrompt props)
      />
    ),
  };
};

// In the JSX:
<ActionCard
  // ... other props
  cta={getCta(list)}
  tag={getTag(list)}
/>

This refactoring would make the component more readable while maintaining the same functionality.

libs/service-portal/signature-collection/src/lib/messages.ts (1)

112-116: LGTM! Consider adding a description for clarity.

The new listSubmitted message entry follows the existing conventions and structure. It adheres to the coding guidelines for files in the libs directory by supporting reusability and using TypeScript.

Consider adding a brief description to provide context for translators:

 listSubmitted: {
   id: 'sp.signatureCollection:listSubmitted',
   defaultMessage: 'Lista skilað',
-  description: '',
+  description: 'Message displayed when a list has been submitted',
 },
libs/portals/admin/signature-collection/src/lib/messages.ts (1)

471-476: LGTM! Consider adding a description for translators.

The new lockListDescription message is well-formatted and consistent with the existing code. It's correctly placed among other lock-related messages.

Consider adding a brief description to provide context for translators:

 lockListDescription: {
   id: 'admin-portal.signature-collection:lockListDescription',
   defaultMessage:
     'Ýtið hér ef framboð hefur skilað inn framboðsgögnum fyrir lok framboðsfrest',
-  description: '',
+  description: 'Prompt to lock the list when nomination papers are submitted before the deadline',
 },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ef14e1c and 41f5580.

📒 Files selected for processing (4)
  • libs/portals/admin/signature-collection/src/lib/messages.ts (1 hunks)
  • libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx (1 hunks)
  • libs/service-portal/signature-collection/src/lib/messages.ts (1 hunks)
  • libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.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/shared-components/completeReview/lockList/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/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."
🔇 Additional comments (1)
libs/portals/admin/signature-collection/src/shared-components/completeReview/lockList/index.tsx (1)

59-59: LGTM! Consider verifying consistency across the application.

The change from m.lockList to m.lockListDescription appears to provide a more detailed description in the modal, which likely improves user experience. This modification aligns with the coding guidelines and doesn't affect the component's reusability or structure.

To ensure consistency, please verify that this new message key is used appropriately in other parts of the application where a detailed lock list description is needed. Run the following script to check for other occurrences:

This will help ensure that the new lockListDescription message is used consistently and that there are no leftover uses of lockList that should be updated.

✅ Verification successful

LGTM! The change correctly updates the message key to lockListDescription in the specified file without affecting other parts of the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of lockList and lockListDescription message keys

# Search for lockList message key
echo "Occurrences of lockList message key:"
rg --type typescript "m\.lockList[^D]" ./libs

# Search for lockListDescription message key
echo "Occurrences of lockListDescription message key:"
rg --type typescript "m\.lockListDescription" ./libs

Length of output: 360


Script:

#!/bin/bash
# Description: Check for occurrences of lockList and lockListDescription message keys in TypeScript files

# Search for lockList message key, excluding lockListDescription
echo "Occurrences of lockList message key (excluding lockListDescription):"
rg --glob '*.ts' --glob '*.tsx' "m\.lockList(?!Description)" ./libs

# Search for lockListDescription message key
echo "Occurrences of lockListDescription message key:"
rg --glob '*.ts' --glob '*.tsx' "m\.lockListDescription" ./libs

Length of output: 788


Script:

#!/bin/bash
# Description: Check for occurrences of 'm.lockList' excluding 'm.lockListDescription' in TypeScript files

# Search for 'm.lockList' message key excluding 'lockListDescription'
echo "Occurrences of 'm.lockList' message key (excluding 'm.lockListDescription'):"
rg --glob '*.ts' --glob '*.tsx' "m\.lockList" ./libs | grep -v "m\.lockListDescription"

# Search for 'm.lockListDescription' message key
echo "Occurrences of 'm.lockListDescription' message key:"
rg --glob '*.ts' --glob '*.tsx' "m\.lockListDescription" ./libs

Length of output: 2050

@kodiakhq kodiakhq bot merged commit 3e13aff into main Oct 14, 2024
45 checks passed
@kodiakhq kodiakhq bot deleted the fix-sc-listsubmitted branch October 14, 2024 14:20
kksteini pushed a commit that referenced this pull request Oct 16, 2024
* 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 <builders@andes.is>
kodiakhq bot added a commit that referenced this pull request Oct 16, 2024
* 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 <builders@andes.is>
Co-authored-by: Ásdís Erna Guðmundsdóttir <disa.erna@gmail.com>

* 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 <builders@andes.is>

* 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 <builders@andes.is>
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 <builders@andes.is>
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 <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

Co-authored-by: albinagu <47886428+albinagu@users.noreply.github.com>
Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: Ásdís Erna Guðmundsdóttir <disa.erna@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: juni-haukur <158475136+juni-haukur@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[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