-
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.
Feat: Wallet management icon (#3114)
- Loading branch information
Showing
24 changed files
with
311 additions
and
180 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
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
44 changes: 44 additions & 0 deletions
44
src/renderer/features/wallet-multisig/components/WalletRow.tsx
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,44 @@ | ||
import { useStoreMap, useUnit } from 'effector-react'; | ||
|
||
import { type Wallet } from '@/shared/core'; | ||
import { Slot, createSlot } from '@/shared/di'; | ||
import { WalletManagement } from '@/shared/ui-entities'; | ||
import { accounts as accountsDomainModel, accountsService } from '@/domains/network'; | ||
import { ChainIcon } from '@/entities/chain'; | ||
import { networkModel } from '@/entities/network'; | ||
import { walletsFiatBalanceFeature } from '@/features/wallet-fiat-balance'; | ||
|
||
const { | ||
views: { WalletFiatBalance }, | ||
} = walletsFiatBalanceFeature; | ||
|
||
export const walletActionsSlot = createSlot<{ wallet: Wallet }>(); | ||
|
||
type Props = { | ||
wallet: Wallet; | ||
onSelect: (wallet: Wallet) => unknown; | ||
}; | ||
export const WalletRow = ({ wallet, onSelect }: Props) => { | ||
const chains = useUnit(networkModel.$chains); | ||
|
||
const account = useStoreMap({ | ||
store: accountsDomainModel.$list, | ||
keys: [wallet.id], | ||
fn: (accounts, [walletId]) => { | ||
const match = accountsService.filterAccountsByWallet(accounts, walletId).at(0); | ||
|
||
return match && accountsService.isChainAccount(match) ? match : null; | ||
}, | ||
}); | ||
|
||
return ( | ||
<WalletManagement | ||
wallet={wallet} | ||
meta={account ? <ChainIcon src={chains[account.chainId].icon} size={16} /> : null} | ||
description={<WalletFiatBalance walletId={wallet.id} className="max-w-[215px] truncate text-help-text" />} | ||
onClick={() => onSelect(wallet)} | ||
> | ||
<Slot id={walletActionsSlot} props={{ wallet }} /> | ||
</WalletManagement> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { walletModel, walletUtils } from '@/entities/wallet'; | ||
|
||
export const $regularMultisig = walletModel.$wallets.map(list => list.filter(walletUtils.isRegularMultisig)); | ||
export const $flexibleMutisig = walletModel.$wallets.map(list => list.filter(walletUtils.isFlexibleMultisig)); | ||
export const $flexibleMultisig = walletModel.$wallets.map(list => list.filter(walletUtils.isFlexibleMultisig)); | ||
|
||
export const walletsModel = { | ||
$regularMultisig, | ||
$flexibleMutisig, | ||
$flexibleMultisig, | ||
}; |
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
Oops, something went wrong.