2023-11-22 19:58:02 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
import StatusQ 0.1
|
2024-01-31 18:09:44 +00:00
|
|
|
import StatusQ.Models 0.1
|
2023-11-22 19:58:02 +00:00
|
|
|
import StatusQ.Core 0.1
|
2023-11-24 12:16:13 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2023-11-22 19:58:02 +00:00
|
|
|
|
|
|
|
import mainui 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
2024-03-19 23:34:25 +00:00
|
|
|
import shared.controls 1.0
|
2023-11-22 19:58:02 +00:00
|
|
|
import shared.views 1.0
|
2023-12-18 10:12:57 +00:00
|
|
|
import shared.stores 1.0
|
2023-11-22 19:58:02 +00:00
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
import Models 1.0
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
import AppLayouts.Wallet.views 1.0
|
2023-11-28 19:16:18 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2023-11-22 19:58:02 +00:00
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
Logs { id: logs }
|
|
|
|
|
|
|
|
orientation: Qt.Horizontal
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property string networksChainsCurrentlySelected: {
|
2024-03-19 23:34:25 +00:00
|
|
|
let supportedNwChains = []
|
|
|
|
for (let i = 0; i< networksRepeater.count; i++) {
|
2023-11-24 12:16:13 +00:00
|
|
|
if (networksRepeater.itemAt(i).checked && networksRepeater.itemAt(i).visible)
|
2024-03-19 23:34:25 +00:00
|
|
|
supportedNwChains.push(networksRepeater.itemAt(i).chainID)
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-03-19 23:34:25 +00:00
|
|
|
return supportedNwChains.join(":")
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
readonly property string addressesSelected: {
|
2024-03-19 23:34:25 +00:00
|
|
|
let supportedAddresses = []
|
|
|
|
for (let i = 0; i< accountsRepeater.count; i++) {
|
2023-11-24 12:16:13 +00:00
|
|
|
if (accountsRepeater.itemAt(i).checked && accountsRepeater.itemAt(i).visible)
|
2024-03-19 23:34:25 +00:00
|
|
|
supportedAddresses.push(accountsRepeater.itemAt(i).address)
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-03-19 23:34:25 +00:00
|
|
|
return supportedAddresses.join(":")
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
|
2023-12-18 10:12:57 +00:00
|
|
|
readonly property var currencyStore: CurrenciesStore {}
|
2023-11-24 12:16:13 +00:00
|
|
|
|
2023-11-28 19:16:18 +00:00
|
|
|
property WalletAssetsStore walletAssetStore: WalletAssetsStore {
|
|
|
|
assetsWithFilteredBalances: d.assetsWithFilteredBalances
|
2024-01-31 18:09:44 +00:00
|
|
|
assetsController: assetsView.controller
|
2023-11-28 19:16:18 +00:00
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
|
|
|
|
// Added this here simply because the network and address filtering wont work in Storybook applied in AssetsView
|
|
|
|
readonly property SubmodelProxyModel assetsWithFilteredBalances: SubmodelProxyModel {
|
2023-11-28 19:16:18 +00:00
|
|
|
sourceModel: d.walletAssetStore.groupedAccountsAssetsModel
|
2023-11-24 12:16:13 +00:00
|
|
|
submodelRoleName: "balances"
|
|
|
|
delegateModel: SortFilterProxyModel {
|
|
|
|
sourceModel: submodel
|
2024-03-19 23:34:25 +00:00
|
|
|
filters: FastExpressionFilter {
|
2023-11-24 12:16:13 +00:00
|
|
|
expression: {
|
|
|
|
d.networksChainsCurrentlySelected
|
2024-03-19 23:34:25 +00:00
|
|
|
return d.networksChainsCurrentlySelected.split(":").includes(model.chainId+"")
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
2024-03-19 23:34:25 +00:00
|
|
|
expectedRoles: ["chainId"]
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Popups {
|
|
|
|
popupParent: root
|
|
|
|
rootStore: QtObject {}
|
|
|
|
communityTokensStore: QtObject {}
|
2024-01-31 18:09:44 +00:00
|
|
|
walletAssetsStore: d.walletAssetStore
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
StackLayout {
|
|
|
|
id: stack
|
|
|
|
SplitView.fillWidth: true
|
2023-11-22 19:58:02 +00:00
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
currentIndex: 0
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2023-11-24 12:16:13 +00:00
|
|
|
AssetsView {
|
|
|
|
id: assetsView
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
areAssetsLoading: loadingCheckbox.checked
|
2024-01-31 18:09:44 +00:00
|
|
|
controller: ManageTokensController {
|
|
|
|
sourceModel: d.walletAssetStore.groupedAccountAssetsModel
|
|
|
|
settingsKey: "WalletAssets"
|
2024-03-01 02:04:36 +00:00
|
|
|
serializeAsCollectibles: false
|
|
|
|
|
|
|
|
onRequestSaveSettings: (jsonData) => saveToQSettings(jsonData)
|
|
|
|
onRequestLoadSettings: loadFromQSettings()
|
|
|
|
onRequestClearSettings: clearQSettings()
|
|
|
|
|
2024-01-31 18:09:44 +00:00
|
|
|
onTokenHidden: (symbol, name) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 (%2) was successfully hidden").arg(name).arg(symbol), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onCommunityTokenGroupHidden: (communityName) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 community assets successfully hidden").arg(communityName), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onTokenShown: (symbol, name) => Global.displayToastMessage(qsTr("%1 is now visible").arg(name), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onCommunityTokenGroupShown: (communityName) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 community assets are now visible").arg(communityName), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
filterVisible: ctrlFilterVisible.checked
|
|
|
|
currencyStore: d.currencyStore
|
2024-03-19 23:34:25 +00:00
|
|
|
tokensStore: TokensStore {
|
|
|
|
displayAssetsBelowBalance: ctrlBalanceThresholdSwitch.checked
|
|
|
|
getDisplayAssetsBelowBalanceThresholdDisplayAmount: () => ctrlBalanceThreshold.value
|
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
networkFilters: d.networksChainsCurrentlySelected
|
|
|
|
addressFilters: d.addressesSelected
|
|
|
|
onAssetClicked: {
|
|
|
|
stack.currentIndex = 1
|
|
|
|
detailsView.token = token
|
|
|
|
logs.logEvent("onAssetClicked", ["token"], [token.symbol, token.communityId])
|
|
|
|
}
|
|
|
|
onSendRequested: logs.logEvent("onSendRequested", ["symbol"], arguments)
|
|
|
|
onReceiveRequested: logs.logEvent("onReceiveRequested", ["symbol"], arguments)
|
|
|
|
onSwitchToCommunityRequested: logs.logEvent("onSwitchToCommunityRequested", ["communityId"], arguments)
|
|
|
|
onManageTokensRequested: logs.logEvent("onManageTokensRequested")
|
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
ColumnLayout {
|
2023-11-24 12:16:13 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Button {
|
|
|
|
text: "go back"
|
|
|
|
onClicked: stack.currentIndex = 0
|
|
|
|
}
|
2024-02-20 09:04:39 +00:00
|
|
|
AssetsDetailView {
|
|
|
|
id: detailsView
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
currencyStore: d.currencyStore
|
2024-03-13 17:38:16 +00:00
|
|
|
allNetworksModel: NetworksModel.flatNetworks
|
2024-02-20 09:04:39 +00:00
|
|
|
networkFilters: d.networksChainsCurrentlySelected
|
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Pane {
|
2024-02-20 09:04:39 +00:00
|
|
|
SplitView.preferredWidth: 250
|
2023-12-06 10:54:36 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
2023-11-24 12:16:13 +00:00
|
|
|
spacing: 12
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2023-12-06 10:54:36 +00:00
|
|
|
Switch {
|
|
|
|
id: ctrlFilterVisible
|
|
|
|
text: "Filter visible"
|
|
|
|
checked: true
|
|
|
|
}
|
2023-11-24 12:16:13 +00:00
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: loadingCheckbox
|
2023-12-18 10:12:57 +00:00
|
|
|
checked: false
|
2023-11-24 12:16:13 +00:00
|
|
|
text: "loading"
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Text {
|
|
|
|
text: "select supported network(s)"
|
|
|
|
}
|
|
|
|
Repeater {
|
|
|
|
id: networksRepeater
|
2024-03-13 17:38:16 +00:00
|
|
|
model: NetworksModel.flatNetworks
|
2023-11-24 12:16:13 +00:00
|
|
|
delegate: CheckBox {
|
|
|
|
property int chainID: chainId
|
|
|
|
width: parent.width
|
|
|
|
text: chainName
|
|
|
|
visible: isTest
|
|
|
|
checked: true
|
|
|
|
onToggled: {
|
|
|
|
isEnabled = checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Text {
|
|
|
|
text: "select account(s)"
|
|
|
|
}
|
|
|
|
Repeater {
|
|
|
|
id: accountsRepeater
|
|
|
|
model: WalletAccountsModel {}
|
|
|
|
delegate: CheckBox {
|
|
|
|
property string address: model.address
|
|
|
|
checked: true
|
|
|
|
visible: index<2
|
|
|
|
width: parent.width
|
|
|
|
text: name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-19 23:34:25 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Switch {
|
|
|
|
id: ctrlBalanceThresholdSwitch
|
|
|
|
text: qsTr("Currency balance threshold")
|
|
|
|
checked: false
|
|
|
|
}
|
|
|
|
CurrencyAmountInput {
|
|
|
|
id: ctrlBalanceThreshold
|
|
|
|
value: 10.1
|
|
|
|
}
|
|
|
|
}
|
2023-12-06 10:54:36 +00:00
|
|
|
}
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// category: Views
|
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?type=design&node-id=17159-67977&mode=design&t=s5EXsh6Vi4nTNYUh-0
|
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?type=design&node-id=17171-285559&mode=design&t=s5EXsh6Vi4nTNYUh-0
|