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
This commit is contained in:
Alex Jbanca 2024-07-17 19:07:57 +03:00 committed by Alex Jbanca
parent b36e2759af
commit 6e93935298
2 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import StatusQ 0.1
import StatusQ.Layout 0.1 import StatusQ.Layout 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils import StatusQ.Core.Utils 0.1 as StatusQUtils
@ -285,14 +286,13 @@ Item {
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible
communityName: { communityName: {
if (!walletStore.currentViewedCollectible) if (selectedCommunityForCollectible.available)
return "" return selectedCommunityForCollectible.item.name
const name = walletStore.currentViewedCollectible.communityName if (isCommunityCollectible)
const id = walletStore.currentViewedCollectible.communityId return Utils.compactAddress(walletStore.currentViewedCollectible.communityId, 4)
if (name === id) return ""
return Utils.compactAddress(id, 4)
return name
} }
onLaunchShareAddressModal: Global.openShowQRPopup({ onLaunchShareAddressModal: Global.openShowQRPopup({
switchingAccounsEnabled: true, switchingAccounsEnabled: true,
changingPreferredChainsEnabled: true, changingPreferredChainsEnabled: true,
@ -350,6 +350,13 @@ Item {
d.swapFormData.defaultToTokenKey = RootStore.areTestNetworksEnabled ? Constants.swap.testStatusTokenKey : Constants.swap.mainnetStatusTokenKey d.swapFormData.defaultToTokenKey = RootStore.areTestNetworksEnabled ? Constants.swap.testStatusTokenKey : Constants.swap.mainnetStatusTokenKey
Global.openSwapModalRequested(d.swapFormData) Global.openSwapModalRequested(d.swapFormData)
} }
ModelEntry {
id: selectedCommunityForCollectible
sourceModel: footer.isCommunityCollectible ? root.communitiesStore.communitiesList : null
key: "id"
value: footer.walletStore.currentViewedCollectible.communityId
}
} }
} }

View File

@ -1,6 +1,7 @@
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Controls 2.14 import QtQuick.Controls 2.14
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import QtQml 2.15
import StatusQ 0.1 import StatusQ 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
@ -48,6 +49,7 @@ Rectangle {
Binding on collectibleOwnerAddress { Binding on collectibleOwnerAddress {
when: d.isCollectibleViewed && !!root.walletStore.currentViewedCollectible && !!root.walletStore.currentViewedCollectible.ownership.ModelCount.count when: d.isCollectibleViewed && !!root.walletStore.currentViewedCollectible && !!root.walletStore.currentViewedCollectible.ownership.ModelCount.count
value: SQUtils.ModelUtils.get(root.walletStore.currentViewedCollectible.ownership, 0).accountAddress value: SQUtils.ModelUtils.get(root.walletStore.currentViewedCollectible.ownership, 0).accountAddress
restoreMode: Binding.RestoreBindingOrValue
} }
readonly property ModelEntry owningAccount: ModelEntry { readonly property ModelEntry owningAccount: ModelEntry {
@ -65,9 +67,12 @@ Rectangle {
RowLayout { RowLayout {
anchors.centerIn: parent anchors.centerIn: parent
height: parent.height height: parent.height
width: Math.min(parent.width, implicitWidth)
spacing: Style.current.padding spacing: Style.current.padding
StatusFlatButton { StatusFlatButton {
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
objectName: "walletFooterSendButton" objectName: "walletFooterSendButton"
icon.name: "send" icon.name: "send"
text: root.isCommunityOwnershipTransfer ? qsTr("Send Owner token to transfer %1 Community ownership").arg(root.communityName) : qsTr("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" icon.name: "token"
text: qsTr("Buy") text: qsTr("Buy")
onClicked: Global.openBuyCryptoModalRequested() onClicked: Global.openBuyCryptoModalRequested()
} }
StatusFlatButton { StatusFlatButton {
id: swap id: swap