2023-12-06 10:54:36 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-05-23 11:45:29 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2023-12-06 10:54:36 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-05-23 11:45:29 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import utils 1.0
|
2023-08-23 11:46:04 +00:00
|
|
|
import shared.controls 1.0
|
2022-03-25 08:46:47 +00:00
|
|
|
import shared.views 1.0
|
2024-02-26 02:32:59 +00:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2023-09-11 10:20:36 +00:00
|
|
|
import shared.panels 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
2022-09-05 09:15:47 +00:00
|
|
|
import "./"
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../stores"
|
|
|
|
import "../panels"
|
2022-07-28 20:56:44 +00:00
|
|
|
import "../views/collectibles"
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
RightTabBaseView {
|
2022-07-19 13:17:35 +00:00
|
|
|
id: root
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
property alias currentTabIndex: walletTabBar.currentIndex
|
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
signal launchShareAddressModal()
|
|
|
|
|
2023-05-31 07:47:52 +00:00
|
|
|
function resetView() {
|
|
|
|
stack.currentIndex = 0
|
|
|
|
root.currentTabIndex = 0
|
2024-01-25 11:18:58 +00:00
|
|
|
if (walletTabBar.currentIndex === 2)
|
|
|
|
mainViewLoader.item.resetView()
|
2023-05-31 07:47:52 +00:00
|
|
|
}
|
|
|
|
|
2022-09-13 16:17:54 +00:00
|
|
|
function resetStack() {
|
|
|
|
stack.currentIndex = 0;
|
|
|
|
}
|
|
|
|
|
2024-02-20 09:04:39 +00:00
|
|
|
headerButton.onClicked: {
|
|
|
|
root.launchShareAddressModal()
|
|
|
|
}
|
|
|
|
header.visible: stack.currentIndex === 0
|
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
StackLayout {
|
|
|
|
id: stack
|
2024-01-10 09:27:11 +00:00
|
|
|
anchors.fill: parent
|
2023-07-13 08:48:26 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
Connections {
|
|
|
|
target: walletSection
|
2023-07-13 08:48:26 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
function onFilterChanged() {
|
2024-02-14 10:49:22 +00:00
|
|
|
root.resetView()
|
2022-09-27 08:30:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-26 17:31:34 +00:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
RootStore.backButtonName = d.getBackButtonText(currentIndex)
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-12-26 10:19:41 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
function getBackButtonText(index) {
|
|
|
|
switch(index) {
|
|
|
|
case 1:
|
|
|
|
return qsTr("Collectibles")
|
|
|
|
case 2:
|
|
|
|
return qsTr("Assets")
|
|
|
|
case 3:
|
|
|
|
return qsTr("Activity")
|
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
2024-02-26 02:32:59 +00:00
|
|
|
|
|
|
|
readonly property var detailedCollectibleActivityController: RootStore.tmpActivityController0
|
2023-12-26 10:19:41 +00:00
|
|
|
}
|
|
|
|
|
2024-03-20 17:32:36 +00:00
|
|
|
// StackLayout.currentIndex === 0
|
2023-04-26 17:31:34 +00:00
|
|
|
ColumnLayout {
|
2023-04-26 15:53:49 +00:00
|
|
|
spacing: 0
|
2023-08-23 11:46:04 +00:00
|
|
|
|
|
|
|
ImportKeypairInfo {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.bigPadding
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
visible: root.store.walletSectionInst.hasPairedDevices && root.store.walletSectionInst.keypairOperabilityForObservedAccount === Constants.keypair.operability.nonOperable
|
|
|
|
|
|
|
|
onRunImport: {
|
|
|
|
root.store.walletSectionInst.runKeypairImportPopup()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 10:54:36 +00:00
|
|
|
RowLayout {
|
2023-04-26 17:31:34 +00:00
|
|
|
Layout.fillWidth: true
|
2023-12-06 10:54:36 +00:00
|
|
|
StatusTabBar {
|
|
|
|
id: walletTabBar
|
|
|
|
objectName: "rightSideWalletTabBar"
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.padding
|
|
|
|
|
|
|
|
StatusTabButton {
|
2024-03-22 07:55:07 +00:00
|
|
|
objectName: "assetsTabButton"
|
2023-12-06 10:54:36 +00:00
|
|
|
leftPadding: 0
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Assets")
|
|
|
|
}
|
|
|
|
StatusTabButton {
|
2024-03-22 07:55:07 +00:00
|
|
|
objectName: "collectiblesTabButton"
|
2023-12-06 10:54:36 +00:00
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Collectibles")
|
|
|
|
}
|
|
|
|
StatusTabButton {
|
2024-03-22 07:55:07 +00:00
|
|
|
objectName: "activityTabButton"
|
2023-12-06 10:54:36 +00:00
|
|
|
rightPadding: 0
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Activity")
|
|
|
|
}
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
RootStore.setCurrentViewedHoldingType(walletTabBar.currentIndex === 1 ? Constants.TokenType.ERC721 : Constants.TokenType.ERC20)
|
|
|
|
}
|
2022-07-28 20:56:44 +00:00
|
|
|
}
|
2023-12-06 10:54:36 +00:00
|
|
|
StatusFlatButton {
|
|
|
|
id: filterButton
|
2024-03-22 07:55:07 +00:00
|
|
|
objectName: "filterButton"
|
2023-12-06 10:54:36 +00:00
|
|
|
icon.name: "filter"
|
|
|
|
checkable: true
|
|
|
|
icon.color: checked ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
|
|
|
Behavior on icon.color { ColorAnimation { duration: 200; easing.type: Easing.InOutQuad } }
|
|
|
|
highlighted: checked
|
2023-09-12 14:26:38 +00:00
|
|
|
}
|
2023-04-26 17:31:34 +00:00
|
|
|
}
|
2024-01-25 11:18:58 +00:00
|
|
|
Loader {
|
2023-11-22 19:58:02 +00:00
|
|
|
id: mainViewLoader
|
2023-04-26 17:31:34 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2024-01-25 11:18:58 +00:00
|
|
|
sourceComponent: {
|
|
|
|
switch (walletTabBar.currentIndex) {
|
|
|
|
case 0: return assetsView
|
|
|
|
case 1: return collectiblesView
|
|
|
|
case 2: return historyView
|
2022-07-28 20:56:44 +00:00
|
|
|
}
|
2023-04-26 17:31:34 +00:00
|
|
|
}
|
2024-01-25 11:18:58 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: assetsView
|
|
|
|
AssetsView {
|
|
|
|
areAssetsLoading: RootStore.overview.balanceLoading
|
2024-01-31 18:09:44 +00:00
|
|
|
controller: RootStore.walletAssetsStore.assetsController
|
2024-01-25 11:18:58 +00:00
|
|
|
networkFilters: RootStore.networkFilters
|
|
|
|
addressFilters: RootStore.addressFilters
|
|
|
|
overview: RootStore.overview
|
|
|
|
currencyStore: RootStore.currencyStore
|
|
|
|
networkConnectionStore: root.networkConnectionStore
|
2024-03-19 23:34:25 +00:00
|
|
|
tokensStore: RootStore.tokensStore
|
2024-01-25 11:18:58 +00:00
|
|
|
assetDetailsLaunched: stack.currentIndex === 2
|
|
|
|
filterVisible: filterButton.checked
|
|
|
|
onAssetClicked: {
|
|
|
|
assetDetailView.token = token
|
|
|
|
RootStore.setCurrentViewedHolding(token.symbol, Constants.TokenType.ERC20)
|
|
|
|
stack.currentIndex = 2
|
|
|
|
}
|
|
|
|
onSendRequested: (symbol) => {
|
|
|
|
root.sendModal.preSelectedSendType = Constants.SendType.Transfer
|
|
|
|
root.sendModal.preSelectedHoldingID = symbol
|
|
|
|
root.sendModal.preSelectedHoldingType = Constants.TokenType.ERC20
|
|
|
|
root.sendModal.onlyAssets = true
|
|
|
|
root.sendModal.open()
|
|
|
|
}
|
|
|
|
onReceiveRequested: (symbol) => root.launchShareAddressModal()
|
|
|
|
onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId)
|
|
|
|
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,
|
2024-01-31 18:09:44 +00:00
|
|
|
Constants.walletSettingsSubsection.manageAssets)
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-25 11:18:58 +00:00
|
|
|
Component {
|
|
|
|
id: collectiblesView
|
|
|
|
CollectiblesView {
|
2024-01-31 18:09:44 +00:00
|
|
|
controller: RootStore.collectiblesStore.collectiblesController
|
2024-01-25 11:18:58 +00:00
|
|
|
networkFilters: RootStore.networkFilters
|
|
|
|
addressFilters: RootStore.addressFilters
|
|
|
|
sendEnabled: root.networkConnectionStore.sendBuyBridgeEnabled && !RootStore.overview.isWatchOnlyAccount && RootStore.overview.canSend
|
|
|
|
filterVisible: filterButton.checked
|
|
|
|
onCollectibleClicked: {
|
|
|
|
RootStore.collectiblesStore.getDetailedCollectible(chainId, contractAddress, tokenId)
|
2024-03-05 09:27:40 +00:00
|
|
|
RootStore.setCurrentViewedHolding(uid, tokenType)
|
2024-02-26 02:32:59 +00:00
|
|
|
d.detailedCollectibleActivityController.resetFilter()
|
|
|
|
d.detailedCollectibleActivityController.setFilterAddressesJson(JSON.stringify(RootStore.addressFilters.split(":")), RootStore.showAllAccounts)
|
|
|
|
d.detailedCollectibleActivityController.setFilterChainsJson(JSON.stringify([chainId]), false)
|
|
|
|
d.detailedCollectibleActivityController.setFilterCollectibles(JSON.stringify([uid]))
|
|
|
|
d.detailedCollectibleActivityController.updateFilter()
|
|
|
|
|
2024-01-25 11:18:58 +00:00
|
|
|
stack.currentIndex = 1
|
|
|
|
}
|
2024-03-05 09:27:40 +00:00
|
|
|
onSendRequested: (symbol, tokenType) => {
|
2024-01-25 11:18:58 +00:00
|
|
|
root.sendModal.preSelectedHoldingID = symbol
|
2024-03-05 09:27:40 +00:00
|
|
|
root.sendModal.preSelectedHoldingType = tokenType
|
|
|
|
root.sendModal.preSelectedSendType = tokenType === Constants.TokenType.ERC721 ?
|
|
|
|
Constants.SendType.ERC721Transfer:
|
|
|
|
Constants.SendType.ERC1155Transfer
|
2024-01-25 11:18:58 +00:00
|
|
|
root.sendModal.onlyAssets = false
|
|
|
|
root.sendModal.open()
|
|
|
|
}
|
|
|
|
onReceiveRequested: (symbol) => root.launchShareAddressModal()
|
|
|
|
onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId)
|
|
|
|
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,
|
2024-01-31 18:09:44 +00:00
|
|
|
Constants.walletSettingsSubsection.manageCollectibles)
|
2024-02-07 22:58:56 +00:00
|
|
|
isFetching: RootStore.collectiblesStore.areCollectiblesFetching
|
|
|
|
isUpdating: RootStore.collectiblesStore.areCollectiblesUpdating
|
|
|
|
isError: RootStore.collectiblesStore.areCollectiblesError
|
2024-01-25 11:18:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
2023-09-21 06:58:44 +00:00
|
|
|
id: historyView
|
2024-01-25 11:18:58 +00:00
|
|
|
HistoryView {
|
|
|
|
overview: RootStore.overview
|
2024-02-22 14:41:19 +00:00
|
|
|
communitiesStore: root.communitiesStore
|
2024-01-25 11:18:58 +00:00
|
|
|
showAllAccounts: RootStore.showAllAccounts
|
|
|
|
sendModal: root.sendModal
|
|
|
|
filterVisible: filterButton.checked
|
2024-02-29 14:53:08 +00:00
|
|
|
onLaunchTransactionDetail: function (txID) {
|
|
|
|
RootStore.activityController.fetchTxDetails(txID)
|
2024-01-25 11:18:58 +00:00
|
|
|
stack.currentIndex = 3
|
|
|
|
}
|
2022-07-28 20:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-19 13:17:35 +00:00
|
|
|
}
|
2023-04-26 17:31:34 +00:00
|
|
|
}
|
|
|
|
CollectibleDetailView {
|
2024-02-29 14:53:08 +00:00
|
|
|
id: collectibleDetailView
|
|
|
|
|
|
|
|
visible : (stack.currentIndex === 1)
|
|
|
|
|
2023-07-17 23:56:40 +00:00
|
|
|
collectible: RootStore.collectiblesStore.detailedCollectible
|
|
|
|
isCollectibleLoading: RootStore.collectiblesStore.isDetailedCollectibleLoading
|
2024-02-26 02:32:59 +00:00
|
|
|
activityModel: d.detailedCollectibleActivityController.model
|
2024-03-27 21:49:46 +00:00
|
|
|
addressFilters: RootStore.addressFilters
|
2024-02-26 02:32:59 +00:00
|
|
|
rootStore: SharedStores.RootStore
|
|
|
|
walletRootStore: RootStore
|
|
|
|
communitiesStore: root.communitiesStore
|
2023-09-11 10:20:36 +00:00
|
|
|
|
|
|
|
onVisibleChanged: {
|
2024-02-26 02:32:59 +00:00
|
|
|
if (!visible) {
|
2023-11-07 22:45:47 +00:00
|
|
|
RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC721)
|
2024-02-26 02:32:59 +00:00
|
|
|
}
|
2023-09-11 10:20:36 +00:00
|
|
|
}
|
2024-02-29 14:53:08 +00:00
|
|
|
|
|
|
|
onLaunchTransactionDetail: function (txID) {
|
|
|
|
d.detailedCollectibleActivityController.fetchTxDetails(txID)
|
|
|
|
stack.currentIndex = 3
|
|
|
|
|
|
|
|
// Take user to the activity view when they press the "Back" button
|
|
|
|
walletTabBar.currentIndex = 2
|
|
|
|
}
|
2023-04-26 17:31:34 +00:00
|
|
|
}
|
|
|
|
AssetsDetailView {
|
|
|
|
id: assetDetailView
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2023-04-26 17:31:34 +00:00
|
|
|
visible: (stack.currentIndex === 2)
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
allNetworksModel: RootStore.filteredFlatModel
|
2023-04-26 15:53:49 +00:00
|
|
|
address: RootStore.overview.mixedcaseAddress
|
2023-11-24 12:16:13 +00:00
|
|
|
currencyStore: RootStore.currencyStore
|
|
|
|
networkFilters: RootStore.networkFilters
|
2023-05-22 14:05:04 +00:00
|
|
|
|
2023-04-26 17:31:34 +00:00
|
|
|
networkConnectionStore: root.networkConnectionStore
|
2023-09-11 10:20:36 +00:00
|
|
|
|
|
|
|
onVisibleChanged: {
|
|
|
|
if (!visible)
|
2023-11-07 22:45:47 +00:00
|
|
|
RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC20)
|
2023-09-11 10:20:36 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2023-04-25 16:54:50 +00:00
|
|
|
|
2024-03-20 17:32:36 +00:00
|
|
|
Loader {
|
|
|
|
active: stack.currentIndex === 3
|
|
|
|
|
|
|
|
sourceComponent: TransactionDetailView {
|
|
|
|
controller: RootStore.activityDetailsController
|
|
|
|
onVisibleChanged: {
|
|
|
|
if (visible) {
|
|
|
|
if (!!transaction) {
|
|
|
|
RootStore.addressWasShown(transaction.sender)
|
|
|
|
if (transaction.sender !== transaction.recipient) {
|
|
|
|
RootStore.addressWasShown(transaction.recipient)
|
|
|
|
}
|
2023-12-20 10:46:33 +00:00
|
|
|
}
|
2024-03-20 17:32:36 +00:00
|
|
|
} else {
|
|
|
|
controller.resetActivityEntry()
|
2023-12-20 10:46:33 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-20 17:32:36 +00:00
|
|
|
showAllAccounts: RootStore.showAllAccounts
|
|
|
|
communitiesStore: root.communitiesStore
|
|
|
|
sendModal: root.sendModal
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
networkConnectionStore: root.networkConnectionStore
|
|
|
|
visible: (stack.currentIndex === 3)
|
2023-06-12 08:14:19 +00:00
|
|
|
}
|
2022-03-23 11:08:49 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|