Lukáš Tinkl 8791d028e6 feat: Integrate the new manage assets/collectibles panels into Settings
- display a customized floating bubble to save/apply the settings
- display a toast message on Apply with an action to jump to Wallet main
page
- add home/end/pgup/pgdown keyboard shortcuts to StatusScrollView to be
able to navigate more easily in long list views
- some smaller fixes and cleanups in wallet and settings related views

Fixes https://github.com/status-im/status-desktop/issues/12762
2023-11-22 18:29:31 +01:00

196 lines
6.2 KiB
QML

import QtQuick 2.13
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import utils 1.0
import shared.controls 1.0
import shared.views 1.0
import shared.stores 1.0
import shared.panels 1.0
import "./"
import "../stores"
import "../panels"
import "../views/collectibles"
Item {
id: root
property alias currentTabIndex: walletTabBar.currentIndex
property var store
property var contactsStore
property var sendModal
property var networkConnectionStore
property bool showAllAccounts: false
signal launchShareAddressModal()
function resetView() {
stack.currentIndex = 0
root.currentTabIndex = 0
historyView.resetView()
}
function resetStack() {
stack.currentIndex = 0;
}
Connections {
target: walletSection
function onFilterChanged() {
root.resetStack()
}
}
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 ""
}
}
}
StackLayout {
id: stack
anchors.fill: parent
onCurrentIndexChanged: {
RootStore.backButtonName = d.getBackButtonText(currentIndex)
}
ColumnLayout {
spacing: 0
WalletHeader {
Layout.fillWidth: true
overview: RootStore.overview
store: root.store
walletStore: RootStore
networkConnectionStore: root.networkConnectionStore
onLaunchShareAddressModal: root.launchShareAddressModal()
onSwitchHideWatchOnlyAccounts: RootStore.toggleWatchOnlyAccounts()
}
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()
}
}
StatusTabBar {
id: walletTabBar
objectName: "rightSideWalletTabBar"
horizontalPadding: Style.current.padding
Layout.fillWidth: true
Layout.topMargin: Style.current.padding
StatusTabButton {
leftPadding: 0
width: implicitWidth
text: qsTr("Assets")
}
StatusTabButton {
width: implicitWidth
text: qsTr("Collectibles")
}
StatusTabButton {
rightPadding: 0
width: implicitWidth
text: qsTr("Activity")
}
onCurrentIndexChanged: {
RootStore.setCurrentViewedHoldingType(walletTabBar.currentIndex === 1 ? Constants.TokenType.ERC721 : Constants.TokenType.ERC20)
}
}
StackLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.topMargin: Style.current.padding
Layout.bottomMargin: Style.current.padding
currentIndex: walletTabBar.currentIndex
AssetsView {
assets: RootStore.assets
networkConnectionStore: root.networkConnectionStore
assetDetailsLaunched: stack.currentIndex === 2
onAssetClicked: {
assetDetailView.token = token
RootStore.setCurrentViewedHolding(token.symbol, Constants.TokenType.ERC20)
stack.currentIndex = 2
}
}
CollectiblesView {
collectiblesModel: RootStore.collectiblesStore.ownedCollectibles
onCollectibleClicked: {
RootStore.collectiblesStore.getDetailedCollectible(chainId, contractAddress, tokenId)
RootStore.setCurrentViewedHolding(uid, Constants.TokenType.ERC721)
stack.currentIndex = 1
}
}
HistoryView {
id: historyView
overview: RootStore.overview
showAllAccounts: root.showAllAccounts
sendModal: root.sendModal
onLaunchTransactionDetail: function (entry, entryIndex) {
transactionDetailView.transactionIndex = entryIndex
transactionDetailView.transaction = entry
stack.currentIndex = 3
}
}
}
}
CollectibleDetailView {
collectible: RootStore.collectiblesStore.detailedCollectible
isCollectibleLoading: RootStore.collectiblesStore.isDetailedCollectibleLoading
onVisibleChanged: {
if (!visible)
RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC721)
}
}
AssetsDetailView {
id: assetDetailView
visible: (stack.currentIndex === 2)
assetsLoading: RootStore.assetsLoading
address: RootStore.overview.mixedcaseAddress
networkConnectionStore: root.networkConnectionStore
onVisibleChanged: {
if (!visible)
RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC20)
}
}
TransactionDetailView {
id: transactionDetailView
onVisibleChanged: {
if (!visible)
transaction = null
}
showAllAccounts: root.showAllAccounts
sendModal: root.sendModal
contactsStore: root.contactsStore
visible: (stack.currentIndex === 3)
}
}
}