-
Notifications
You must be signed in to change notification settings - Fork 5
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: displaying locked amount button #1626
Conversation
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)
packages/extension-polkagate/src/fullscreen/governance/delegate/partial/AmountWithOptionsAndLockAmount.tsx (2)
106-106
: LGTM! The conditional rendering addresses the issue effectively.The implementation correctly hides the locked amount button when there's no locked amount available, directly addressing the issue from #1559. The null checks and conditional logic are properly implemented.
Consider extracting the condition to a descriptive variable for improved readability:
- onSecondary={lockedAmount && !lockedAmount?.isZero() ? onLockedAmount : undefined} + const hasLockedAmount = lockedAmount && !lockedAmount?.isZero(); + onSecondary={hasLockedAmount ? onLockedAmount : undefined}
Line range hint
1-120
: Component architecture aligns well with the change.The component's structure effectively supports the conditional rendering of the locked amount button:
- The VotingInformation subcomponent already implements similar conditional rendering for locked amount display
- The Props interface properly types all required properties
- The memoization of alreadyLockedTooltipText helps with performance
Consider extracting the locked amount visibility logic into a custom hook if this condition needs to be reused elsewhere in the application.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
packages/extension-polkagate/src/fullscreen/governance/delegate/partial/AmountWithOptionsAndLockAmount.tsx
(1 hunks)
WalkthroughThe changes focus on the Changes
Assessment against linked issues
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 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
CodeRabbit Configuration File (
|
7381a84
to
0fd9de8
Compare
## [0.21.6](v0.21.5...v0.21.6) (2024-11-03) ### Bug Fixes * displaying locked amount button ([#1626](#1626)) ([dbc15f0](dbc15f0))
Close: #1559
Summary by CodeRabbit
New Features
AmountWithOptions
component to conditionally enable the secondary action based on the presence of a valid locked amount.Bug Fixes
onSecondary
prop to ensure it only activates when there is a locked amount available.Improvements
AlreadyLockedTooltipText
component for better readability while maintaining existing functionality.