-
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
style: adjust divider colors #1606
Conversation
WalkthroughThe changes in this pull request primarily focus on modifying the visual styling of various components within the PolkaGate extension, specifically altering the background color of Changes
Possibly related PRs
Suggested reviewers
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 (
|
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/popup/staking/pool/index.tsx (2)
98-104
: Consider implementing proper error handlingWhile the optional chaining is good, logging errors to console in production code might not be sufficient. Consider implementing proper error handling to manage API failures gracefully.
- }).catch(console.error); + }).catch((error: Error) => { + // TODO: Handle API errors appropriately + console.warn('Failed to fetch session progress:', error.message); + });
108-110
: Consider implementing proper error handlingSimilar to the previous useEffect, consider implementing proper error handling for API failures.
- }).catch(console.error); + }).catch((error: Error) => { + // TODO: Handle API errors appropriately + console.warn('Failed to fetch current era:', error.message); + });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (8)
- packages/extension-polkagate/src/popup/account/LabelBalancePrice.tsx (1 hunks)
- packages/extension-polkagate/src/popup/account/index.tsx (1 hunks)
- packages/extension-polkagate/src/popup/account/unlock/LockedInReferenda.tsx (1 hunks)
- packages/extension-polkagate/src/popup/home/AiBackgroundImage.tsx (1 hunks)
- packages/extension-polkagate/src/popup/staking/pool/Info.tsx (3 hunks)
- packages/extension-polkagate/src/popup/staking/pool/index.tsx (4 hunks)
- packages/extension-polkagate/src/popup/staking/solo/Info.tsx (2 hunks)
- packages/extension-polkagate/src/popup/staking/solo/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (6)
- packages/extension-polkagate/src/popup/account/LabelBalancePrice.tsx
- packages/extension-polkagate/src/popup/account/index.tsx
- packages/extension-polkagate/src/popup/account/unlock/LockedInReferenda.tsx
- packages/extension-polkagate/src/popup/home/AiBackgroundImage.tsx
- packages/extension-polkagate/src/popup/staking/solo/Info.tsx
- packages/extension-polkagate/src/popup/staking/solo/index.tsx
🔇 Additional comments (6)
packages/extension-polkagate/src/popup/staking/pool/Info.tsx (3)
26-26
: LGTM! Function signature formatting is consistent with modern conventions.
34-34
: Type expansion looks good and is properly handled.The expanded type acceptance (
BN | string | number | undefined
) is well-implemented with appropriate type checking in the render logic.
50-50
: Good use of Material-UI's semantic color system.Using
divider
instead of a specific color value is more maintainable and better aligns with Material-UI's theming system. This change will automatically adapt to theme changes and dark/light mode switches.Also applies to: 70-70
packages/extension-polkagate/src/popup/staking/pool/index.tsx (3)
74-74
: LGTM! Improved null safety with optional chainingThe simplified condition using optional chaining is a better approach for checking pool date existence.
220-220
: LGTM! Improved type flexibilityThe consolidated type declaration for Row component props improves readability and type flexibility.
275-275
: LGTM! Improved color semanticsUsing MUI's semantic color 'divider' instead of 'secondary.main' is more appropriate and promotes UI consistency.
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: 1
🧹 Outside diff range and nitpick comments (1)
packages/extension-polkagate/src/fullscreen/sendFund/Review.tsx (1)
83-83
: LGTM! Consider enhancing error handling.The undefined value protection is a good addition. However, consider adding debug logging when undefined values are encountered to help troubleshoot issues in production.
Consider this enhancement:
- balance={inputs?.amount && balances?.decimal ? amountToMachine(inputs.amount, balances?.decimal) : undefined } + balance={inputs?.amount && balances?.decimal + ? amountToMachine(inputs.amount, balances?.decimal) + : (() => { + console.debug('SendFund/Review: Undefined values detected', { + amount: inputs?.amount, + decimal: balances?.decimal + }); + return undefined; + })() + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- packages/extension-polkagate/src/components/FormatBalance2.tsx (3 hunks)
- packages/extension-polkagate/src/components/ShowBalance.tsx (2 hunks)
- packages/extension-polkagate/src/fullscreen/accountDetails/components/LockedInReferendaFS.tsx (1 hunks)
- packages/extension-polkagate/src/fullscreen/governance/post/myVote/index.tsx (3 hunks)
- packages/extension-polkagate/src/fullscreen/sendFund/Review.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/extension-polkagate/src/components/FormatBalance2.tsx
🔇 Additional comments (7)
packages/extension-polkagate/src/components/ShowBalance.tsx (3)
9-9
: LGTM! Improved import efficiency.Changed to type-only import which is the correct approach as
ApiPromise
is only used for type annotations.
21-21
: LGTM! Improved type safety for balance handling.Removing the
number
type from balance is a good practice as it prevents potential precision loss when dealing with large blockchain amounts. UsingBN
,string
, orBalance
types ensures precise handling of balance values.
31-31
: LGTM! Better parameter organization.The reordering of parameters provides a more logical grouping while maintaining the same functionality. The spacing and alignment have also been improved for better readability.
packages/extension-polkagate/src/fullscreen/governance/post/myVote/index.tsx (2)
6-6
: LGTM: BN type import is correctly placed and necessary.The addition of the BN type import is required for the type assertion used with ShowBalance component.
14-14
: LGTM: Hook consolidation improves code organization.The consolidation of multiple hooks into useInfo reduces import clutter while maintaining the required functionality.
Let's verify that the useInfo hook properly implements all required functionality:
✅ Verification successful
Hook consolidation is correctly implemented
The useInfo hook provides all the required functionality for this component. From the implementation and usage:
- The component only needs
api
,decimal
, andtoken
from useInfo- The useInfo hook correctly provides these values by composing multiple hooks including useApi, useDecimal, and useToken
- The hook consolidation improves code organization without losing any functionality
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the useInfo hook implementation ast-grep --pattern 'export function useInfo($_) { $$$ return { api, decimal, token } $$$ }'Length of output: 99
Script:
#!/bin/bash # Let's first locate the useInfo hook definition fd "useInfo" --type f # Then examine its implementation and exports rg "export.*useInfo" -A 10Length of output: 2245
Script:
#!/bin/bash # Let's check the file that's using these hooks to understand what functionality it needs cat "packages/extension-polkagate/src/fullscreen/governance/post/myVote/index.tsx"Length of output: 4674
packages/extension-polkagate/src/fullscreen/accountDetails/components/LockedInReferendaFS.tsx (2)
91-91
: LGTM: Appropriate conditional margin adjustmentThe conditional margin-top addition helps maintain consistent vertical alignment when no locked amount is present.
89-89
: LGTM: Improved theme consistencyUsing the MUI theme token 'divider' instead of 'secondary.main' follows better theming practices and ensures consistent divider styling across the application.
@@ -65,7 +64,7 @@ export default function MyVote ({ address, isFinished, notVoted, vote }: Props): | |||
: <Grid alignItems='center' container item justifyContent='space-between' sx={{ pt: '20px', px: '10%' }}> | |||
<Grid container item xs={8}> | |||
<Grid item sx={{ fontSize: '20px', fontWeight: 500 }}> | |||
<ShowBalance api={api} balance={voteBalance} decimal={decimal} decimalPoint={1} token={token} /> | |||
<ShowBalance api={api} balance={voteBalance as unknown as BN} decimal={decimal} decimalPoint={1} token={token} /> |
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.
Consider improving type safety instead of using double type assertion.
The current approach uses a double type assertion (as unknown as BN
) which bypasses TypeScript's type checking. This could mask potential type-related issues.
Consider one of these alternatives:
- <ShowBalance api={api} balance={voteBalance as unknown as BN} decimal={decimal} decimalPoint={1} token={token} />
+ <ShowBalance api={api} balance={new BN(voteBalance || 0)} decimal={decimal} decimalPoint={1} token={token} />
Or update the ShowBalance component to handle multiple types:
interface ShowBalanceProps {
balance: BN | string | number | null | undefined;
// ... other props
}
Summary by CodeRabbit
Release Notes
New Features
Row
component to accept a broader range of value types.Bug Fixes
balance
prop in theReview
component to enhance robustness.Style