-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix account balance on network change (#1431)
Co-authored-by: sergey filyanin <[email protected]>
- Loading branch information
1 parent
f4524a8
commit cc22fd1
Showing
72 changed files
with
1,553 additions
and
4,109 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains 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,17 @@ | ||
import { Entries } from '@/shared/types'; | ||
|
||
import PolkadotSVG from './assets/polkadot.svg?react'; | ||
import SubwalletSVG from './assets/subwallet.svg?react'; | ||
import TalismanSVG from './assets/talisman.svg?react'; | ||
import EnkryptSVG from './assets/enkrypt.svg?react'; | ||
|
||
const WALLET = { | ||
'polkadot-js': { name: 'Polkadot JS', SVG: PolkadotSVG }, | ||
'subwallet-js': { name: 'SubWallet', SVG: SubwalletSVG }, | ||
talisman: { name: 'Talisman', SVG: TalismanSVG }, | ||
enkrypt: { name: 'Enkrypt', SVG: EnkryptSVG }, | ||
}; | ||
|
||
const WALLETS = Object.entries(WALLET) as Entries<typeof WALLET>; | ||
|
||
export { WALLET, WALLETS }; |
This file contains 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,21 @@ | ||
import { useAccount } from '@gear-js/react-hooks'; | ||
import { useState } from 'react'; | ||
|
||
import { WALLET } from '../consts'; | ||
import { WalletId } from '../types'; | ||
|
||
function useWallet() { | ||
const { account, accounts } = useAccount(); | ||
|
||
const [walletId, setWalletId] = useState(account?.meta.source as WalletId | undefined); | ||
const wallet = walletId ? WALLET[walletId] : undefined; | ||
|
||
const getWalletAccounts = (id: WalletId) => accounts?.filter(({ meta }) => meta.source === id); | ||
const walletAccounts = walletId ? getWalletAccounts(walletId) : undefined; | ||
|
||
const resetWalletId = () => setWalletId(undefined); | ||
|
||
return { wallet, walletAccounts, setWalletId, resetWalletId, getWalletAccounts }; | ||
} | ||
|
||
export { useWallet }; |
This file contains 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,3 @@ | ||
import { Wallet } from './ui'; | ||
|
||
export { Wallet }; |
File renamed without changes.
File renamed without changes.
This file contains 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 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,3 @@ | ||
import { AccountButton } from './account-button'; | ||
|
||
export { AccountButton }; |
129 changes: 129 additions & 0 deletions
129
idea/frontend/src/features/wallet/ui/accounts-modal/accounts-modal.module.scss
This file contains 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,129 @@ | ||
@use '@gear-js/ui/breakpoints' as *; | ||
@use '@gear-js/ui/variables' as ui; | ||
@use '@gear-js/ui/headings' as *; | ||
@use '@/shared/assets/styles/variables' as *; | ||
@use '@/shared/assets/styles/mixins' as *; | ||
|
||
.simplebar { | ||
@include customSimplebar; | ||
max-height: 50vh; | ||
margin-right: -16px; | ||
|
||
:global(.simplebar-content) { | ||
margin-right: 16px; | ||
} | ||
} | ||
|
||
.modal { | ||
position: relative; | ||
|
||
&:not(.empty) { | ||
padding-bottom: 102px; | ||
} | ||
} | ||
|
||
.footer { | ||
position: absolute; // workaround cuz footer has different bg color | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
padding: 24px 32px; | ||
border-radius: 0 0 $borderRadiusMedium $borderRadiusMedium; | ||
display: flex; | ||
background-color: $bgColor4; | ||
} | ||
|
||
.logoutButton { | ||
margin-left: auto; | ||
} | ||
|
||
.list { | ||
@include childrenMargin(16px); | ||
|
||
.accountButton { | ||
width: 100%; | ||
font-weight: 500; | ||
text-transform: uppercase; | ||
padding: 16px 40px; | ||
|
||
&.active { | ||
background: $successColor; | ||
} | ||
} | ||
|
||
.accountName { | ||
font-size: $fontSizeMedium; | ||
padding: 0 5px; | ||
} | ||
|
||
.accountIcon { | ||
@include md { | ||
display: none !important; | ||
} | ||
} | ||
} | ||
|
||
.accountItem { | ||
@include childrenMargin(10px, right); | ||
|
||
display: flex; | ||
align-items: center; | ||
|
||
.accountButton { | ||
flex: 1 1; | ||
|
||
&.active { | ||
cursor: default; | ||
background-color: $successColor; | ||
|
||
&:hover { | ||
background-color: $successColor; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.button { | ||
display: flex; | ||
justify-content: space-between; | ||
background-color: ui.$buttonColorLight; | ||
letter-spacing: 0.08em; | ||
|
||
span { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
&:hover { | ||
background-color: ui.$buttonColorLightHover; | ||
} | ||
|
||
&:not(.enabled) { | ||
pointer-events: none; | ||
|
||
.status { | ||
opacity: 0.6; | ||
} | ||
} | ||
|
||
.status { | ||
text-align: right; | ||
|
||
&Text { | ||
font-size: 12px; | ||
line-height: 14px; | ||
} | ||
|
||
&Accounts { | ||
font-size: 10px; | ||
line-height: 10px; | ||
color: $successColor; | ||
} | ||
} | ||
|
||
.connectIcon { | ||
width: 12px; | ||
height: 12px; | ||
margin-left: 7px; | ||
} | ||
} |
Oops, something went wrong.