From 6e939352981b6e4813c2a8c1fbaac85ef91282df Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Wed, 17 Jul 2024 19:07:57 +0300 Subject: [PATCH] fix(Send): Fixing Send button text on wallet footer on owner collectibles details view Fixing a bug where the community name is not shown in the `Send` button Get the collectible community name from the community model for community tokens. Otherwise default to community id. + Fix WalletFooter layout when the buttons text exceeds the available width to squash: Fixing send on owner token - name --- ui/app/AppLayouts/Wallet/WalletLayout.qml | 21 ++++++++++++------- .../AppLayouts/Wallet/panels/WalletFooter.qml | 7 ++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index d37b0d24c6..d811efa1b6 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -2,6 +2,7 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 +import StatusQ 0.1 import StatusQ.Layout 0.1 import StatusQ.Core.Utils 0.1 as StatusQUtils @@ -285,14 +286,13 @@ Item { networkConnectionStore: root.networkConnectionStore isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible communityName: { - if (!walletStore.currentViewedCollectible) - return "" - const name = walletStore.currentViewedCollectible.communityName - const id = walletStore.currentViewedCollectible.communityId - if (name === id) - return Utils.compactAddress(id, 4) - return name + if (selectedCommunityForCollectible.available) + return selectedCommunityForCollectible.item.name + if (isCommunityCollectible) + return Utils.compactAddress(walletStore.currentViewedCollectible.communityId, 4) + return "" } + onLaunchShareAddressModal: Global.openShowQRPopup({ switchingAccounsEnabled: true, changingPreferredChainsEnabled: true, @@ -350,6 +350,13 @@ Item { d.swapFormData.defaultToTokenKey = RootStore.areTestNetworksEnabled ? Constants.swap.testStatusTokenKey : Constants.swap.mainnetStatusTokenKey Global.openSwapModalRequested(d.swapFormData) } + + ModelEntry { + id: selectedCommunityForCollectible + sourceModel: footer.isCommunityCollectible ? root.communitiesStore.communitiesList : null + key: "id" + value: footer.walletStore.currentViewedCollectible.communityId + } } } diff --git a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml index 21607d69ad..54a89a202b 100644 --- a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml +++ b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml @@ -1,6 +1,7 @@ import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Layouts 1.13 +import QtQml 2.15 import StatusQ 0.1 import StatusQ.Popups 0.1 @@ -48,6 +49,7 @@ Rectangle { Binding on collectibleOwnerAddress { when: d.isCollectibleViewed && !!root.walletStore.currentViewedCollectible && !!root.walletStore.currentViewedCollectible.ownership.ModelCount.count value: SQUtils.ModelUtils.get(root.walletStore.currentViewedCollectible.ownership, 0).accountAddress + restoreMode: Binding.RestoreBindingOrValue } readonly property ModelEntry owningAccount: ModelEntry { @@ -65,9 +67,12 @@ Rectangle { RowLayout { anchors.centerIn: parent height: parent.height + width: Math.min(parent.width, implicitWidth) spacing: Style.current.padding StatusFlatButton { + Layout.fillWidth: true + Layout.maximumWidth: implicitWidth objectName: "walletFooterSendButton" icon.name: "send" text: root.isCommunityOwnershipTransfer ? qsTr("Send Owner token to transfer %1 Community ownership").arg(root.communityName) : qsTr("Send") @@ -113,7 +118,7 @@ Rectangle { icon.name: "token" text: qsTr("Buy") onClicked: Global.openBuyCryptoModalRequested() - } + } StatusFlatButton { id: swap