-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(ui): reward pill update #1531
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes update the management of blockchain visualization state and its presentation in the wallet component. A variable tracking the count has been renamed from "recapCount" to "rewardCount," along with its setter function. Simultaneously, the state store is updated to include an optional "rewardCount" property and a corresponding "setRewardCount" method. The win handling logic now increments the reward count instead of the recap count, while the overall control flow and functionality remain consistent. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant W as Wallet Component
participant S as Blockchain Store
U->>W: Trigger win event
W->>S: Execute handleWin()
S->>S: Increment rewardCount
S-->>W: Return updated state
W-->>U: Render updated reward count
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 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
🧹 Nitpick comments (1)
src/store/useBlockchainVisualisationStore.ts (1)
64-64
: Consider using nullish coalescing for better readability.The increment logic is correct and properly placed before the animation check, ensuring all wins are counted. However, the fallback logic could be more readable.
- useBlockchainVisualisationStore.setState((curr) => ({ rewardCount: (curr.rewardCount || 0) + 1 })); + useBlockchainVisualisationStore.setState((curr) => ({ rewardCount: (curr.rewardCount ?? 0) + 1 }));
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/containers/main/SideBar/components/Wallet/Wallet.tsx
(3 hunks)src/store/useBlockchainVisualisationStore.ts
(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: tauri-build
🔇 Additional comments (6)
src/store/useBlockchainVisualisationStore.ts (2)
23-23
: LGTM!The
rewardCount
property is correctly typed as an optional number, aligning with the PR objective to track all wins, including missed ones.
33-33
: LGTM!The
setRewardCount
method signature is consistent with the state property type and follows the existing pattern.src/containers/main/SideBar/components/Wallet/Wallet.tsx (4)
32-33
: LGTM!The hooks correctly access the store's state and actions for reward count management.
43-43
: LGTM!The reward count is correctly reset when showing history, and the
useCallback
dependencies are properly updated.Also applies to: 47-47
53-53
: LGTM!The condition for showing the count is comprehensive and correctly handles all edge cases.
72-72
: LGTM!The reward count is correctly displayed in the badge when conditions are met.
@@ -40,17 +40,17 @@ export default function Wallet() { | |||
} | |||
if (transactions.length || is_reward_history_loading) { | |||
// Question(A): Not sure what this was for | |||
setRecapCount(undefined); | |||
setRewardCount(undefined); |
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.
We could clear the reward count after opening the history. It looks like it's cleared too early
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.
Description
rewardCount
counter for all wins (incl. missed)Motivation and Context
How Has This Been Tested?
Screen.Recording.2025-02-17.mov
What process can a PR reviewer use to test or verify this change?
Summary by CodeRabbit