2023-05-19 09:51:47 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
|
|
|
|
import shared.controls 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
orientation: Qt.Vertical
|
|
|
|
|
|
|
|
property bool globalUtilsReady: false
|
|
|
|
property bool mainModuleReady: false
|
|
|
|
|
|
|
|
Item {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: loader
|
|
|
|
anchors.margins: -1
|
|
|
|
color: "transparent"
|
|
|
|
border.width: 1
|
|
|
|
border.color: "#20000000"
|
|
|
|
}
|
|
|
|
|
|
|
|
// globalUtilsInst mock
|
|
|
|
QtObject {
|
|
|
|
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
|
|
|
function getColorHashAsJson(publicKey) {
|
|
|
|
return JSON.stringify([{"segmentLength":1,"colorId":12},{"segmentLength":5,"colorId":18},
|
|
|
|
{"segmentLength":3,"colorId":25},{"segmentLength":3,"colorId":23},
|
|
|
|
{"segmentLength":1,"colorId":10},{"segmentLength":3,"colorId":26},
|
|
|
|
{"segmentLength":2,"colorId":30},{"segmentLength":1,"colorId":18},
|
|
|
|
{"segmentLength":4,"colorId":28},{"segmentLength":1,"colorId":17},
|
|
|
|
{"segmentLength":2,"colorId":2}])
|
|
|
|
}
|
|
|
|
function isCompressedPubKey(publicKey) { return true }
|
|
|
|
function getColorId(publicKey) { return Math.floor(Math.random() * 10) }
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
Utils.globalUtilsInst = this
|
|
|
|
root.globalUtilsReady = true
|
|
|
|
}
|
|
|
|
Component.onDestruction: {
|
|
|
|
root.globalUtilsReady = false
|
|
|
|
Utils.globalUtilsInst = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// mainModuleInst mock
|
|
|
|
QtObject {
|
|
|
|
function getContactDetailsAsJson(publicKey, getVerification) {
|
|
|
|
return JSON.stringify({
|
|
|
|
displayName: "ArianaP",
|
|
|
|
displayIcon: "",
|
|
|
|
publicKey: publicKey,
|
|
|
|
name: "",
|
|
|
|
alias: "",
|
|
|
|
localNickname: "",
|
2023-05-22 10:16:39 +00:00
|
|
|
isContact: d.isContact
|
2023-05-19 09:51:47 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
function isEnsVerified(publicKey) { return false }
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
Utils.mainModuleInst = this
|
|
|
|
root.mainModuleReady = true
|
|
|
|
}
|
|
|
|
Component.onDestruction: {
|
|
|
|
root.mainModuleReady = false
|
|
|
|
Utils.mainModuleInst = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
property string addressName: "Ariana Pearlona"
|
|
|
|
property bool isContact: true
|
2023-05-22 10:16:39 +00:00
|
|
|
property bool isWallet: false
|
|
|
|
property bool isSavedAccount: false
|
2024-10-04 15:23:26 +00:00
|
|
|
readonly property string displayAddress: "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
|
2023-05-22 10:16:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: contactsStoreMockup
|
|
|
|
readonly property var myContactsModel: QtObject {
|
|
|
|
signal itemChanged(address: string)
|
|
|
|
}
|
|
|
|
|
|
|
|
function getContactPublicKeyByAddress(address) {
|
|
|
|
return d.isContact ? "zQ3shWU7xpM5YoG19KP5JDRiSs1AdWtjpnrWEerMkxfQnYo7x" : ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: rootStoreMockup
|
|
|
|
|
|
|
|
readonly property var accounts: QtObject {
|
|
|
|
signal itemChanged(address: string)
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property var savedAddresses: QtObject {
|
|
|
|
readonly property var sourceModel: QtObject {
|
|
|
|
signal itemChanged(address: string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getNameForSavedWalletAddress(address) {
|
|
|
|
return d.isSavedAccount ? d.addressName : ""
|
|
|
|
}
|
|
|
|
function getEmojiForWalletAddress(address) {
|
|
|
|
return '<img class="emoji" draggable="false" alt="??" src="' + Style.emoji("1f61b") + '?72x72" width="16" height="16" style="vertical-align: top"/>'
|
|
|
|
}
|
|
|
|
function getColorForWalletAddress(address) {
|
|
|
|
return "blue"
|
|
|
|
}
|
|
|
|
function getNameForWalletAddress(address) {
|
|
|
|
return d.isWallet ? d.addressName : ""
|
|
|
|
}
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 400
|
|
|
|
active: root.globalUtilsReady && root.mainModuleReady
|
|
|
|
sourceComponent: TransactionAddress {
|
|
|
|
width: parent.width
|
2023-05-22 10:16:39 +00:00
|
|
|
address: d.displayAddress
|
|
|
|
rootStore: rootStoreMockup
|
|
|
|
contactsStore: contactsStoreMockup
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 150
|
|
|
|
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 5
|
2023-05-22 10:16:39 +00:00
|
|
|
Label {
|
|
|
|
text: "Account type"
|
|
|
|
}
|
|
|
|
RadioButton {
|
|
|
|
text: "contact"
|
2023-05-19 09:51:47 +00:00
|
|
|
checked: d.isContact
|
2023-05-22 10:16:39 +00:00
|
|
|
onClicked: {
|
|
|
|
d.isContact = true
|
|
|
|
d.isWallet = false
|
|
|
|
d.isSavedAccount = false
|
|
|
|
rootStoreMockup.accounts.itemChanged(d.displayAddress)
|
|
|
|
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
|
|
|
|
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
|
|
|
|
}
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
2023-05-22 10:16:39 +00:00
|
|
|
RadioButton {
|
|
|
|
text: "wallet"
|
|
|
|
checked: d.isWallet
|
|
|
|
onClicked: {
|
|
|
|
d.isContact = false
|
|
|
|
d.isWallet = true
|
|
|
|
d.isSavedAccount = false
|
|
|
|
rootStoreMockup.accounts.itemChanged(d.displayAddress)
|
|
|
|
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
|
|
|
|
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
|
|
|
|
}
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
2023-05-22 10:16:39 +00:00
|
|
|
RadioButton {
|
|
|
|
text: "saved address"
|
|
|
|
checked: d.isSavedAccount
|
|
|
|
onClicked: {
|
|
|
|
d.isContact = false
|
|
|
|
d.isWallet = false
|
|
|
|
d.isSavedAccount = true
|
|
|
|
rootStoreMockup.accounts.itemChanged(d.displayAddress)
|
|
|
|
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
|
|
|
|
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
2023-05-22 10:16:39 +00:00
|
|
|
}
|
|
|
|
RadioButton {
|
|
|
|
text: "unkown"
|
|
|
|
onClicked: {
|
|
|
|
d.isContact = false
|
|
|
|
d.isWallet = false
|
|
|
|
d.isSavedAccount = false
|
|
|
|
rootStoreMockup.accounts.itemChanged(d.displayAddress)
|
|
|
|
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
|
|
|
|
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Label {
|
2023-05-22 10:16:39 +00:00
|
|
|
text: "Name:"
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
TextField {
|
|
|
|
text: d.addressName
|
|
|
|
onTextChanged: d.addressName = text
|
|
|
|
}
|
2023-05-22 10:16:39 +00:00
|
|
|
}
|
2023-05-19 09:51:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Wallet
|