2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
import StatusQ 0.1
|
2022-07-19 13:17:35 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2022-08-03 12:51:47 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-07-19 13:17:35 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-04-26 15:53:49 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2024-04-10 20:56:10 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2022-07-19 13:17:35 +00:00
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
import "../controls"
|
2020-05-28 13:49:28 +00:00
|
|
|
|
|
|
|
Item {
|
2022-07-19 13:17:35 +00:00
|
|
|
id: root
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-03-15 09:17:25 +00:00
|
|
|
property var networkConnectionStore
|
2023-04-13 09:59:17 +00:00
|
|
|
property var overview
|
2022-01-31 13:29:27 +00:00
|
|
|
property var store
|
2022-02-15 13:19:45 +00:00
|
|
|
property var walletStore
|
2020-06-03 19:59:18 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
property alias headerButton: headerButton
|
|
|
|
property alias networkFilter: networkFilter
|
|
|
|
|
|
|
|
signal buttonClicked()
|
2023-04-26 15:53:49 +00:00
|
|
|
|
2022-09-13 16:17:54 +00:00
|
|
|
implicitHeight: 88
|
2020-05-28 13:49:28 +00:00
|
|
|
|
2022-07-19 13:17:35 +00:00
|
|
|
GridLayout {
|
|
|
|
width: parent.width
|
|
|
|
columns: 2
|
2023-04-26 15:53:49 +00:00
|
|
|
rowSpacing: 0
|
2020-05-28 13:49:28 +00:00
|
|
|
|
2022-07-19 13:17:35 +00:00
|
|
|
// account + balance
|
2022-09-13 16:17:54 +00:00
|
|
|
RowLayout {
|
2022-07-19 13:17:35 +00:00
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
StatusBaseText {
|
2023-12-26 15:27:53 +00:00
|
|
|
objectName: "walletHeaderTitle"
|
2022-09-13 16:17:54 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-04-26 15:53:49 +00:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2023-12-26 10:19:41 +00:00
|
|
|
color: {
|
|
|
|
if (root.walletStore.showSavedAddresses)
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
|
|
|
|
return overview.isAllAccounts ? Theme.palette.directColor5 : Utils.getColorForId(overview.colorId)
|
|
|
|
}
|
2023-04-26 15:53:49 +00:00
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
lineHeight: 38
|
2022-07-19 13:17:35 +00:00
|
|
|
font.bold: true
|
2023-04-26 15:53:49 +00:00
|
|
|
font.pixelSize: 28
|
2023-12-26 10:19:41 +00:00
|
|
|
text: {
|
|
|
|
if (root.walletStore.showSavedAddresses)
|
|
|
|
return qsTr("Saved addresses")
|
|
|
|
|
2024-05-27 09:35:07 +00:00
|
|
|
return overview.isAllAccounts ? qsTr("All accounts") : overview.name
|
2023-12-26 10:19:41 +00:00
|
|
|
}
|
2022-07-19 13:17:35 +00:00
|
|
|
}
|
2023-04-26 15:53:49 +00:00
|
|
|
StatusEmoji {
|
2022-09-13 16:17:54 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-04-26 15:53:49 +00:00
|
|
|
Layout.preferredWidth: 28
|
|
|
|
Layout.preferredHeight: 28
|
2023-12-26 10:19:41 +00:00
|
|
|
emojiId: !!root.overview && StatusQUtils.Emoji.iconId(root.overview.emoji ?? "", StatusQUtils.Emoji.size.big) || ""
|
|
|
|
visible: !root.walletStore.showSavedAddresses &&
|
|
|
|
!!root.overview && !root.overview.isAllAccounts
|
2022-07-19 13:17:35 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-28 13:49:28 +00:00
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
RowLayout {
|
|
|
|
spacing: 16
|
2022-07-19 13:17:35 +00:00
|
|
|
Layout.alignment: Qt.AlignTrailing
|
2023-04-26 15:53:49 +00:00
|
|
|
Layout.topMargin: 5
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-05-06 17:55:11 +00:00
|
|
|
DAppsWorkflow {
|
2024-04-10 20:56:10 +00:00
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
|
|
|
spacing: 8
|
2024-05-01 16:15:42 +00:00
|
|
|
|
2024-05-06 17:55:11 +00:00
|
|
|
visible: !root.walletStore.showSavedAddresses && Global.featureFlags.dappsEnabled
|
2024-05-06 20:22:43 +00:00
|
|
|
enabled: !!Global.walletConnectService
|
|
|
|
|
|
|
|
wcService: Global.walletConnectService
|
2024-04-10 20:56:10 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
StatusButton {
|
2023-12-26 10:19:41 +00:00
|
|
|
id: headerButton
|
2023-12-26 15:27:53 +00:00
|
|
|
objectName: "walletHeaderButton"
|
2023-04-26 15:53:49 +00:00
|
|
|
Layout.preferredHeight: 38
|
|
|
|
Layout.alignment: Qt.AlignTop
|
2023-03-08 13:44:47 +00:00
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
spacing: 8
|
|
|
|
size: StatusBaseButton.Size.Small
|
2023-12-26 10:19:41 +00:00
|
|
|
borderColor: root.walletStore.showSavedAddresses? "transparent" : Theme.palette.directColor7
|
|
|
|
normalColor: root.walletStore.showSavedAddresses? Theme.palette.primaryColor3 : Theme.palette.transparent
|
|
|
|
hoverColor: root.walletStore.showSavedAddresses? Theme.palette.primaryColor2 : Theme.palette.baseColor2
|
2023-04-26 15:53:49 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
font.weight: root.walletStore.showSavedAddresses? Font.Medium : Font.Normal
|
2023-04-26 15:53:49 +00:00
|
|
|
textPosition: StatusBaseButton.TextPosition.Left
|
2023-12-26 10:19:41 +00:00
|
|
|
textColor: root.walletStore.showSavedAddresses? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
2023-04-26 15:53:49 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
icon.name: root.walletStore.showSavedAddresses? "" : "invite-users"
|
2023-04-26 15:53:49 +00:00
|
|
|
icon.height: 16
|
|
|
|
icon.width: 16
|
|
|
|
icon.color: hovered ? Theme.palette.directColor1 : Theme.palette.baseColor1
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
2020-05-28 13:49:28 +00:00
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
// network filter
|
|
|
|
NetworkFilter {
|
|
|
|
id: networkFilter
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
flatNetworks: walletStore.filteredFlatModel
|
2024-06-15 21:33:12 +00:00
|
|
|
onToggleNetwork: walletStore.toggleNetwork(chainId)
|
2023-04-26 15:53:49 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
Binding on selection {
|
|
|
|
value: chainIdsAggregator.value
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionAggregator {
|
|
|
|
id: chainIdsAggregator
|
|
|
|
|
|
|
|
readonly property SortFilterProxyModel enabledNetworksModel: SortFilterProxyModel{
|
|
|
|
sourceModel: walletStore.filteredFlatModel
|
|
|
|
filters: ValueFilter {
|
|
|
|
roleName: "isEnabled"
|
|
|
|
value: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
model: enabledNetworksModel
|
|
|
|
initialValue: []
|
|
|
|
roleName: "chainId"
|
|
|
|
|
|
|
|
aggregateFunction: (aggr, value) => [...aggr, value]
|
|
|
|
}
|
2023-04-26 15:53:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
spacing: 4
|
2023-12-26 10:19:41 +00:00
|
|
|
visible: !root.walletStore.showSavedAddresses &&
|
|
|
|
!!root.networkConnectionStore &&
|
|
|
|
!networkConnectionStore.accountBalanceNotAvailable
|
2023-04-26 15:53:49 +00:00
|
|
|
StatusTextWithLoadingState {
|
|
|
|
font.pixelSize: 28
|
|
|
|
font.bold: true
|
|
|
|
customColor: Theme.palette.directColor1
|
2023-12-26 10:19:41 +00:00
|
|
|
text: loading ?
|
|
|
|
Constants.dummyText :
|
|
|
|
!!root.overview?
|
|
|
|
LocaleUtils.currencyAmountToLocaleString(root.overview.currencyBalance) : ""
|
|
|
|
loading: !!root.overview && root.overview.balanceLoading
|
2023-04-26 15:53:49 +00:00
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
lineHeight: 38
|
|
|
|
}
|
2022-07-19 13:17:35 +00:00
|
|
|
}
|
2022-02-15 13:19:45 +00:00
|
|
|
}
|
2022-07-19 13:17:35 +00:00
|
|
|
}
|