diff --git a/src/app/modules/main/wallet_section/overview/item.nim b/src/app/modules/main/wallet_section/overview/item.nim
index d7af6a6607..bff4073197 100644
--- a/src/app/modules/main/wallet_section/overview/item.nim
+++ b/src/app/modules/main/wallet_section/overview/item.nim
@@ -6,17 +6,23 @@ type
mixedCaseAddress: string
ens: string
balanceLoading: bool
+ color: string
+ emoji: string
proc initItem*(
name: string = "",
mixedCaseAddress: string = "",
ens: string = "",
balanceLoading: bool = true,
+ color: string,
+ emoji: string
): Item =
result.name = name
result.mixedCaseAddress = mixedCaseAddress
result.ens = ens
result.balanceLoading = balanceLoading
+ result.color = color
+ result.emoji = emoji
proc `$`*(self: Item): string =
result = fmt"""OverviewItem(
@@ -24,6 +30,8 @@ proc `$`*(self: Item): string =
mixedCaseAddress: {self.mixedCaseAddress},
ens: {self.ens},
balanceLoading: {self.balanceLoading},
+ color: {self.color},
+ emoji: {self.emoji},
]"""
proc getName*(self: Item): string =
@@ -36,4 +44,11 @@ proc getEns*(self: Item): string =
return self.ens
proc getBalanceLoading*(self: Item): bool =
- return self.balanceLoading
\ No newline at end of file
+ return self.balanceLoading
+
+proc getColor*(self: Item): string =
+ return self.color
+
+proc getEmoji*(self: Item): string =
+ return self.emoji
+
diff --git a/src/app/modules/main/wallet_section/overview/module.nim b/src/app/modules/main/wallet_section/overview/module.nim
index c3bdce6d9b..a1e8a6319d 100644
--- a/src/app/modules/main/wallet_section/overview/module.nim
+++ b/src/app/modules/main/wallet_section/overview/module.nim
@@ -106,6 +106,8 @@ method switchAccount*(self: Module, accountIndex: int) =
walletAccount.mixedCaseAddress,
walletAccount.ens,
walletAccount.assetsLoading,
+ walletAccount.color,
+ walletAccount.emoji,
)
self.view.setData(item)
@@ -133,4 +135,4 @@ proc onAccountAdded(self: Module, account: WalletAccountDto) =
self.switchAccount(self.currentAccountIndex)
proc onAccountRemoved(self: Module, address: string) =
- self.switchAccount(self.currentAccountIndex)
\ No newline at end of file
+ self.switchAccount(self.currentAccountIndex)
diff --git a/src/app/modules/main/wallet_section/overview/view.nim b/src/app/modules/main/wallet_section/overview/view.nim
index d56020f807..cc070c286b 100644
--- a/src/app/modules/main/wallet_section/overview/view.nim
+++ b/src/app/modules/main/wallet_section/overview/view.nim
@@ -14,6 +14,8 @@ QtObject:
currencyBalance: CurrencyAmount
ens: string
balanceLoading: bool
+ color: string
+ emoji: string
proc setup(self: View) =
self.QObject.setup
@@ -72,6 +74,20 @@ QtObject:
self.balanceLoading = balanceLoading
self.balanceLoadingChanged()
+ proc getColor(self: View): QVariant {.slot.} =
+ return newQVariant(self.color)
+ proc colorChanged(self: View) {.signal.}
+ QtProperty[QVariant] color:
+ read = getColor
+ notify = colorChanged
+
+ proc getEmoji(self: View): QVariant {.slot.} =
+ return newQVariant(self.emoji)
+ proc emojiChanged(self: View) {.signal.}
+ QtProperty[QVariant] emoji:
+ read = getEmoji
+ notify = emojiChanged
+
proc setData*(self: View, item: Item) =
if(self.name != item.getName()):
self.name = item.getName()
@@ -82,4 +98,10 @@ QtObject:
if(self.ens != item.getEns()):
self.ens = item.getEns()
self.ensChanged()
- self.setBalanceLoading(item.getBalanceLoading())
\ No newline at end of file
+ self.setBalanceLoading(item.getBalanceLoading())
+ if(self.color != item.getColor()):
+ self.color = item.getColor()
+ self.colorChanged()
+ if(self.emoji != item.getEmoji()):
+ self.emoji = item.getEmoji()
+ self.emojiChanged()
diff --git a/ui/StatusQ/sandbox/controls/Popups.qml b/ui/StatusQ/sandbox/controls/Popups.qml
index 3b4c3bd8ed..f9a6117b7d 100644
--- a/ui/StatusQ/sandbox/controls/Popups.qml
+++ b/ui/StatusQ/sandbox/controls/Popups.qml
@@ -391,51 +391,6 @@ Column {
}
}
- StatusModal {
- id: floatingHeaderModal
- anchors.centerIn: parent
- height: 200
- showHeader: false
- showFooter: false
- showAdvancedHeader: true
- hasFloatingButtons: true
- advancedHeaderComponent: StatusFloatingButtonsSelector {
- id: floatingHeader
-
- model: dummyAccountsModel
-
- delegate: Rectangle {
- width: button.width
- height: button.height
- radius: 8
- visible: floatingHeader.visibleIndices.includes(index)
- color: Theme.palette.statusAppLayout.backgroundColor
- StatusButton {
- id: button
- topPadding: 8
- bottomPadding: 0
- implicitHeight: 32
- leftPadding: 4
- text: name
- asset.emoji: !!emoji ? emoji: ""
- asset.emojiSize: Emoji.size.middle
- asset.name: !emoji ? "filled-account": ""
- normalColor: "transparent"
- highlighted: index === floatingHeader.currentIndex
- onClicked: {
- floatingHeader.currentIndex = index
- }
- }
- }
-
- popupMenuDelegate: StatusListItem {
- implicitWidth: 272
- title: name
- onClicked: floatingHeader.selectItem(index)
- }
- }
- }
-
ListModel {
id: dummyAccountsModel
ListElement{name: "Account 1"; iconName: "filled-account"; emoji: "🥑" }
diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml b/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml
index 91d54192e6..69a01c5200 100644
--- a/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml
+++ b/ui/StatusQ/src/StatusQ/Controls/StatusColorRadioButton.qml
@@ -21,6 +21,8 @@ RadioButton {
implicitHeight: control.diameter
radius: width/2
color: radioButtonColor
+ border.width: 1
+ border.color: Theme.palette.directColor7
Rectangle {
anchors.centerIn: parent
diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusFloatingButtonsSelector.qml b/ui/StatusQ/src/StatusQ/Controls/StatusFloatingButtonsSelector.qml
deleted file mode 100644
index e032dccf6e..0000000000
--- a/ui/StatusQ/src/StatusQ/Controls/StatusFloatingButtonsSelector.qml
+++ /dev/null
@@ -1,156 +0,0 @@
-import QtQuick 2.14
-import QtQuick.Layouts 1.14
-
-import StatusQ.Core 0.1
-import StatusQ.Core.Theme 0.1
-import StatusQ.Components 0.1
-import StatusQ.Controls 0.1
-import StatusQ.Popups 0.1
-
-import SortFilterProxyModel 0.2
-
-/*!
- \qmltype StatusModalFloatingButtonsSelector
- \inherits Row
- \inqmlmodule StatusQ.Controls
- \since StatusQ.Controls 0.1
- \brief The StatusModalFloatingButtonsSelector provides a template for creating a selectable buttons list
- this list can be parially hidden and the rest of the items are shown under the more button in a popup
-
- Example of how to use it:
-
- \qml
- StatusModalFloatingButtonsSelector {
- id: floatingHeader
- model: dummyAccountsModel
- delegate: StatusAccountSelectorTag {
- title: "name"
- icon.name: "iconName"
- isSelected: floatingHeader.currentIndex === index
- visible: visibleIndices.includes(index)
- onClicked: floatingHeader.currentIndex = index
- }
- popupMenuDelegate: StatusListItem {
- implicitWidth: 272
- title: "name"
- onClicked: floatingHeader.itemSelected(index)
- visible: !visibleIndices.includes(index)
- }
- }
- \endqml
-
- For a list of components available see StatusQ.
-*/
-Row {
- id: root
-
- /*!
- \qmlproperty repeater
- This property represents the repeater of selectable items shown to the user.
- Can be used to assign objectName to the repeater
- \endqml
- */
- readonly property alias repeater: itemSelectionRepeater
-
- /*!
- \qmlproperty delegate
- This property represents the delegate of selectable items shown to the user.
- Can be used to assign delegate to the buttons selector
- \endqml
- */
- property alias delegate: itemSelectionRepeater.delegate
- /*!
- \qmlproperty popupMenuDelegate
- This property represents the delegate of popupmenu fropm which items can be selected by the user.
- Can be used to assign delegate to the popupmenu
- \endqml
- */
- property alias popupMenuDelegate: popupMenuSelectionInstantiator.delegate
-
- /*!
- \qmlproperty model
- This property represents the model of selectable items shown to the user.
- Can be used to assign selectable items in the buttons selector
- \endqml
- */
- property var model
- /*!
- \qmlproperty visibleIndices
- This property represents the indices from the selectable items that will visible to the user
- Can be used to set visible items in the buttons selector
- \endqml
- */
- property var visibleIndices: [0,1,2]
- /*!
- \qmlproperty currentIndex
- This property represents the index of the currently selected item
- Can be used to set the currnetly selected item in the buttons selector
- \endqml
- */
- property int currentIndex: 0
-
- function selectItem(index) {
- visibleIndices = [0, 1, visibleIndices.length + index]
- root.currentIndex = index
- popupMenu.close()
- }
-
- height: 32
- spacing: 12
- clip: true
-
- SortFilterProxyModel {
- id: menuModel
-
- sourceModel: root.model
-
- filters: [
- ExpressionFilter {
- enabled: root.visibleIndices.length > 0
- expression: !root.visibleIndices.includes(index)
- }
- ]
- }
-
- Repeater {
- id: itemSelectionRepeater
- model: root.model
- }
-
- Rectangle {
- width: button.width
- height: button.height
- radius: 8
- visible: root.model.count > 3
- color: Theme.palette.statusAppLayout.backgroundColor
- StatusButton {
- id: button
- implicitHeight: 32
- topPadding: 8
- bottomPadding: 0
- horizontalPadding: 4
- hoverColor: Theme.palette.statusFloatingButtonHighlight
- normalColor: Theme.palette.baseColor3
- asset.name: "more"
- asset.bgColor: "transparent"
- onClicked: popupMenu.popup(parent.x + 4, y + height + 4)
- }
- }
-
- // Empty item to fill up empty space
- Item {
- Layout.preferredHeight: parent.height
- Layout.fillWidth: true
- }
-
- StatusMenu {
- id: popupMenu
- width: implicitWidth
-
- StatusMenuInstantiator {
- id: popupMenuSelectionInstantiator
- model: menuModel
- menu: popupMenu
- }
- }
-}
diff --git a/ui/StatusQ/src/StatusQ/Controls/qmldir b/ui/StatusQ/src/StatusQ/Controls/qmldir
index 8f5eac0709..1c54c1e9fc 100644
--- a/ui/StatusQ/src/StatusQ/Controls/qmldir
+++ b/ui/StatusQ/src/StatusQ/Controls/qmldir
@@ -43,7 +43,6 @@ StatusWalletColorSelect 0.1 StatusWalletColorSelect.qml
StatusColorSelectorGrid 0.1 StatusColorSelectorGrid.qml
StatusSeedPhraseInput 0.1 StatusSeedPhraseInput.qml
StatusImageCrop 0.1 StatusImageCrop.qml
-StatusFloatingButtonsSelector 0.1 StatusFloatingButtonsSelector.qml
StatusActivityCenterButton 0.1 StatusActivityCenterButton.qml
StatusDropdown 0.1 StatusDropdown.qml
StatusIconTextButton 0.1 StatusIconTextButton.qml
diff --git a/ui/StatusQ/src/StatusQ/Core/Theme/StatusColors.qml b/ui/StatusQ/src/StatusQ/Core/Theme/StatusColors.qml
index cf484c5985..079c3a0b39 100644
--- a/ui/StatusQ/src/StatusQ/Core/Theme/StatusColors.qml
+++ b/ui/StatusQ/src/StatusQ/Core/Theme/StatusColors.qml
@@ -71,5 +71,17 @@ QtObject {
'blueHijab': '#CDF2FB',
'lightPattensBlue': '#D7DEE4',
+
+ 'blackHovered': '#1D232E',
+ 'blueHovered': '#364DB2',
+ 'purpleHovered': '#6D62C7',
+ 'cyanHovered': '#41A6C0',
+ 'violetHovered': '#A965C3',
+ 'redHovered': '#C85151',
+ 'yellowHovered': '#CCA20C',
+ 'greenHovered': '#63AE00',
+ 'mossHovered': '#1E857B',
+ 'brownHovered': '#6F2727',
+ 'brown2Hovered': '#7C6926',
}
}
diff --git a/ui/StatusQ/src/StatusQ/Core/Theme/ThemePalette.qml b/ui/StatusQ/src/StatusQ/Core/Theme/ThemePalette.qml
index eee06ce8e4..76bb7762a8 100644
--- a/ui/StatusQ/src/StatusQ/Core/Theme/ThemePalette.qml
+++ b/ui/StatusQ/src/StatusQ/Core/Theme/ThemePalette.qml
@@ -261,6 +261,40 @@ QtObject {
property color emojiReactionActiveBackgroundHovered
}
+ property QtObject walletAccountColors: QtObject {
+ function getHoveredColor(color) {
+ switch(color) {
+ case getColor('black'):
+ return getColor('blackHovered')
+ case getColor('grey'):
+ return getColor('grey2')
+ case getColor('white'):
+ return getColor('grey4')
+ case getColor('blue2'):
+ return getColor('blueHovered')
+ case getColor('purple'):
+ return getColor('purpleHovered')
+ case getColor('cyan'):
+ return getColor('cyanHovered')
+ case getColor('violet'):
+ return getColor('violetHovered')
+ case getColor('red2'):
+ return getColor('redHovered')
+ case getColor('yellow'):
+ return getColor('yellowHovered')
+ case getColor('green2'):
+ return getColor('greenHovered')
+ case getColor('moss'):
+ return getColor('mossHovered')
+ case getColor('brown'):
+ return getColor('brownHovered')
+ case getColor('brown2'):
+ return getColor('brown2Hovered')
+ default: return ""
+ }
+ }
+ }
+
function alphaColor(color, alpha) {
let actualColor = Qt.darker(color, 1)
actualColor.a = alpha
diff --git a/ui/StatusQ/src/statusq.qrc b/ui/StatusQ/src/statusq.qrc
index d54b76a35d..346cbc7d06 100644
--- a/ui/StatusQ/src/statusq.qrc
+++ b/ui/StatusQ/src/statusq.qrc
@@ -89,7 +89,6 @@
StatusQ/Controls/StatusDropdown.qml
StatusQ/Controls/StatusFlatButton.qml
StatusQ/Controls/StatusFlatRoundButton.qml
- StatusQ/Controls/StatusFloatingButtonsSelector.qml
StatusQ/Controls/StatusIconTabButton.qml
StatusQ/Controls/StatusIconTextButton.qml
StatusQ/Controls/StatusIdenticonRing.qml
diff --git a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml
index c2e4ff78a1..72591cc9a8 100644
--- a/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml
+++ b/ui/app/AppLayouts/Wallet/panels/WalletFooter.qml
@@ -77,7 +77,6 @@ Rectangle {
Component {
id: receiveModalComponent
ReceiveModal {
- selectedAddress: walletStore.overview.mixedcaseAddress
anchors.centerIn: parent
}
}
diff --git a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml
index df86875677..c55ce36995 100644
--- a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml
+++ b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml
@@ -16,6 +16,7 @@ import utils 1.0
import shared.controls 1.0
import shared.popups 1.0
+import SortFilterProxyModel 0.2
import AppLayouts.stores 1.0
import "../stores"
@@ -23,18 +24,11 @@ import "../stores"
StatusModal {
id: root
- property string selectedAddress: ""
- property string networkPrefix: ""
- property string completeAddressWithNetworkPrefix
-
- onSelectedAddressChanged: {
- if (selectedAddress) {
- txtWalletAddress.text = selectedAddress
- }
- }
-
- onCompleteAddressWithNetworkPrefixChanged: {
- qrCodeImage.source = RootStore.getQrCode(completeAddressWithNetworkPrefix)
+ QtObject {
+ id: d
+ property string selectedAccountAddress
+ property string networkPrefix
+ property string completeAddressWithNetworkPrefix
}
header.title: qsTr("Receive")
@@ -46,12 +40,19 @@ StatusModal {
hasFloatingButtons: true
advancedHeaderComponent: AccountsModalHeader {
- model: RootStore.accounts
- currentAddress: root.selectedAddress
- changeSelectedAccount: function(newAccount, newIndex) {
- root.selectedAddress = newAccount.address
+ id: header
+ model: SortFilterProxyModel {
+ sourceModel: RootStore.accounts
+ }
+ selectedIndex: RootStore.getUserSelectedAccountIndex(header.model)
+ onSelectedIndexChanged: selectedAccount = header.model.get(header.selectedIndex)
+ onSelectedAccountChanged: d.selectedAccountAddress = selectedAccount.address
+ Connections {
+ target: RootStore.accounts
+ function onModelReset() {
+ header.selectedAccount = header.model.get(header.selectedIndex)
+ }
}
- showAllWalletTypes: true
}
contentItem: Column {
@@ -162,6 +163,7 @@ StatusModal {
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: false
+ source: RootStore.getQrCode(d.completeAddressWithNetworkPrefix)
}
Rectangle {
@@ -209,9 +211,9 @@ StatusModal {
visible: model.isEnabled
onVisibleChanged: {
if (visible) {
- networkPrefix += text
+ d.networkPrefix += text
} else {
- networkPrefix = networkPrefix.replace(text, "")
+ d.networkPrefix = d.networkPrefix.replace(text, "")
}
}
}
@@ -222,6 +224,7 @@ StatusModal {
id: txtWalletAddress
color: Theme.palette.directColor1
font.pixelSize: 15
+ text: d.selectedAccountAddress
}
}
Column {
@@ -301,8 +304,8 @@ StatusModal {
textToCopy: txtWalletAddress.text
}
PropertyChanges {
- target: root
- completeAddressWithNetworkPrefix: root.selectedAddress
+ target: d
+ completeAddressWithNetworkPrefix: d.selectedAccountAddress
}
},
State {
@@ -322,11 +325,11 @@ StatusModal {
}
PropertyChanges {
target: copyToClipBoard
- textToCopy: root.networkPrefix + txtWalletAddress.text
+ textToCopy: d.networkPrefix + txtWalletAddress.text
}
PropertyChanges {
- target: root
- completeAddressWithNetworkPrefix: root.networkPrefix + root.selectedAddress
+ target: d
+ completeAddressWithNetworkPrefix: d.networkPrefix + d.selectedAccountAddress
}
}
]
diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml
index 337a2a3438..01a26b1985 100644
--- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml
+++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml
@@ -21,6 +21,7 @@ QtObject {
property var assets: walletSectionAssets.assets
property bool assetsLoading: walletSectionAssets.assetsLoading
property var accounts: walletSectionAccounts.accounts
+ property var sendAccounts: walletSectionSend.accounts
property var appSettings: localAppSettings
property var accountSensitiveSettings: localAccountSensitiveSettings
property bool hideSignPhraseModal: accountSensitiveSettings.hideSignPhraseModal
@@ -197,4 +198,12 @@ QtObject {
function runEditAccountPopup(address) {
walletSection.runEditAccountPopup(address)
}
+
+ function getUserSelectedAccountIndex(model) {
+ for (let i = 0; i < model.count; i++) {
+ if(model.get(i).address.toUpperCase() === root.overview.mixedcaseAddress.toUpperCase()) {
+ return i
+ }
+ }
+ }
}
diff --git a/ui/imports/shared/controls/SavedAddressListItem.qml b/ui/imports/shared/controls/SavedAddressListItem.qml
index 36fe7dcbf5..f01acd87a1 100644
--- a/ui/imports/shared/controls/SavedAddressListItem.qml
+++ b/ui/imports/shared/controls/SavedAddressListItem.qml
@@ -32,7 +32,7 @@ StatusListItem {
statusListItemSubTitle.elide: Text.ElideMiddle
statusListItemSubTitle.wrapMode: Text.NoWrap
radius: 0
- color: sensor.containsMouse || highlighted ? Theme.palette.statusListItem.highlightColor : "transparent"
+ color: sensor.containsMouse || highlighted ? Theme.palette.baseColor2 : "transparent"
components: [
ClearButton {
width: 24
diff --git a/ui/imports/shared/controls/TokenBalancePerChainDelegate.qml b/ui/imports/shared/controls/TokenBalancePerChainDelegate.qml
index 1873bdf863..804104f7b0 100644
--- a/ui/imports/shared/controls/TokenBalancePerChainDelegate.qml
+++ b/ui/imports/shared/controls/TokenBalancePerChainDelegate.qml
@@ -29,7 +29,7 @@ StatusListItem {
tagsModel: balances.count > 0 ? balances : []
tagsDelegate: sensor.containsMouse ? expandedItem : compactItem
radius: sensor.containsMouse || root.highlighted ? 0 : 8
- color: sensor.containsMouse || highlighted ? Theme.palette.statusListItem.highlightColor : "transparent"
+ color: sensor.containsMouse || highlighted ? Theme.palette.baseColor2 : "transparent"
onClicked: d.selectToken()
diff --git a/ui/imports/shared/controls/WalletAccountListItem.qml b/ui/imports/shared/controls/WalletAccountListItem.qml
index 586a723c10..0216f991f5 100644
--- a/ui/imports/shared/controls/WalletAccountListItem.qml
+++ b/ui/imports/shared/controls/WalletAccountListItem.qml
@@ -39,7 +39,7 @@ StatusListItem {
asset.width: 40
asset.height: 40
radius: 0
- color: sensor.containsMouse || highlighted ? Theme.palette.statusListItem.highlightColor : "transparent"
+ color: sensor.containsMouse || highlighted ? Theme.palette.baseColor2 : "transparent"
components: [
Column {
anchors.verticalCenter: parent.verticalCenter
diff --git a/ui/imports/shared/panels/StatusAssetSelector.qml b/ui/imports/shared/panels/StatusAssetSelector.qml
index 2b137a16bf..e805370149 100644
--- a/ui/imports/shared/panels/StatusAssetSelector.qml
+++ b/ui/imports/shared/panels/StatusAssetSelector.qml
@@ -22,7 +22,6 @@ Item {
property var assets
property var selectedAsset
property string defaultToken
- property string userSelectedToken
property string currentCurrencySymbol
property string placeholderText
property var hoveredToken
@@ -155,7 +154,6 @@ Item {
width: comboBox.control.popup.width
getNetworkIcon: root.getNetworkIcon
onTokenSelected: {
- userSelectedToken = selectedToken.symbol
selectedAsset = selectedToken
comboBox.control.popup.close()
}
diff --git a/ui/imports/shared/popups/AccountsModalHeader.qml b/ui/imports/shared/popups/AccountsModalHeader.qml
index 2275528934..3bbf21da6f 100644
--- a/ui/imports/shared/popups/AccountsModalHeader.qml
+++ b/ui/imports/shared/popups/AccountsModalHeader.qml
@@ -1,87 +1,85 @@
-import QtQuick 2.13
-import QtQuick.Controls 2.13
-import QtQuick.Layouts 1.13
-import StatusQ.Controls.Validators 0.1
-
-import utils 1.0
+import QtQuick 2.15
import StatusQ.Controls 0.1
-import StatusQ.Popups 0.1
import StatusQ.Components 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
import "../controls"
-import "../views"
-StatusFloatingButtonsSelector {
+StatusComboBox {
id: root
- property string currentAddress
property var selectedAccount
- // Expected signature: function(newAccount)
- property var changeSelectedAccount: function(){}
- property bool showAllWalletTypes: false
+ property string chainShortNames
+ property int selectedIndex: -1
- repeater.objectName: "accountsListFloatingHeader"
-
- signal updatedSelectedAccount(var account)
-
- delegate: Rectangle {
- width: button.width
- height: button.height
- radius: 8
- color: Theme.palette.baseColor3
- StatusButton {
- id: button
- size: StatusBaseButton.Size.Tiny
- implicitHeight: 32
- leftPadding: 4
- text: name
- objectName: name
- asset.emoji: !!emoji ? emoji: ""
- icon.name: !emoji ? "filled-account": ""
- normalColor: "transparent"
- hoverColor: Theme.palette.statusFloatingButtonHighlight
- highlighted: index === root.currentIndex
- onClicked: {
- changeSelectedAccount(model)
- root.currentIndex = index
- }
- Component.onCompleted: {
- // on model reset, set the selected account to the one that was previously selected
- if(!root.selectedAccount) {
- if(root.currentIndex === index) {
- changeSelectedAccount(model)
- }
- if(root.currentAddress === model.address) {
- root.currentIndex = index
- changeSelectedAccount(model)
- }
- } else {
- // if the selectedAccount is watch only then select 0th item
- if(index === 0 && !!root.selectedAccount && root.selectedAccount.walletType === Constants.watchWalletType) {
- changeSelectedAccount(model)
- root.currentIndex = index
- }
- }
- }
+ QtObject {
+ id: d
+ function getTextColorForWhite(color) {
+ // The grey is kept for backwards compatibility for accounts already created with grey background
+ return color === StatusColors.colors['grey'] || color === StatusColors.colors['white'] ? Theme.palette.black : Theme.palette.white
}
}
- popupMenuDelegate: StatusListItem {
- implicitWidth: 272
- title: name
- subTitle: LocaleUtils.currencyAmountToLocaleString(currencyBalance)
- asset.emoji: !!emoji ? emoji: ""
- asset.color: model.color
- asset.name: !emoji ? "filled-account": ""
- asset.letterSize: 14
- asset.isLetterIdenticon: !!model.emoji
- asset.bgColor: Theme.palette.indirectColor1
+
+ control.padding: 0
+ control.spacing: 0
+ control.leftPadding: 8
+ control.rightPadding: 8
+ control.topPadding: 10
+
+ control.popup.width: 430
+ control.indicator: null
+
+ control.background: Rectangle {
+ width: contentItem.childrenRect.width + control.leftPadding + control.rightPadding
+ height: 32
+ radius: 8
+ color: !!selectedAccount ? hoverHandler.containsMouse ?
+ Theme.palette.walletAccountColors.getHoveredColor(selectedAccount.color) :
+ selectedAccount.color ?? "transparent" : "transparent"
+ HoverHandler {
+ id: hoverHandler
+ cursorShape: Qt.PointingHandCursor
+ }
+ }
+
+ contentItem: Row {
+ anchors.verticalCenter: parent.verticalCenter
+ width: childrenRect.width
+ spacing: 8
+ StatusEmoji {
+ anchors.verticalCenter: parent.verticalCenter
+ width: 16
+ height: 16
+ emojiId: StatusQUtils.Emoji.iconId(selectedAccount.emoji ?? "", StatusQUtils.Emoji.size.verySmall) || ""
+ }
+ StatusBaseText {
+ anchors.verticalCenter: parent.verticalCenter
+ text: selectedAccount.name ?? ""
+ font.pixelSize: 15
+ color: d.getTextColorForWhite(selectedAccount.color ?? "")
+ }
+ StatusIcon {
+ anchors.verticalCenter: parent.verticalCenter
+ width: 16
+ height: width
+ icon: "chevron-down"
+ color: d.getTextColorForWhite(selectedAccount.color ?? "")
+ }
+ }
+
+ delegate: WalletAccountListItem {
+ width: ListView.view.width
+ modelData: model
+ chainShortNames: root.chainShortNames
+ color: sensor.containsMouse || highlighted ?
+ Theme.palette.baseColor2 :
+ selectedAccount.name === model.name ? Theme.palette.statusListItem.highlightColor : "transparent"
onClicked: {
- changeSelectedAccount(model)
- root.selectItem(index)
+ selectedIndex = index
+ control.popup.close()
}
}
}
diff --git a/ui/imports/shared/popups/SendModal.qml b/ui/imports/shared/popups/SendModal.qml
index 809cd26436..fb0cd583ec 100644
--- a/ui/imports/shared/popups/SendModal.qml
+++ b/ui/imports/shared/popups/SendModal.qml
@@ -95,6 +95,12 @@ StatusDialog {
if(errorType === Constants.SendAmountExceedsBalance)
bestRoutes = []
}
+
+ function setSelectedAccount() {
+ popup.selectedAccount = header.model.get(header.selectedIndex)
+ if(!!assetSelector.selectedAsset)
+ assetSelector.selectedAsset = store.getAsset(selectedAccount.assets, assetSelector.selectedAsset.symbol)
+ }
}
width: 556
@@ -149,6 +155,7 @@ StatusDialog {
onClosed: popup.store.resetTxStoreProperties()
header: AccountsModalHeader {
+ id: header
anchors.top: parent.top
anchors.topMargin: -height - 18
model: SortFilterProxyModel {
@@ -159,11 +166,14 @@ StatusDialog {
inverted: true
}
}
- currentAddress: popup.store.overview.mixedcaseAddress
- changeSelectedAccount: function(newAccount) {
- popup.selectedAccount = newAccount
- if (assetSelector.selectedAsset) {
- assetSelector.selectedAsset = store.getAsset(popup.selectedAccount.assets, assetSelector.selectedAsset.symbol)
+ selectedIndex: store.getUserSelectedAccountIndex(header.model)
+ selectedAccount: !!popup.selectedAccount ? popup.selectedAccount: {}
+ chainShortNames: store.getAllNetworksSupportedString()
+ onSelectedIndexChanged: d.setSelectedAccount()
+ Connections {
+ target: popup.store.accounts
+ function onModelReset() {
+ d.setSelectedAccount()
}
}
}
@@ -248,7 +258,7 @@ StatusDialog {
visible: !!assetSelector.selectedAsset || !!assetSelector.hoveredToken
title: {
if(!!assetSelector.hoveredToken) {
- const balance = popup.currencyStore.formatCurrencyAmount(assetSelector.hoveredToken.totalCurrencyBalance.amount, assetSelector.hoveredToken.symbol)
+ const balance = popup.currencyStore.formatCurrencyAmount((amountToSendInput.inputIsFiat ? assetSelector.hoveredToken.totalCurrencyBalance.amount : assetSelector.hoveredToken.totalBalance.amount) , assetSelector.hoveredToken.symbol)
return qsTr("Max: %1").arg(balance)
}
if (d.maxInputBalance <= 0)
@@ -278,7 +288,6 @@ StatusDialog {
return RootStore.getNetworkIcon(chainId)
}
onTokenSelected: {
- assetSelector.userSelectedToken = selectedToken.symbol
assetSelector.selectedAsset = selectedToken
}
onTokenHovered: {
diff --git a/ui/imports/shared/stores/TransactionStore.qml b/ui/imports/shared/stores/TransactionStore.qml
index 8d8a126f8f..738e87321a 100644
--- a/ui/imports/shared/stores/TransactionStore.qml
+++ b/ui/imports/shared/stores/TransactionStore.qml
@@ -307,4 +307,12 @@ QtObject {
}
return result
}
+
+ function getUserSelectedAccountIndex(model) {
+ for (let i = 0; i < model.count; i++) {
+ if(model.get(i).address.toUpperCase() === root.overview.mixedcaseAddress.toUpperCase()) {
+ return i
+ }
+ }
+ }
}
diff --git a/ui/imports/shared/views/NetworksSimpleRoutingView.qml b/ui/imports/shared/views/NetworksSimpleRoutingView.qml
index 51f540f7e8..5ce20fb7a0 100644
--- a/ui/imports/shared/views/NetworksSimpleRoutingView.qml
+++ b/ui/imports/shared/views/NetworksSimpleRoutingView.qml
@@ -131,7 +131,7 @@ RowLayout {
rightPadding: 5
implicitWidth: 410
title: chainName
- property bool tokenBalanceOnChainValid: selectedAccount && selectedAccount !== undefined && selectedAsset !== undefined
+ property bool tokenBalanceOnChainValid: selectedAccount && selectedAccount !== undefined && selectedAsset && selectedAsset !== undefined
property double tokenBalanceOnChain: tokenBalanceOnChainValid ? root.store.getTokenBalanceOnChain(selectedAccount, chainId, selectedAsset.symbol).amount : 0.0
subTitle: tokenBalanceOnChainValid ? root.formatCurrencyAmount(tokenBalanceOnChain, selectedAsset.symbol) : "N/A"
statusListItemSubTitle.color: Theme.palette.primaryColor1
diff --git a/ui/imports/shared/views/TabAddressSelectorView.qml b/ui/imports/shared/views/TabAddressSelectorView.qml
index 18e7e34cca..a9de838f8c 100644
--- a/ui/imports/shared/views/TabAddressSelectorView.qml
+++ b/ui/imports/shared/views/TabAddressSelectorView.qml
@@ -180,7 +180,7 @@ Item {
statusListItemTitle.elide: Text.ElideMiddle
statusListItemTitle.wrapMode: Text.NoWrap
radius: 0
- color: sensor.containsMouse || highlighted ? Theme.palette.statusListItem.highlightColor : "transparent"
+ color: sensor.containsMouse || highlighted ? Theme.palette.baseColor2 : "transparent"
statusListItemComponentsSlot.spacing: 5
loading: loadingTransaction
components: [
diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml
index b1bd38e891..bff90ac7ef 100644
--- a/ui/imports/utils/Constants.qml
+++ b/ui/imports/utils/Constants.qml
@@ -949,8 +949,9 @@ QtObject {
readonly property string expired: "expired"
readonly property string failedResending: "failedResending"
- readonly property var preDefinedWalletAccountColors:[ StatusColors.colors['black'],
- StatusColors.colors['grey'],
+ readonly property var preDefinedWalletAccountColors:[
+ StatusColors.colors['black'],
+ StatusColors.colors['white'],
StatusColors.colors['blue2'],
StatusColors.colors['purple'],
StatusColors.colors['cyan'],
@@ -960,7 +961,8 @@ QtObject {
StatusColors.colors['green2'],
StatusColors.colors['moss'],
StatusColors.colors['brown'],
- StatusColors.colors['brown2'] ]
+ StatusColors.colors['brown2']
+ ]
readonly property QtObject appTranslatableConstants: QtObject {
readonly property string loginAccountsListAddNewUser: "LOGIN-ACCOUNTS-LIST-ADD-NEW-USER"