-
Notifications
You must be signed in to change notification settings - Fork 12
fix(frontend)!: independent wallet store for each tool #610
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f19ee2a
fix: builder accordion rmv comp internal state
DarianM facc5d8
reset steps state after connect/disconnect wallet
DarianM 68c6694
Merge branch 'main' into reset_wallet_state
DarianM c2d9324
auto load profiles when wa already connected
DarianM 18b8bd5
Revert "auto load profiles when wa already connected"
DarianM a8edde2
Merge branch 'main' into auto_load_profiles_wa
DarianM 19bee43
Merge branch 'main' into auto_load_profiles_wa
DarianM b829ded
wallet-store: persist wallet logic
DarianM 032dbd1
lint
DarianM dacb6a4
move builStep back to toolStore, not part of wallet store
DarianM b964fdf
reset profile per tool only
DarianM af16ba7
rmv set grant response from proxy store as no use
DarianM 5ded607
hook nit
DarianM 14bc0c6
clear wallet storage
DarianM a343196
add load validation
DarianM bf8395a
nit clean
DarianM 68897b4
nit: type
DarianM 2de6c40
remove path dependency
DarianM 8684d25
just export as before
DarianM 2798499
change wallet storage key pattern
DarianM a42fc4c
throw is load from storage invalid; do not duplicate cleanup
DarianM 7c05b48
Merge branch 'main' into auto_load_profiles_wa
DarianM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
frontend/app/components/redesign/components/dialogs/GrantConfirmationDialog.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { useLocation } from 'react-router' | ||
| import { useSnapshot } from 'valtio' | ||
| import { TOOL_BANNER, TOOL_OFFERWALL, TOOL_WIDGET } from '@shared/types' | ||
| import { bannerWallet, bannerWalletActions } from '~/stores/banner-store' | ||
| import { | ||
| offerwallWallet, | ||
| offerwallWalletActions, | ||
| } from '~/stores/offerwall-store' | ||
| import type { WalletActions, WalletStore } from '~/stores/wallet-store' | ||
| import { widgetWallet, widgetWalletActions } from '~/stores/widget-store' | ||
|
|
||
| function getWalletStore(): [WalletStore, WalletActions] { | ||
| const { pathname } = useLocation() | ||
| const tool = pathname.split('/')[1] | ||
|
|
||
| switch (tool) { | ||
| case TOOL_WIDGET: | ||
| return [widgetWallet, widgetWalletActions] | ||
| case TOOL_OFFERWALL: | ||
| return [offerwallWallet, offerwallWalletActions] | ||
| case TOOL_BANNER: | ||
| return [bannerWallet, bannerWalletActions] | ||
|
|
||
| default: | ||
| throw new Error(`Unknown tool type: ${tool}`) | ||
| } | ||
| } | ||
|
|
||
| export function useToolWallet(options?: { | ||
| sync: boolean | ||
| }): [WalletStore, WalletActions] { | ||
| const [walletProxy, actions] = getWalletStore() | ||
| const snap = useSnapshot(walletProxy, options) | ||
| return [snap, actions] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.