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.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)
if (selectedCommunityForCollectible.available)
return selectedCommunityForCollectible.item.name
if (isCommunityCollectible)
return Utils.compactAddress(walletStore.currentViewedCollectible.communityId, 4)
return ""
const name = walletStore.currentViewedCollectible.communityName
const id = walletStore.currentViewedCollectible.communityId
if (name === id)
return Utils.compactAddress(id, 4)
return name
}
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
}
}
}

View File

@ -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")