2022-03-18 14:47:51 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.stores 1.0
|
|
|
|
|
|
|
|
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 "../panels"
|
|
|
|
import "../controls"
|
|
|
|
import "../views"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
clip: true
|
2022-07-20 14:13:23 +00:00
|
|
|
implicitHeight: accountSelectionTabBar.height + stackLayout.height + Style.current.bigPadding
|
2022-03-18 14:47:51 +00:00
|
|
|
|
|
|
|
property var store
|
|
|
|
|
|
|
|
signal contactSelected(string address, int type)
|
|
|
|
|
2022-05-23 11:45:29 +00:00
|
|
|
StatusTabBar {
|
2022-03-18 14:47:51 +00:00
|
|
|
id: accountSelectionTabBar
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 20
|
2022-07-14 17:47:59 +00:00
|
|
|
anchors.left: parent.left
|
2022-03-18 14:47:51 +00:00
|
|
|
width: parent.width
|
2022-05-23 11:45:29 +00:00
|
|
|
|
2022-03-18 14:47:51 +00:00
|
|
|
StatusTabButton {
|
|
|
|
id: assetBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Saved")
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
StatusTabButton {
|
|
|
|
id: collectiblesBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("My Accounts")
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
StatusTabButton {
|
|
|
|
id: historyBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Recent")
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StackLayout {
|
|
|
|
id: stackLayout
|
|
|
|
anchors.top: accountSelectionTabBar.bottom
|
2022-04-11 18:59:49 +00:00
|
|
|
height: currentIndex === 0 ? savedAddresses.height: currentIndex === 1 ? myAccounts.height : recents.height
|
2022-03-18 14:47:51 +00:00
|
|
|
width: parent.width
|
|
|
|
currentIndex: accountSelectionTabBar.currentIndex
|
|
|
|
|
|
|
|
// To-do adapt to new design and make block white/balck once the list items etc support new color scheme
|
|
|
|
Rectangle {
|
2022-04-11 18:59:49 +00:00
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
Layout.maximumHeight : savedAddresses.height
|
2022-07-20 14:13:23 +00:00
|
|
|
color: Theme.palette.indirectColor1
|
2022-03-18 14:47:51 +00:00
|
|
|
radius: 8
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
2022-03-18 14:47:51 +00:00
|
|
|
id: savedAddresses
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
2022-07-20 14:13:23 +00:00
|
|
|
implicitWidth: parent.width
|
2022-03-18 14:47:51 +00:00
|
|
|
height: Math.min(288, savedAddresses.contentHeight)
|
|
|
|
|
|
|
|
model: root.store.savedAddressesModel
|
|
|
|
header: savedAddresses.count > 0 ? search : nothingInList
|
|
|
|
headerPositioning: ListView.OverlayHeader
|
|
|
|
delegate: StatusListItem {
|
2022-07-20 14:13:23 +00:00
|
|
|
implicitWidth: parent.width
|
2022-03-18 14:47:51 +00:00
|
|
|
height: visible ? 64 : 0
|
|
|
|
title: name
|
|
|
|
subTitle: address
|
|
|
|
radius: 0
|
2022-07-20 14:13:23 +00:00
|
|
|
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor3 : "transparent"
|
2022-03-18 14:47:51 +00:00
|
|
|
visible: !savedAddresses.headerItem.text || name.toLowerCase().includes(savedAddresses.headerItem.text)
|
2022-07-20 14:13:23 +00:00
|
|
|
// TODO uncomment when #6456 is fixed
|
|
|
|
// components: [
|
|
|
|
// StatusIcon {
|
|
|
|
// icon: "star-icon"
|
|
|
|
// width: 12
|
|
|
|
// height: 12
|
|
|
|
// }
|
|
|
|
// ]
|
2022-03-18 14:47:51 +00:00
|
|
|
onClicked: contactSelected(address, RecipientSelector.Type.Address )
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: search
|
2022-07-20 14:13:23 +00:00
|
|
|
ColumnLayout {
|
2022-03-18 14:47:51 +00:00
|
|
|
width: parent.width
|
2022-07-20 14:13:23 +00:00
|
|
|
StatusBaseInput {
|
|
|
|
Layout.preferredHeight: 55
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
showBackground: false
|
|
|
|
placeholderText: qsTr("Search for saved address")
|
|
|
|
rightComponent: StatusIcon {
|
|
|
|
icon: "search"
|
|
|
|
height: 17
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
color: Theme.palette.baseColor3
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: nothingInList
|
|
|
|
StatusBaseText {
|
2022-07-20 14:13:23 +00:00
|
|
|
width: savedAddresses.width
|
|
|
|
height: visible ? 56 : 0
|
2022-03-18 14:47:51 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: qsTr("No Saved Address")
|
2022-07-20 14:13:23 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle {
|
2022-04-11 18:59:49 +00:00
|
|
|
id: myAccountsRect
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
Layout.maximumHeight : myAccounts.height
|
2022-07-20 14:13:23 +00:00
|
|
|
color: Theme.palette.indirectColor1
|
2022-03-18 14:47:51 +00:00
|
|
|
radius: 8
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
2022-03-18 14:47:51 +00:00
|
|
|
id: myAccounts
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
width: parent.width
|
|
|
|
height: Math.min(288, myAccounts.contentHeight)
|
|
|
|
|
|
|
|
delegate: StatusListItem {
|
2022-07-20 14:13:23 +00:00
|
|
|
implicitWidth: parent.width
|
2022-03-18 14:47:51 +00:00
|
|
|
height: visible ? 64 : 0
|
2022-07-20 14:54:30 +00:00
|
|
|
title: !!model.name ? model.name : ""
|
2022-07-01 11:24:32 +00:00
|
|
|
subTitle: Utils.toLocaleString(model.currencyBalance.toFixed(2), store.locale, {"model.currency": true}) + " " + store.currentCurrency.toUpperCase()
|
2022-03-18 14:47:51 +00:00
|
|
|
icon.emoji: !!model.emoji ? model.emoji: ""
|
|
|
|
icon.color: model.color
|
|
|
|
icon.name: !model.emoji ? "filled-account": ""
|
|
|
|
icon.letterSize: 14
|
|
|
|
icon.isLetterIdenticon: !!model.emoji ? true : false
|
|
|
|
icon.background.color: Theme.palette.indirectColor1
|
|
|
|
radius: 0
|
2022-07-20 14:13:23 +00:00
|
|
|
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor3 : "transparent"
|
2022-03-18 14:47:51 +00:00
|
|
|
onClicked: contactSelected(model.address, RecipientSelector.Type.Account )
|
|
|
|
}
|
|
|
|
|
|
|
|
model: root.store.accounts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
2022-04-11 18:59:49 +00:00
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
Layout.maximumHeight : recents.height
|
2022-07-20 14:13:23 +00:00
|
|
|
color: Theme.palette.indirectColor1
|
2022-03-18 14:47:51 +00:00
|
|
|
radius: 8
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
2022-03-18 14:47:51 +00:00
|
|
|
id: recents
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
width: parent.width
|
|
|
|
height: Math.min(288, recents.contentHeight)
|
|
|
|
|
|
|
|
header: StatusBaseText {
|
2022-07-20 14:13:23 +00:00
|
|
|
height: visible ? 56 : 0
|
|
|
|
width: recents.width
|
2022-03-18 14:47:51 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: qsTr("No Recents")
|
2022-07-20 14:13:23 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2022-03-18 14:47:51 +00:00
|
|
|
visible: recents.count <= 0
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: StatusListItem {
|
2022-07-01 11:24:32 +00:00
|
|
|
property bool isIncoming: to === store.currentAccount.address
|
2022-07-14 17:47:59 +00:00
|
|
|
implicitWidth: parent.width
|
2022-03-18 14:47:51 +00:00
|
|
|
height: visible ? 64 : 0
|
|
|
|
title: isIncoming ? from : to
|
|
|
|
subTitle: Utils.getTimeDifference(new Date(parseInt(timestamp) * 1000), new Date())
|
|
|
|
statusListItemTitle.elide: Text.ElideMiddle
|
|
|
|
statusListItemTitle.wrapMode: Text.NoWrap
|
|
|
|
radius: 0
|
2022-07-20 14:13:23 +00:00
|
|
|
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor3 : "transparent"
|
2022-03-18 14:47:51 +00:00
|
|
|
components: [
|
|
|
|
StatusIcon {
|
|
|
|
id: transferIcon
|
|
|
|
height: 15
|
|
|
|
width: 15
|
|
|
|
color: isIncoming ? Style.current.success : Style.current.danger
|
2022-07-01 11:24:32 +00:00
|
|
|
icon: isIncoming ? "arrow-down" : "arrow-up"
|
2022-03-18 14:47:51 +00:00
|
|
|
rotation: 45
|
|
|
|
},
|
|
|
|
StatusBaseText {
|
|
|
|
id: contactsLabel
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
2022-07-01 11:24:32 +00:00
|
|
|
text: store.hex2Eth(value)
|
2022-03-18 14:47:51 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
onClicked: contactSelected(title, RecipientSelector.Type.Address)
|
|
|
|
}
|
|
|
|
|
|
|
|
model: root.store.walletSectionTransactionsInst.model
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|