fix(@wallet): send modal in browser/wallet

fixes #5937

The send modal reuse the asset list so it needs to be fully populated
with all token, but the token is only visible if the balance > 0
This commit is contained in:
Anthony Laibe 2022-05-31 10:32:09 +02:00 committed by Anthony Laibe
parent 07d36722f8
commit e7dff15a97
4 changed files with 8 additions and 10 deletions

View File

@ -41,8 +41,6 @@ method delete*(self: Module) =
proc setAssets(self: Module, tokens: seq[WalletTokenDto]) = proc setAssets(self: Module, tokens: seq[WalletTokenDto]) =
var items: seq[Item] var items: seq[Item]
for t in tokens: for t in tokens:
if(t.totalBalance.balance == 0):
continue
let item = token_item.initItem(t.name, t.symbol, t.totalBalance.balance, t.address, t.totalBalance.currencyBalance) let item = token_item.initItem(t.name, t.symbol, t.totalBalance.balance, t.address, t.totalBalance.currencyBalance)
items.add(item) items.add(item)

View File

@ -72,8 +72,6 @@ proc setAssetsAndBalance(self: Module, tokens: seq[WalletTokenDto]) =
var totalCurrencyBalanceForAllAssets = 0.0 var totalCurrencyBalanceForAllAssets = 0.0
var items: seq[Item] var items: seq[Item]
for t in tokens: for t in tokens:
if(t.totalBalance.balance == 0):
continue
let item = token_item.initItem(t.name, t.symbol, t.totalBalance.balance, t.address, t.totalBalance.currencyBalance) let item = token_item.initItem(t.name, t.symbol, t.totalBalance.balance, t.address, t.totalBalance.currencyBalance)
items.add(item) items.add(item)
totalCurrencyBalanceForAllAssets += t.totalBalance.currencyBalance totalCurrencyBalanceForAllAssets += t.totalBalance.currencyBalance

View File

@ -12,8 +12,11 @@ Item {
property string currency: "" property string currency: ""
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
height: 40 visible: balance > 0
height: visible ? 40 + 2 * Style.current.padding : 0
Image { Image {
id: assetInfoImage id: assetInfoImage
@ -41,8 +44,7 @@ Item {
StyledText { StyledText {
id: assetFullTokenName id: assetFullTokenName
text: name text: name
anchors.bottom: parent.bottom anchors.top: assetSymbol.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
color: Style.current.secondaryText color: Style.current.secondaryText
@ -51,6 +53,8 @@ Item {
StyledText { StyledText {
id: assetBalance id: assetBalance
text: Utils.toLocaleString(balance, locale) + " " + symbol.toUpperCase() text: Utils.toLocaleString(balance, locale) + " " + symbol.toUpperCase()
anchors.top: assetInfoImage.top
anchors.topMargin: 0
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0 anchors.rightMargin: 0
font.pixelSize: 15 font.pixelSize: 15
@ -62,8 +66,7 @@ Item {
text: Utils.toLocaleString(currencyBalance.toFixed(2), locale) + " " + assetDelegate.currency.toUpperCase() text: Utils.toLocaleString(currencyBalance.toFixed(2), locale) + " " + assetDelegate.currency.toUpperCase()
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.bottom: parent.bottom anchors.top: assetBalance.bottom
anchors.bottomMargin: 0
font.pixelSize: 15 font.pixelSize: 15
} }
} }

View File

@ -22,7 +22,6 @@ Item {
ListView { ListView {
id: assetListView id: assetListView
spacing: Style.current.padding * 2
anchors.fill: parent anchors.fill: parent
model: account.assets model: account.assets
delegate: AssetDelegate { delegate: AssetDelegate {