feat(@desktop/wallet): Remove network prefixes in Profile, Profile showcase and Profile preview

This commit is contained in:
Khushboo Mehta 2024-10-02 21:38:03 +02:00 committed by Khushboo-dev-cpp
parent 60fb566580
commit 16a403e3e5
8 changed files with 8 additions and 56 deletions

View File

@ -40,8 +40,7 @@ SplitView {
displayDecimals: 4, displayDecimals: 4,
stripTrailingZeroes: false}), stripTrailingZeroes: false}),
isAllAccounts: false, isAllAccounts: false,
path: "m/44/60/0/0/34", path: "m/44/60/0/0/34"
preferredSharingChainIds: walletStore.areTestNetworksEnabled ? "5:420:421613": "1:10:42161"
}) })
} }

View File

@ -32,7 +32,6 @@ SplitView {
emoji: "🇨🇿" emoji: "🇨🇿"
walletType: "" walletType: ""
showcaseVisibility: Constants.ShowcaseVisibility.NoOne showcaseVisibility: Constants.ShowcaseVisibility.NoOne
preferredSharingChainShortNames: "eth:opt:"
} }
ListElement { ListElement {
name: "testing (no emoji, colored, seed)" name: "testing (no emoji, colored, seed)"
@ -42,7 +41,6 @@ SplitView {
emoji: "" emoji: ""
walletType: "seed" walletType: "seed"
showcaseVisibility: Constants.ShowcaseVisibility.NoOne showcaseVisibility: Constants.ShowcaseVisibility.NoOne
preferredSharingChainShortNames: "arb:xdai:"
} }
ListElement { ListElement {
name: "My Bro's Account" name: "My Bro's Account"
@ -52,7 +50,6 @@ SplitView {
emoji: "🇸🇰" emoji: "🇸🇰"
walletType: "watch" walletType: "watch"
showcaseVisibility: Constants.ShowcaseVisibility.NoOne showcaseVisibility: Constants.ShowcaseVisibility.NoOne
preferredSharingChainShortNames: "eth:opt:"
} }
} }
@ -68,7 +65,6 @@ SplitView {
walletType: "" walletType: ""
showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcaseVisibility: Constants.ShowcaseVisibility.Everyone
showcasePosition: 0 showcasePosition: 0
preferredSharingChainShortNames: "eth:opt:"
} }
ListElement { ListElement {
name: "testing (no emoji, colored, seed)" name: "testing (no emoji, colored, seed)"
@ -79,7 +75,6 @@ SplitView {
walletType: "seed" walletType: "seed"
showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcaseVisibility: Constants.ShowcaseVisibility.Everyone
showcasePosition: 1 showcasePosition: 1
preferredSharingChainShortNames: "eth:opt:arb:"
} }
ListElement { ListElement {
name: "My Bro's Account" name: "My Bro's Account"
@ -90,7 +85,6 @@ SplitView {
walletType: "watch" walletType: "watch"
showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcaseVisibility: Constants.ShowcaseVisibility.Everyone
showcasePosition: 2 showcasePosition: 2
preferredSharingChainShortNames: "eth:opt:"
} }
} }

View File

@ -21,7 +21,6 @@ ProfileShowcasePanel {
delegate: ProfileShowcasePanelDelegate { delegate: ProfileShowcasePanelDelegate {
title: model ? model.name : "" title: model ? model.name : ""
secondaryTitle: WalletUtils.addressToDisplay(model ? model.address ?? "" : "", secondaryTitle: WalletUtils.addressToDisplay(model ? model.address ?? "" : "",
model ? model.preferredSharingChainShortNames ?? "" : "",
true, true,
containsMouse) containsMouse)
hasEmoji: model && !!model.emoji hasEmoji: model && !!model.emoji
@ -35,9 +34,8 @@ ProfileShowcasePanel {
expression: { expression: {
lowerCaseSearchText lowerCaseSearchText
return (address.toLowerCase().includes(lowerCaseSearchText) || return (address.toLowerCase().includes(lowerCaseSearchText) ||
name.toLowerCase().includes(lowerCaseSearchText) || name.toLowerCase().includes(lowerCaseSearchText))
preferredSharingChainShortNames.toLowerCase().includes(lowerCaseSearchText))
} }
expectedRoles: ["address", "name", "preferredSharingChainShortNames"] expectedRoles: ["address", "name"]
} }
} }

View File

@ -44,13 +44,6 @@ QtObject {
property var ownAccounts: SortFilterProxyModel { property var ownAccounts: SortFilterProxyModel {
sourceModel: root.accounts sourceModel: root.accounts
proxyRoles: [ proxyRoles: [
FastExpressionRole {
name: "preferredSharingChainShortNames"
expression: {
return root.networksModuleInst.getNetworkShortNames(model.preferredSharingChainIds)
}
expectedRoles: ["preferredSharingChainIds"]
},
FastExpressionRole { FastExpressionRole {
name: "color" name: "color"

View File

@ -86,7 +86,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: WalletUtils.addressToDisplay(model.address, "", true, containsMouse) 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

@ -80,12 +80,12 @@ QtObject {
return timestamp + Constants.time.secondsIn7Days return timestamp + Constants.time.secondsIn7Days
} }
function addressToDisplay(address, chainShortNames, shortForm, hovered) { function addressToDisplay(address, shortForm, hovered) {
let finalAddress = address let finalAddress = address
if (shortForm) { if (shortForm) {
finalAddress = StatusQUtils.Utils.elideText(address,6,4) finalAddress = StatusQUtils.Utils.elideText(address,6,4)
} }
return hovered? WalletUtils.colorizedChainPrefix(chainShortNames) + Utils.richColorText(finalAddress, Theme.palette.directColor1) : chainShortNames + finalAddress return hovered ? Utils.richColorText(finalAddress, Theme.palette.directColor1) : finalAddress
} }
/** /**

View File

@ -20,7 +20,6 @@ Control {
property string title: "" property string title: ""
property string subTitle: "" property string subTitle: ""
property string tagIcon: "" property string tagIcon: ""
property var enabledNetworks
property bool loading: false property bool loading: false
property alias rightSideButtons: rightSideButtonsLoader.sourceComponent property alias rightSideButtons: rightSideButtonsLoader.sourceComponent
signal clicked(var mouse) signal clicked(var mouse)
@ -111,29 +110,6 @@ Control {
elide: Text.ElideRight elide: Text.ElideRight
} }
Item { Layout.fillHeight: true } Item { Layout.fillHeight: true }
Row {
Layout.fillWidth: true
Layout.preferredHeight: 20
spacing: -4
visible: (chainRepeater.count > 0)
Repeater {
id: chainRepeater
model: root.enabledNetworks
delegate: StatusRoundedComponent {
width: 20
height: 20
visible: model.iconUrl !== ""
color: Theme.palette.baseColor3
z: index + 1
border.color: Style.current.background
StatusIcon {
anchors.fill:parent
anchors.margins: 1
icon: Style.svg(model.iconUrl)
}
}
}
}
ManageTokensCommunityTag { ManageTokensCommunityTag {
Layout.preferredWidth: 24 Layout.preferredWidth: 24

View File

@ -59,7 +59,6 @@ Item {
asset.letterSize: 14 asset.letterSize: 14
asset.bgColor: Theme.palette.primaryColor3 asset.bgColor: Theme.palette.primaryColor3
asset.isImage: asset.emoji asset.isImage: asset.emoji
enabledNetworks: root.walletStore.filteredFlatModel // TODO: https://github.com/status-im/status-desktop/issues/14227
rightSideButtons: RowLayout { rightSideButtons: RowLayout {
StatusFlatRoundButton { StatusFlatRoundButton {
Layout.preferredWidth: 32 Layout.preferredWidth: 32
@ -84,14 +83,12 @@ Item {
icon.color: (hovered || d.menuOpened) ? Theme.palette.directColor1 : Theme.palette.baseColor1 icon.color: (hovered || d.menuOpened) ? Theme.palette.directColor1 : Theme.palette.baseColor1
highlighted: d.menuOpened highlighted: d.menuOpened
onClicked: { onClicked: {
const preferredChains = StatusQUtils.ModelUtils.modelToArray(accountInfoDelegate.enabledNetworks, ["chainId"]).map((item) => item.chainId).join(":")
Global.openMenu(delegatesActionsMenu, this, { Global.openMenu(delegatesActionsMenu, this, {
x: moreButton.x, x: moreButton.x,
y : moreButton.y, y : moreButton.y,
accountAddress: model.address, accountAddress: model.address,
accountName: model.name, accountName: model.name,
accountColorId: model.colorId, accountColorId: model.colorId
accountPrefferedChains: preferredChains
}); });
} }
onHoveredChanged: accountInfoDelegate.highlight = hovered onHoveredChanged: accountInfoDelegate.highlight = hovered
@ -99,12 +96,10 @@ Item {
} }
onClicked: { onClicked: {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
const preferredChains = StatusQUtils.ModelUtils.modelToArray(accountInfoDelegate.enabledNetworks, ["chainId"]).map((item) => item.chainId).join(":")
Global.openMenu(delegatesActionsMenu, this, { Global.openMenu(delegatesActionsMenu, this, {
accountAddress: model.address, accountAddress: model.address,
accountName: model.name, accountName: model.name,
accountColorId: model.colorId, accountColorId: model.colorId
accountPrefferedChains: preferredChains
}); });
} }
} }
@ -118,7 +113,6 @@ Item {
property string accountAddress: "" property string accountAddress: ""
property string accountName: "" property string accountName: ""
property string accountColorId: "" property string accountColorId: ""
property var accountPrefferedChains: []
onOpened: { d.menuOpened = true; } onOpened: { d.menuOpened = true; }
onClosed: { d.menuOpened = false; } onClosed: { d.menuOpened = false; }
@ -140,11 +134,9 @@ Item {
Global.openShowQRPopup({ Global.openShowQRPopup({
showSingleAccount: true, showSingleAccount: true,
switchingAccounsEnabled: false, switchingAccounsEnabled: false,
changingPreferredChainsEnabled: false,
hasFloatingButtons: false, hasFloatingButtons: false,
name: contextMenu.accountName, name: contextMenu.accountName,
address: contextMenu.accountAddress, address: contextMenu.accountAddress,
preferredSharingChainIds: contextMenu.accountPrefferedChains,
colorId: contextMenu.accountColorId colorId: contextMenu.accountColorId
}) })
} }