diff --git a/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml b/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml index d491a4c4ef2..6b6b05fc64a 100644 --- a/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml +++ b/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml @@ -49,6 +49,8 @@ QObject { property var enabledChainIds: [] property string accountAddress property bool showCommunityAssets + // Incase of SendModal we show SNT, ETH and DAI with 0 balance + property bool showZeroBalanceForDefaultTokens: false // output model readonly property SortFilterProxyModel outputAssetsModel: SortFilterProxyModel { @@ -111,7 +113,7 @@ QObject { id: tokensWithBalance filters: [ ValueFilter { - roleName: "currencyBalance" + roleName: "balancesModelCount" value: 0 inverted: true } @@ -154,6 +156,7 @@ QObject { : "" readonly property var balances: this + readonly property int balancesModelCount: delegateRoot.ModelCount.count sourceModel: joinModel @@ -185,6 +188,7 @@ QObject { roleName: "balance" value: "0" inverted: true + enabled: !root.showZeroBalanceForDefaultTokens }, RegExpFilter { roleName: "account" @@ -219,7 +223,7 @@ QObject { } } - exposedRoles: ["tokensKey", "balances", "currentBalance", "currencyBalance", "currencyBalanceAsString", "balanceAsString"] + exposedRoles: ["tokensKey", "balances", "currentBalance", "currencyBalance", "currencyBalanceAsString", "balanceAsString", "balancesModelCount"] expectedRoles: [ "tokensKey", "communityId", "balances", "decimals", "marketDetails"] } } diff --git a/ui/app/AppLayouts/Wallet/controls/TokenSelector.qml b/ui/app/AppLayouts/Wallet/controls/TokenSelector.qml index 28289ff3ba7..0b828dba3e4 100644 --- a/ui/app/AppLayouts/Wallet/controls/TokenSelector.qml +++ b/ui/app/AppLayouts/Wallet/controls/TokenSelector.qml @@ -22,6 +22,8 @@ Control { readonly property bool isTokenSelected: tokenSelectorButton.selected + property bool showSectionName: true + signal assetSelected(string key) signal collectionSelected(string key) signal collectibleSelected(string key) @@ -49,7 +51,7 @@ Control { QObject { id: d - readonly property int maxPopupHeight: 330 + readonly property int maxPopupHeight: 455 } contentItem: TokenSelectorButton { @@ -100,6 +102,8 @@ Control { dropdown.close() } + showSectionName: root.showSectionName + onAssetSelected: { const entry = ModelUtils.getByKey(assetsModel, "tokensKey", key) highlightedKey = key diff --git a/ui/app/AppLayouts/Wallet/panels/SearchableAssetsPanel.qml b/ui/app/AppLayouts/Wallet/panels/SearchableAssetsPanel.qml index 86a4f7e3268..3259fd01961 100644 --- a/ui/app/AppLayouts/Wallet/panels/SearchableAssetsPanel.qml +++ b/ui/app/AppLayouts/Wallet/panels/SearchableAssetsPanel.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts 1.15 import StatusQ 0.1 import StatusQ.Core 0.1 import StatusQ.Core.Utils 0.1 +import StatusQ.Core.Theme 0.1 import StatusQ.Popups.Dialog 0.1 import AppLayouts.Wallet.views 1.0 @@ -33,6 +34,7 @@ Control { property alias model: sfpm.sourceModel property string highlightedKey property string nonInteractiveKey + property bool showSectionName: true signal selected(string key) @@ -63,13 +65,23 @@ Control { contentItem: ColumnLayout { spacing: 0 + StatusBaseText { + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: 4 + text: qsTr("Your assets will appear here") + color: Theme.palette.baseColor1 + visible: !listView.count && !searchBox.text + } + TokenSearchBox { id: searchBox objectName: "searchBox" Layout.fillWidth: true - placeholderText: qsTr("Search assets") + placeholderText: qsTr("Search for token or enter token address") + + visible: listView.count || !!searchBox.text Keys.forwardTo: [listView] } @@ -100,6 +112,7 @@ Control { section.delegate: TokenSelectorSectionDelegate { width: ListView.view.width text: section + height: root.showSectionName ? implicitHeight : 0 } delegate: TokenSelectorAssetDelegate { diff --git a/ui/app/AppLayouts/Wallet/panels/SendModalHeader.qml b/ui/app/AppLayouts/Wallet/panels/SendModalHeader.qml index 3c7f1214ae4..43d6ca54e4b 100644 --- a/ui/app/AppLayouts/Wallet/panels/SendModalHeader.qml +++ b/ui/app/AppLayouts/Wallet/panels/SendModalHeader.qml @@ -113,6 +113,7 @@ RowLayout { TokenSelectorButton.Size.Normal enabled: root.interactive + showSectionName: false assetsModel: root.assetsModel collectiblesModel: root.displayOnlyAssets ? null: root.collectiblesModel diff --git a/ui/app/AppLayouts/Wallet/panels/TokenSelectorPanel.qml b/ui/app/AppLayouts/Wallet/panels/TokenSelectorPanel.qml index bcd4b56064e..67619c8f22d 100644 --- a/ui/app/AppLayouts/Wallet/panels/TokenSelectorPanel.qml +++ b/ui/app/AppLayouts/Wallet/panels/TokenSelectorPanel.qml @@ -2,6 +2,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 +import StatusQ.Popups.Dialog 0.1 import StatusQ.Controls 0.1 /** @@ -34,6 +35,8 @@ Control { // Index of the current tab, indexes ​​correspond to the Tabs enum values. property alias currentTab: tabBar.currentIndex + property bool showSectionName: true + signal assetSelected(string key) signal collectionSelected(string key) signal collectibleSelected(string key) @@ -46,6 +49,7 @@ Control { } contentItem: ColumnLayout { + spacing: 0 StatusTabBar { id: tabBar @@ -77,6 +81,11 @@ Control { } } + StatusDialogDivider { + Layout.topMargin: -9 + Layout.fillWidth: true + } + SearchableAssetsPanel { id: searchableAssetsPanel @@ -86,6 +95,7 @@ Control { Layout.fillHeight: true highlightedKey: root.highlightedKey + showSectionName: root.showSectionName onSelected: root.assetSelected(key) } diff --git a/ui/app/mainui/SendModalHandler.qml b/ui/app/mainui/SendModalHandler.qml index 2a923959372..dacbb6917b1 100644 --- a/ui/app/mainui/SendModalHandler.qml +++ b/ui/app/mainui/SendModalHandler.qml @@ -629,6 +629,7 @@ QtObject { currentCurrency: root.currentCurrency showCommunityAssets: root.showCommunityAssetsInSend + showZeroBalanceForDefaultTokens: true accountAddress: simpleSendModal.selectedAccountAddress enabledChainIds: [simpleSendModal.selectedChainId]