From 16a403e3e5350c65b10f668b7fa560ca89267b2d Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Wed, 2 Oct 2024 21:38:03 +0200 Subject: [PATCH] feat(@desktop/wallet): Remove network prefixes in Profile, Profile showcase and Profile preview --- storybook/pages/AccountViewPage.qml | 3 +-- .../ProfileShowcaseAccountsPanelPage.qml | 6 ----- .../panels/ProfileShowcaseAccountsPanel.qml | 6 ++--- .../AppLayouts/Profile/stores/WalletStore.qml | 7 ------ .../Profile/views/wallet/AccountOrderView.qml | 2 +- ui/app/AppLayouts/Wallet/WalletUtils.qml | 4 ++-- .../shared/controls/delegates/InfoCard.qml | 24 ------------------- .../profile/ProfileShowcaseAccountsView.qml | 12 ++-------- 8 files changed, 8 insertions(+), 56 deletions(-) diff --git a/storybook/pages/AccountViewPage.qml b/storybook/pages/AccountViewPage.qml index 79fb45eac2..c0e5dab3a1 100644 --- a/storybook/pages/AccountViewPage.qml +++ b/storybook/pages/AccountViewPage.qml @@ -40,8 +40,7 @@ SplitView { displayDecimals: 4, stripTrailingZeroes: false}), isAllAccounts: false, - path: "m/44’/60’/0’/0’/34", - preferredSharingChainIds: walletStore.areTestNetworksEnabled ? "5:420:421613": "1:10:42161" + path: "m/44’/60’/0’/0’/34" }) } diff --git a/storybook/pages/ProfileShowcaseAccountsPanelPage.qml b/storybook/pages/ProfileShowcaseAccountsPanelPage.qml index 2c93dad2a7..d45549ec15 100644 --- a/storybook/pages/ProfileShowcaseAccountsPanelPage.qml +++ b/storybook/pages/ProfileShowcaseAccountsPanelPage.qml @@ -32,7 +32,6 @@ SplitView { emoji: "🇨🇿" walletType: "" showcaseVisibility: Constants.ShowcaseVisibility.NoOne - preferredSharingChainShortNames: "eth:opt:" } ListElement { name: "testing (no emoji, colored, seed)" @@ -42,7 +41,6 @@ SplitView { emoji: "" walletType: "seed" showcaseVisibility: Constants.ShowcaseVisibility.NoOne - preferredSharingChainShortNames: "arb:xdai:" } ListElement { name: "My Bro's Account" @@ -52,7 +50,6 @@ SplitView { emoji: "🇸🇰" walletType: "watch" showcaseVisibility: Constants.ShowcaseVisibility.NoOne - preferredSharingChainShortNames: "eth:opt:" } } @@ -68,7 +65,6 @@ SplitView { walletType: "" showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcasePosition: 0 - preferredSharingChainShortNames: "eth:opt:" } ListElement { name: "testing (no emoji, colored, seed)" @@ -79,7 +75,6 @@ SplitView { walletType: "seed" showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcasePosition: 1 - preferredSharingChainShortNames: "eth:opt:arb:" } ListElement { name: "My Bro's Account" @@ -90,7 +85,6 @@ SplitView { walletType: "watch" showcaseVisibility: Constants.ShowcaseVisibility.Everyone showcasePosition: 2 - preferredSharingChainShortNames: "eth:opt:" } } diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPanel.qml index 24f88b51e9..c6f6216a04 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAccountsPanel.qml @@ -21,7 +21,6 @@ ProfileShowcasePanel { delegate: ProfileShowcasePanelDelegate { title: model ? model.name : "" secondaryTitle: WalletUtils.addressToDisplay(model ? model.address ?? "" : "", - model ? model.preferredSharingChainShortNames ?? "" : "", true, containsMouse) hasEmoji: model && !!model.emoji @@ -35,9 +34,8 @@ ProfileShowcasePanel { expression: { lowerCaseSearchText return (address.toLowerCase().includes(lowerCaseSearchText) || - name.toLowerCase().includes(lowerCaseSearchText) || - preferredSharingChainShortNames.toLowerCase().includes(lowerCaseSearchText)) + name.toLowerCase().includes(lowerCaseSearchText)) } - expectedRoles: ["address", "name", "preferredSharingChainShortNames"] + expectedRoles: ["address", "name"] } } diff --git a/ui/app/AppLayouts/Profile/stores/WalletStore.qml b/ui/app/AppLayouts/Profile/stores/WalletStore.qml index 78d7446a72..89dc2810b1 100644 --- a/ui/app/AppLayouts/Profile/stores/WalletStore.qml +++ b/ui/app/AppLayouts/Profile/stores/WalletStore.qml @@ -44,13 +44,6 @@ QtObject { property var ownAccounts: SortFilterProxyModel { sourceModel: root.accounts proxyRoles: [ - FastExpressionRole { - name: "preferredSharingChainShortNames" - expression: { - return root.networksModuleInst.getNetworkShortNames(model.preferredSharingChainIds) - } - expectedRoles: ["preferredSharingChainIds"] - }, FastExpressionRole { name: "color" diff --git a/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml b/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml index 446567711d..56dcd9845f 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml @@ -86,7 +86,7 @@ ColumnLayout { draggable: accountsList.count > 1 Drag.keys: [d.walletAccountDnDKey] title: model.name - secondaryTitle: WalletUtils.addressToDisplay(model.address, "", true, containsMouse) + secondaryTitle: WalletUtils.addressToDisplay(model.address, true, containsMouse) secondaryTitleIcon: model.walletType === Constants.watchWalletType? "show" : model.keycardAccount ? "keycard" : "" hasEmoji: true diff --git a/ui/app/AppLayouts/Wallet/WalletUtils.qml b/ui/app/AppLayouts/Wallet/WalletUtils.qml index f57b39d29c..7b3fd8ed71 100644 --- a/ui/app/AppLayouts/Wallet/WalletUtils.qml +++ b/ui/app/AppLayouts/Wallet/WalletUtils.qml @@ -80,12 +80,12 @@ QtObject { return timestamp + Constants.time.secondsIn7Days } - function addressToDisplay(address, chainShortNames, shortForm, hovered) { + function addressToDisplay(address, 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 + return hovered ? Utils.richColorText(finalAddress, Theme.palette.directColor1) : finalAddress } /** diff --git a/ui/imports/shared/controls/delegates/InfoCard.qml b/ui/imports/shared/controls/delegates/InfoCard.qml index ddd9e0b4a6..f4174f9e41 100644 --- a/ui/imports/shared/controls/delegates/InfoCard.qml +++ b/ui/imports/shared/controls/delegates/InfoCard.qml @@ -20,7 +20,6 @@ Control { property string title: "" property string subTitle: "" property string tagIcon: "" - property var enabledNetworks property bool loading: false property alias rightSideButtons: rightSideButtonsLoader.sourceComponent signal clicked(var mouse) @@ -111,29 +110,6 @@ Control { elide: Text.ElideRight } 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 { Layout.preferredWidth: 24 diff --git a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml index b55b842ed0..c690da5077 100644 --- a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml +++ b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml @@ -59,7 +59,6 @@ Item { asset.letterSize: 14 asset.bgColor: Theme.palette.primaryColor3 asset.isImage: asset.emoji - enabledNetworks: root.walletStore.filteredFlatModel // TODO: https://github.com/status-im/status-desktop/issues/14227 rightSideButtons: RowLayout { StatusFlatRoundButton { Layout.preferredWidth: 32 @@ -84,14 +83,12 @@ Item { icon.color: (hovered || d.menuOpened) ? Theme.palette.directColor1 : Theme.palette.baseColor1 highlighted: d.menuOpened onClicked: { - const preferredChains = StatusQUtils.ModelUtils.modelToArray(accountInfoDelegate.enabledNetworks, ["chainId"]).map((item) => item.chainId).join(":") Global.openMenu(delegatesActionsMenu, this, { x: moreButton.x, y : moreButton.y, accountAddress: model.address, accountName: model.name, - accountColorId: model.colorId, - accountPrefferedChains: preferredChains + accountColorId: model.colorId }); } onHoveredChanged: accountInfoDelegate.highlight = hovered @@ -99,12 +96,10 @@ Item { } onClicked: { if (mouse.button === Qt.RightButton) { - const preferredChains = StatusQUtils.ModelUtils.modelToArray(accountInfoDelegate.enabledNetworks, ["chainId"]).map((item) => item.chainId).join(":") Global.openMenu(delegatesActionsMenu, this, { accountAddress: model.address, accountName: model.name, - accountColorId: model.colorId, - accountPrefferedChains: preferredChains + accountColorId: model.colorId }); } } @@ -118,7 +113,6 @@ Item { property string accountAddress: "" property string accountName: "" property string accountColorId: "" - property var accountPrefferedChains: [] onOpened: { d.menuOpened = true; } onClosed: { d.menuOpened = false; } @@ -140,11 +134,9 @@ Item { Global.openShowQRPopup({ showSingleAccount: true, switchingAccounsEnabled: false, - changingPreferredChainsEnabled: false, hasFloatingButtons: false, name: contextMenu.accountName, address: contextMenu.accountAddress, - preferredSharingChainIds: contextMenu.accountPrefferedChains, colorId: contextMenu.accountColorId }) }