-
Notifications
You must be signed in to change notification settings - Fork 102
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: single wallet dashboard #2514
Merged
begonaalvarezd
merged 12 commits into
feat/single-account
from
feat/single-wallet-dashboard
Mar 11, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9d629f6
feat: adapt wallet balance ui
begonaalvarezd 51aa925
fix: select account wrong reactivity
begonaalvarezd 15c5083
fix: cleanup imports
begonaalvarezd 6b62944
feat: show send/receive views on click
begonaalvarezd 6ff41cb
feat: update tokens icons
begonaalvarezd 5eb58d5
feat: add my assets
begonaalvarezd 8c06941
feat: cleanup AccountTile
begonaalvarezd 6658c58
feat: remove comment
begonaalvarezd b0d0b2f
chore: merge remote-tracking branch 'origin/feat/single-account' into…
begonaalvarezd 9ec110c
fix: account actions modal remount
begonaalvarezd 54c897e
fix: delete account success leads to undefined selected account view
begonaalvarezd 876f6c8
chore: merge remote-tracking branch 'origin/feat/single-account' into…
begonaalvarezd 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,38 @@ | ||
<script lang="typescript"> | ||
import { Icon, Text } from 'shared/components' | ||
import { isBright } from 'shared/lib/helpers' | ||
import { Asset } from 'shared/lib/typings/assets' | ||
|
||
export let asset: Asset | ||
|
||
$: assetIconColor = isBright(asset?.color) ? 'gray-800' : 'white' | ||
</script> | ||
|
||
<div | ||
style="--asset-color: {asset?.color}" | ||
class="flex flex-row justify-between items-center space-x-2 bg-gray-50 dark:bg-gray-900 p-4 rounded-2xl" | ||
> | ||
<div class="flex flex-row items-center space-x-4"> | ||
<div class="icon h-8 w-8 rounded-full flex items-center justify-center p-1"> | ||
<Icon classes="text-{assetIconColor}" icon={asset?.name?.toLocaleLowerCase()} height="100%" width="100%" /> | ||
</div> | ||
<div class="flex flex-col flex-wrap space-y-1"> | ||
<Text classes="font-semibold">{asset?.name}</Text> | ||
{#if asset?.fiatPrice} | ||
<Text secondary smaller>{asset?.fiatPrice}</Text> | ||
{/if} | ||
</div> | ||
</div> | ||
<div class="flex flex-col flex-wrap space-y-1 text-right"> | ||
<Text classes="font-semibold">{asset?.balance}</Text> | ||
{#if asset?.fiatBalance} | ||
<Text secondary smaller>{`≈ ${asset?.fiatBalance}`}</Text> | ||
{/if} | ||
</div> | ||
</div> | ||
|
||
<style type="text/scss"> | ||
.icon { | ||
background-color: var(--asset-color); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Unit } from '@iota/unit-converter' | ||
import { convertToFiat, currencies, exchangeRates } from 'shared/lib/currency' | ||
import { formatStakingAirdropReward } from 'shared/lib/participation/staking' | ||
import { assemblyStakingRewards, shimmerStakingRewards } from 'shared/lib/participation/stores' | ||
import { activeProfile } from 'shared/lib/profile' | ||
import { Asset, Token } from 'shared/lib/typings/assets' | ||
import { AvailableExchangeRates, CurrencyTypes } from 'shared/lib/typings/currency' | ||
import { UNIT_MAP } from 'shared/lib/units' | ||
import { selectedAccount } from 'shared/lib/wallet' | ||
import { derived } from 'svelte/store' | ||
import { StakingAirdrop } from './participation/types' | ||
|
||
export const assets = derived( | ||
[exchangeRates, currencies, activeProfile, selectedAccount, assemblyStakingRewards, shimmerStakingRewards], | ||
([ | ||
$exchangeRates, | ||
$currencies, | ||
$activeProfile, | ||
$selectedAccount, | ||
$assemblyStakingRewards, | ||
$shimmerStakingRewards, | ||
]) => { | ||
if (!$activeProfile || !$selectedAccount) return [] | ||
const profileCurrency = $activeProfile?.settings.currency ?? AvailableExchangeRates.USD | ||
const assets: Asset[] = [ | ||
{ | ||
name: Token.IOTA, | ||
balance: $selectedAccount.balance, | ||
fiatPrice: `${convertToFiat( | ||
UNIT_MAP[Unit.Mi].val, | ||
$currencies[CurrencyTypes.USD], | ||
$exchangeRates[profileCurrency] | ||
)} ${profileCurrency}`, | ||
fiatBalance: $selectedAccount.balanceEquiv, | ||
color: '#6E82A4', | ||
}, | ||
] | ||
if ($assemblyStakingRewards) { | ||
assets.push({ | ||
name: Token.Assembly, | ||
balance: formatStakingAirdropReward(StakingAirdrop[Token.Assembly], Number($assemblyStakingRewards), 6), | ||
color: '#DCABE1', | ||
}) | ||
} | ||
if ($shimmerStakingRewards) { | ||
assets.push({ | ||
name: Token.Shimmer, | ||
balance: formatStakingAirdropReward(StakingAirdrop[Token.Shimmer], Number($shimmerStakingRewards), 6), | ||
color: '#25DFCA', | ||
}) | ||
} | ||
return assets | ||
} | ||
) |
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,13 @@ | ||
export enum Token { | ||
IOTA = 'IOTA', | ||
Assembly = 'Assembly', | ||
Shimmer = 'Shimmer', | ||
} | ||
|
||
export type Asset = { | ||
name: Token | string | ||
balance: string | ||
fiatPrice?: string | ||
fiatBalance?: string | ||
color?: string | ||
} |
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
43 changes: 0 additions & 43 deletions
43
packages/shared/routes/dashboard/wallet/views/AccountActions.svelte
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/shared/routes/dashboard/wallet/views/AccountAssets.svelte
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,16 @@ | ||
<script lang="typescript"> | ||
import { AssetTile, Text } from 'shared/components' | ||
import { assets } from 'shared/lib/assets' | ||
import { localize } from 'shared/lib/i18n' | ||
</script> | ||
|
||
<div class="w-full h-full space-y-6 flex flex-auto flex-col flex-shrink-0 p-6"> | ||
<Text classes="text-left" type="h5">{localize('general.myAssets')}</Text> | ||
<div | ||
class="w-full space-y-4 flex flex-auto flex-col overflow-y-auto h-1 space-y-2.5 -mr-2 pr-2 scroll-secondary scrollable-y" | ||
> | ||
{#each $assets as asset} | ||
<AssetTile {asset} /> | ||
{/each} | ||
</div> | ||
</div> |
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.
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.
Creating an account doesn't work properly for me. I did the following:
After this, the wallet doesn't show in the dropdown. It might be unrelated to this PR, so feel free to open a task about it and merge this. I just wanted to let you know 😄
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.
I cant click cancel while waiting, like...the button doesnt exist 😅 maybe im doing something wrong 🙈