From 6df29da7b079aa52db3df0ae14661822a91c5a9f Mon Sep 17 00:00:00 2001 From: emizzle Date: Thu, 6 Aug 2020 12:33:30 +1000 Subject: [PATCH] fix: Remove walletModel reference from AccountSelector Remove all `walletModel` references from the `AccountSelector` component, as the component should not be aware of the API's existence. Pass currency to `AccountSelector` component. --- ui/app/AppLayouts/Wallet/components/SendModalContent.qml | 1 + ui/shared/AccountSelector.qml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/components/SendModalContent.qml b/ui/app/AppLayouts/Wallet/components/SendModalContent.qml index b4c3ac4618..d3b26837de 100644 --- a/ui/app/AppLayouts/Wallet/components/SendModalContent.qml +++ b/ui/app/AppLayouts/Wallet/components/SendModalContent.qml @@ -114,6 +114,7 @@ Item { AccountSelector { id: selectFromAccount accounts: walletModel.accounts + currency: walletModel.defaultCurrency anchors.top: selectAsset.bottom anchors.topMargin: Style.current.padding anchors.left: parent.left diff --git a/ui/shared/AccountSelector.qml b/ui/shared/AccountSelector.qml index 42256c1b67..9c8a36ab67 100644 --- a/ui/shared/AccountSelector.qml +++ b/ui/shared/AccountSelector.qml @@ -11,6 +11,7 @@ Item { property var selectedAccount: { "address": "", "name": "", "iconColor": "", "fiatBalance": "" } + property string currency: "usd" height: select.height + selectedAccountDetails.height // set to asset symbol to display asset's balance top right // NOTE: if this asset is not selected as a wallet token in the UI, then @@ -99,7 +100,7 @@ Item { color: Style.current.secondaryText } StyledText { - text: selectedAccount.fiatBalance + " " + walletModel.defaultCurrency.toUpperCase() + text: selectedAccount.fiatBalance + " " + root.currency.toUpperCase() font.pixelSize: 12 height: 16 color: Style.current.secondaryText @@ -175,7 +176,7 @@ Item { font.pixelSize: 15 height: 22 color: Style.current.secondaryText - text: walletModel.defaultCurrency.toUpperCase() + text: root.currency.toUpperCase() } background: Rectangle { color: itemContainer.highlighted ? Style.current.backgroundHover : Style.current.background