Skip to content

Commit

Permalink
fix(@wallet): warnings from wallet
Browse files Browse the repository at this point in the history
fixes #10086
  • Loading branch information
alaibe committed Apr 4, 2023
1 parent bef6092 commit ef4ffce
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/backend/transactions.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json, stint, chronicles, nimcrypto
import json, stint

import ../app_service/service/transaction/dto
import ../app_service/service/eth/dto/transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ StatusListItem {

signal openSendModal(string recipient)

implicitWidth: ListView.view.width
implicitWidth: ListView.view ? ListView.view.width : 0

title: name
objectName: name
Expand Down
1 change: 0 additions & 1 deletion ui/app/AppLayouts/Wallet/panels/WalletHeader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Item {
id: root

property var networkConnectionStore
property string currency: ""
property var currentAccount
property var store
property var walletStore
Expand Down
8 changes: 7 additions & 1 deletion ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,13 @@ Item {
id: smartContractAddress
Layout.alignment: detailsFlow.isOverflowing ? Qt.AlignLeft : Qt.AlignRight

image.source: token && token.builtOn !== "" ? Style.svg("tiny/" + RootStore.getNetworkIconUrl(token.builtOn)) : ""
image.source: {
if (!token || token.builtOn === "") {
return ""
}
let networkIconUrl = RootStore.getNetworkIconUrl(token.builtOn)
return networkIconUrl ? Style.svg("tiny/" + networkIconUrl) : ""
}
tagPrimaryLabel.text: token && token.builtOn !== "" ? RootStore.getNetworkName(token.builtOn) : "---"
tagSecondaryLabel.text: token.address ?? "---"
visible: typeof token != "undefined" && token && token.builtOn !== "" && token.address !== ""
Expand Down
1 change: 0 additions & 1 deletion ui/app/AppLayouts/Wallet/views/RightTabView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Item {
ColumnLayout {
WalletHeader {
Layout.fillWidth: true
currency: RootStore.currentCurrency
currentAccount: RootStore.currentAccount
store: root.store
walletStore: RootStore
Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Item {
readonly property string savedAddressNameFrom: root.isTransactionValid ? d.getNameForSavedWalletAddress(transaction.from): ""
readonly property string from: root.isTransactionValid ? !!savedAddressNameFrom ? savedAddressNameFrom : Utils.compactAddress(transaction.from, 4): ""
readonly property string to: root.isTransactionValid ? !!savedAddressNameTo ? savedAddressNameTo : Utils.compactAddress(transaction.to, 4): ""
readonly property string savedAddressEns: RootStore.getEnsForSavedWalletAddress(isIncoming ? transaction.from : transaction.to)
readonly property string savedAddressChains: RootStore.getChainShortNamesForSavedWalletAddress(isIncoming ? transaction.from : transaction.to)
readonly property string savedAddressEns: root.isTransactionValid ? RootStore.getEnsForSavedWalletAddress(isIncoming ? transaction.from : transaction.to) : ""
readonly property string savedAddressChains: root.isTransactionValid ? RootStore.getChainShortNamesForSavedWalletAddress(isIncoming ? transaction.from : transaction.to) : ""

function getNameForSavedWalletAddress(address) {
return RootStore.getNameForSavedWalletAddress(address)
Expand Down
30 changes: 18 additions & 12 deletions ui/imports/shared/controls/TokenDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ StatusListItem {
property alias change24HourPercentage: change24HourPercentageText

property string currentCurrencySymbol
property string textColor: modelData.changePct24hour === undefined ?
Theme.palette.baseColor1 :
modelData.changePct24hour === 0 ?
Theme.palette.baseColor1 :
modelData.changePct24hour < 0 ?
Theme.palette.dangerColor1 :
Theme.palette.successColor1
property string textColor: {
if (!modelData) {
return Theme.palette.successColor1
}
return modelData.changePct24hour === undefined ?
Theme.palette.baseColor1 :
modelData.changePct24hour === 0 ?
Theme.palette.baseColor1 :
modelData.changePct24hour < 0 ?
Theme.palette.dangerColor1 :
Theme.palette.successColor1
}

property string errorTooltipText_1
property string errorTooltipText_2

title: modelData.name
title: modelData ? modelData.name : ""
subTitle: LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance)
asset.name: modelData.symbol ? Style.png("tokens/" + modelData.symbol) : ""
asset.name: modelData && modelData.symbol ? Style.png("tokens/" + modelData.symbol) : ""
asset.isImage: true
errorIcon.tooltip.maxWidth: 300

Expand Down Expand Up @@ -64,7 +70,7 @@ StatusListItem {
id: localeCurrencyBalance
anchors.right: parent.right
font.pixelSize: 15
text: LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkCurrencyBalance)
text: modelData ? LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkCurrencyBalance) : ""
visible: !errorIcon.visible
}
Row {
Expand All @@ -75,7 +81,7 @@ StatusListItem {
id: change24HourText
font.pixelSize: 15
customColor: root.textColor
text: LocaleUtils.currencyAmountToLocaleString(modelData.currencyPrice)
text: modelData ? LocaleUtils.currencyAmountToLocaleString(modelData.currencyPrice) : ""
}
Rectangle {
width: 1
Expand All @@ -86,7 +92,7 @@ StatusListItem {
id: change24HourPercentageText
font.pixelSize: 15
customColor: root.textColor
text: modelData.changePct24hour !== "" ? "%1%".arg(LocaleUtils.numberToLocaleString(modelData.changePct24hour, 2)) : "---"
text: modelData && modelData.changePct24hour !== "" ? "%1%".arg(LocaleUtils.numberToLocaleString(modelData.changePct24hour, 2)) : "---"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions ui/imports/shared/views/AssetsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Item {
Component {
id: tokenDelegate
TokenDelegate {
objectName: "AssetView_TokenListItem_" + modelData.symbol
readonly property string balance: "%1".arg(modelData.enabledNetworkBalance.amount) // Needed for the tests
errorTooltipText_1: networkConnectionStore.getBlockchainNetworkDownTextForToken(modelData.balances)
objectName: "AssetView_TokenListItem_" + (modelData ? modelData.symbol : "")
readonly property string balance: modelData ? "%1".arg(modelData.enabledNetworkBalance.amount) : "" // Needed for the tests
errorTooltipText_1: modelData ? networkConnectionStore.getBlockchainNetworkDownTextForToken(modelData.balances) : ""
errorTooltipText_2: networkConnectionStore.getMarketNetworkDownText()
subTitle: networkConnectionStore.noTokenBalanceAvailable ? "" : LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance)
subTitle: !modelData || networkConnectionStore.noTokenBalanceAvailable ? "" : LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance)
errorMode: networkConnectionStore.noBlockchainConnectionAndNoCache && !networkConnectionStore.noMarketConnectionAndNoCache
errorIcon.tooltip.text: networkConnectionStore.noBlockchainConnectionAndNoCacheText
onClicked: {
Expand Down

0 comments on commit ef4ffce

Please sign in to comment.