-
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-collection): refetch is owner 16.10 #16432
Conversation
WalkthroughThis pull request introduces new message definitions for cancellation prompts in the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 0
🧹 Outside diff range and nitpick comments (4)
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (2)
19-19
: LGTM! Consider adding a type annotation for improved clarity.The addition of
refetchIsOwner
from theuseIsOwner
hook is a good improvement, allowing for dynamic refreshing of the owner status. This change aligns well with the component's functionality and the overall structure of the file.For better type safety and code readability, consider adding a type annotation to the destructured object:
const { isOwner, loadingIsOwner, refetchIsOwner }: { isOwner: boolean; loadingIsOwner: boolean; refetchIsOwner: () => void } = useIsOwner()This change would further adhere to the TypeScript usage guideline for the
libs
directory.
Line range hint
1-62
: Overall, the changes look good and improve the component's functionality.The modifications to the
SignatureListsParliamentary
component enhance its ability to refresh the owner status dynamically. The changes are minimal, focused, and adhere to the coding guidelines for thelibs
directory. They maintain the component's reusability across different NextJS apps and make good use of TypeScript for prop definitions.Key improvements:
- Addition of
refetchIsOwner
from theuseIsOwner
hook.- Passing
refetchIsOwner
to theOwnerView
component.These changes allow for more dynamic interaction with the ownership status, potentially improving the user experience.
Consider documenting the purpose and usage of the
refetchIsOwner
function in a comment or in the component's documentation to help other developers understand its role in the component's lifecycle and when it should be called.libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (1)
151-157
: Improved UX with context-sensitive messaging, but fix indentationThe conditional logic for the
description
prop enhances the user experience by providing more relevant messaging based on the number of lists. This is a good improvement.However, the indentation of this block is inconsistent with the surrounding code. Consider adjusting it for better readability:
description={ - listsForOwner.length === 1 - ? formatMessage( - m.cancelCollectionModalMessageLastList, - ) - : formatMessage(m.cancelCollectionModalMessage) + listsForOwner.length === 1 + ? formatMessage(m.cancelCollectionModalMessageLastList) + : formatMessage(m.cancelCollectionModalMessage) }This change will align the code with the project's formatting standards and improve readability.
libs/service-portal/signature-collection/src/lib/messages.ts (1)
204-208
: Consider adding a space in "of" to "og" in the button text.The new message
cancelCollectionModalConfirmButtonLastList
provides a clear confirmation button label. However, there's a small typo in the Icelandic text.Please consider applying this change:
- defaultMessage: 'Já, hætta við söfnun of eyða framboði', + defaultMessage: 'Já, hætta við söfnun og eyða framboði',
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (4)
- libs/service-portal/signature-collection/src/lib/messages.ts (1 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (4 hunks)
- libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (2 hunks)
- libs/service-portal/signature-collection/src/screens/shared/SignedList/index.tsx (0 hunks)
💤 Files with no reviewable changes (1)
- libs/service-portal/signature-collection/src/screens/shared/SignedList/index.tsx
🧰 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 (6)
libs/service-portal/signature-collection/src/screens/Parliamentary/index.tsx (1)
37-37
: LGTM! Verify theOwnerView
component implementation.The addition of the
refetchIsOwner
prop to theOwnerView
component is a good improvement, allowing for dynamic refreshing of the owner status from within the child component.To ensure the
OwnerView
component is correctly implementing this new prop, please run the following verification script:This script will help verify that the
OwnerView
component is correctly defined with therefetchIsOwner
prop and that it's being used within the component.libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (3)
36-36
: LGTM: New prop enhances component reusabilityThe addition of the
refetchIsOwner
prop is a good improvement. It allows the parent component to control when to refresh the owner status, enhancing the reusability of this component across different contexts in the application.The TypeScript type definition is correct, following best practices for prop typing.
Also applies to: 41-41
59-59
: LGTM: Proper usage of new prop ensures state consistencyThe
refetchIsOwner
function is correctly called in theonCompleted
callback of thecancelCollection
mutation. This ensures that the owner status is refreshed only after a successful cancellation, maintaining consistency between this component and its parent.This change improves the overall reliability of the application's state management.
174-176
: LGTM: Consistent improvement in UX for button textThe conditional logic for the
buttonTextConfirm
prop is a good addition, providing context-sensitive button text based on the number of lists. This change is consistent with the earlier modification to thedescription
prop, further enhancing the user experience.The use of
formatMessage
for internationalization and the correct indentation contribute to maintainable and readable code.libs/service-portal/signature-collection/src/lib/messages.ts (2)
193-208
: Overall, the new messages enhance the user interface and follow best practices.The added messages provide clear and detailed information about canceling the last collection and deleting the candidacy. They adhere to the coding guidelines for the
libs/**/*
pattern, use TypeScript effectively, and support reusability across different NextJS apps. The file structure also supports effective tree-shaking and bundling practices.
193-198
: LGTM! Clear and informative message for canceling the last collection.The new message
cancelCollectionModalMessageLastList
provides a detailed explanation of the consequences of canceling the last collection. It effectively warns the user about losing collected endorsements and deleting the candidacy.To ensure consistency across the codebase, let's check if similar warning messages exist for other critical actions:
✅ Verification successful
Verified! The new message
cancelCollectionModalMessageLastList
is consistent with existing warning messages across the codebase, ensuring uniform user experience.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for similar warning messages in other files rg --type typescript "Þú ert að fara að" -g '!**/messages.ts'Length of output: 98
Script:
#!/bin/bash # Search for similar warning messages in other TypeScript files rg "Þú ert að fara að" -g '*.ts' -g '!**/messages.ts'Length of output: 2660
Datadog ReportAll test runs ✅ 4 Total Test Services: 0 Failed, 4 Passed Test Services
🔻 Code Coverage Decreases vs Default Branch (1)
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16432 +/- ##
=======================================
Coverage 36.72% 36.72%
=======================================
Files 6809 6809
Lines 141179 141187 +8
Branches 40248 40255 +7
=======================================
+ Hits 51846 51854 +8
Misses 89333 89333
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: 0
🧹 Outside diff range and nitpick comments (2)
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (2)
81-87
: LGTM: Simplified rendering of SignedList component.The removal of the loading skeleton for the
SignedList
component aligns with the AI summary and simplifies the rendering logic. This change can improve performance and readability.Consider adding a comment explaining why the loading state is no longer needed for the
SignedList
component, to improve code maintainability:+// Loading state is handled internally by SignedList component <SignedList currentCollection={currentCollection} />
154-160
: LGTM: Improved context-aware messaging in DialogPrompt.The conditional rendering for
description
andbuttonTextConfirm
properties in theDialogPrompt
component enhances the user experience by providing more specific messages based on the number of lists. This aligns with the goal of improving context-aware messaging.To improve readability, consider extracting the conditional logic into separate variables:
const description = listsForOwner.length === 1 ? formatMessage(m.cancelCollectionModalMessageLastList) : formatMessage(m.cancelCollectionModalMessage); const buttonTextConfirm = formatMessage( listsForOwner.length === 1 ? m.cancelCollectionModalConfirmButtonLastList : m.cancelCollectionModalConfirmButton ); // Then use these variables in the DialogPrompt component <DialogPrompt // ...other props description={description} buttonTextConfirm={buttonTextConfirm} // ... />This approach separates the logic from the JSX, making it easier to read and maintain.
Also applies to: 177-179
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (5 hunks)
- libs/service-portal/signature-collection/src/screens/shared/SignedList/index.tsx (0 hunks)
💤 Files with no reviewable changes (1)
- libs/service-portal/signature-collection/src/screens/shared/SignedList/index.tsx
🧰 Additional context used
📓 Path-based instructions (1)
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 (2)
libs/service-portal/signature-collection/src/screens/Parliamentary/OwnerView/index.tsx (2)
59-59
: LGTM: Correct usage ofrefetchIsOwner
.The
refetchIsOwner
function is correctly called in theonCompleted
callback of thecancelCollection
mutation. This ensures that the owner status is refreshed after successfully canceling a collection, which aligns with the intended functionality.
36-36
: LGTM: New proprefetchIsOwner
added correctly.The addition of the
refetchIsOwner
prop is well-implemented and typed correctly. It adheres to TypeScript conventions and follows the coding guidelines for reusable components in thelibs
directory.Let's verify the usage of this new prop:
Also applies to: 41-41
✅ Verification successful
Verification Successful: No additional usages of
refetchIsOwner
found.The new
refetchIsOwner
prop is not used outside theOwnerView
component, ensuring that the changes are correctly localized and pose no issues.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new `refetchIsOwner` prop in other components. # Test: Search for components that use OwnerView and pass the refetchIsOwner prop. rg --type typescript 'OwnerView.*refetchIsOwner'Length of output: 85
Script:
#!/bin/bash # Description: Verify the usage of the new `refetchIsOwner` prop in other components. # Test: Search for `.tsx` files that use OwnerView and pass the refetchIsOwner prop. rg --type tsx 'OwnerView.*refetchIsOwner'Length of output: 71
Script:
#!/bin/bash # Description: Verify the usage of the new `refetchIsOwner` prop in other components. # Test: Search for `.tsx` files that use OwnerView and pass the refetchIsOwner prop. rg 'OwnerView.*refetchIsOwner' --glob '*.tsx'Length of output: 47
* fix(signature-collection): refetch is owner after remove last list * tw * tweak * tw * tw --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* fix(application-plc): Detect user delegation type (#16429) * wip * wip * Small fixes * Conditioned * Fixed messages * Fixed conditionals * feat(signature-collection): user not found handling (#16431) * feat(signature=collection): user not found handling * fix: text update * 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): refetch is owner 16.10 (#16432) * fix(signature-collection): refetch is owner after remove last list * tw * tweak * tw * tw --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --------- Co-authored-by: Alex Diljar Birkisbur Hellsing <42963845+alexdiljar@users.noreply.github.com> 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>
Checklist:
Summary by CodeRabbit
New Features
Enhancements
OwnerView
component to refresh owner status after cancellation.DialogPrompt
based on the number of lists.Refactor
SignedList
component by removing the loading skeleton.