fix(@desktop/wallet): display short address form in the wallet settings account order page

This commit is contained in:
Sale Djenic 2023-12-20 15:10:50 +01:00 committed by saledjenic
parent a055ad4d71
commit bc2642c5e8
4 changed files with 20 additions and 7 deletions

View File

@ -212,6 +212,12 @@ ItemDelegate {
*/ */
property color assetBgColor: "transparent" property color assetBgColor: "transparent"
/*!
\qmlproperty alias StatusDraggableListItem::containsMouse
Used to read if the component cotains mouse
*/
readonly property alias containsMouse: dragHandler.containsMouse
Drag.dragType: Drag.Automatic Drag.dragType: Drag.Automatic
Drag.hotSpot.x: dragHandler.mouseX Drag.hotSpot.x: dragHandler.mouseX
Drag.hotSpot.y: dragHandler.mouseY Drag.hotSpot.y: dragHandler.mouseY

View File

@ -3,7 +3,6 @@ import QtQuick 2.14
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
import AppLayouts.Wallet 1.0 import AppLayouts.Wallet 1.0
@ -21,11 +20,7 @@ StatusListItem {
objectName: account.name objectName: account.name
title: account.name title: account.name
subTitle: { subTitle: WalletUtils.addressToDisplay(account.address, root.getNetworkShortNames(account.preferredSharingChainIds), true, sensor.containsMouse)
const elidedAddress = StatusQUtils.Utils.elideText(account.address,6,4)
let chainShortNames = root.getNetworkShortNames(account.preferredSharingChainIds)
return sensor.containsMouse ? WalletUtils.colorizedChainPrefix(chainShortNames) + Utils.richColorText(elidedAddress, Theme.palette.directColor1) : chainShortNames + elidedAddress
}
asset.color: !!account.colorId ? Utils.getColorForId(account.colorId): "" asset.color: !!account.colorId ? Utils.getColorForId(account.colorId): ""
asset.emoji: account.emoji asset.emoji: account.emoji
asset.name: !account.emoji ? "filled-account": "" asset.name: !account.emoji ? "filled-account": ""

View File

@ -10,6 +10,8 @@ import StatusQ.Popups 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import AppLayouts.Wallet 1.0
import utils 1.0 import utils 1.0
import "../../stores" import "../../stores"
@ -92,7 +94,7 @@ ColumnLayout {
draggable: accountsList.count > 1 draggable: accountsList.count > 1
Drag.keys: [d.walletAccountDnDKey] Drag.keys: [d.walletAccountDnDKey]
title: model.name title: model.name
secondaryTitle: model.address secondaryTitle: WalletUtils.addressToDisplay(model.address, "", true, containsMouse)
secondaryTitleIcon: model.walletType === Constants.watchWalletType? "show" : secondaryTitleIcon: model.walletType === Constants.watchWalletType? "show" :
model.keycardAccount ? "keycard" : "" model.keycardAccount ? "keycard" : ""
hasEmoji: true hasEmoji: true

View File

@ -5,6 +5,8 @@ import QtQuick 2.14
import utils 1.0 import utils 1.0
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
import "stores" as WalletStores import "stores" as WalletStores
QtObject { QtObject {
@ -47,4 +49,12 @@ QtObject {
} }
return timestamp + Constants.time.secondsIn7Days return timestamp + Constants.time.secondsIn7Days
} }
function addressToDisplay(address, chainShortNames, shortForm, hovered) {
let finalAddress = address
if (shortForm) {
finalAddress = StatusQUtils.Utils.elideText(address,6,4)
}
return hovered? WalletUtils.colorizedChainPrefix(chainShortNames) + Utils.richColorText(finalAddress, Theme.palette.directColor1) : chainShortNames + finalAddress
}
} }