fix(wallet): disable "Send" button at all places when no network

connection

Closes: #13326
This commit is contained in:
Ivan Belyakov 2024-02-02 10:55:56 +01:00 committed by IvanBelyakoff
parent 1634109971
commit c791173c81
23 changed files with 41 additions and 4 deletions

View File

@ -14,6 +14,7 @@ Action {
}
property int type: StatusAction.Type.Normal
property bool visibleOnDisabled: false
property StatusAssetSettings assetSettings: StatusAssetSettings {
width: 18

View File

@ -103,7 +103,7 @@ Menu {
}
delegate: StatusMenuItem {
visible: root.hideDisabledItems ? enabled : true
visible: root.hideDisabledItems && !visibleOnDisabled ? enabled : true
height: visible ? implicitHeight : 0
onImplicitWidthChanged: {
if (visible)

View File

@ -9,12 +9,14 @@ import StatusQ.Popups 0.1
MenuItem {
id: root
objectName: action ? action.objectName : "StatusMenuItemDelegate"
spacing: 4
horizontalPadding: 8
property bool visibleOnDisabled: d.isStatusAction ? action.visibleOnDisabled : false
QtObject {
id: d

View File

@ -132,6 +132,7 @@ StatusSectionLayout {
profileStore: root.store.profileStore
privacyStore: root.store.privacyStore
contactsStore: root.store.contactsStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: root.store.communitiesList
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.profile)
contentWidth: d.contentWidth
@ -193,6 +194,7 @@ StatusSectionLayout {
implicitHeight: parent.height
rootStore: root.store
tokensStore: root.tokensStore
networkConnectionStore: root.networkConnectionStore
emojiPopup: root.emojiPopup
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.wallet)
contentWidth: d.contentWidth

View File

@ -28,6 +28,7 @@ SettingsContentBase {
property ProfileStore profileStore
property PrivacyStore privacyStore
property ContactsStore contactsStore
property NetworkConnectionStore networkConnectionStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
@ -93,6 +94,7 @@ SettingsContentBase {
profileStore: root.profileStore
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: root.communitiesModel
dirtyValues: settingsView.dirtyValues
dirty: settingsView.dirty

View File

@ -33,6 +33,7 @@ SettingsContentBase {
property ProfileSectionStore rootStore
property var walletStore: rootStore.walletStore
required property TokensStore tokensStore
property var networkConnectionStore
readonly property int mainViewIndex: 0
readonly property int networksViewIndex: 1
@ -345,6 +346,7 @@ SettingsContentBase {
SavedAddressesView {
id: savedAddressesView
contactsStore: root.rootStore.contactsStore
networkConnectionStore: root.networkConnectionStore
sendModal: root.rootStore.sendModalPopup
}

View File

@ -8,6 +8,7 @@ import StatusQ.Core.Theme 0.1
Item {
property alias profileStore: profilePreview.profileStore
property alias contactsStore: profilePreview.contactsStore
property alias networkConnectionStore: profilePreview.networkConnectionStore
property alias communitiesModel: profilePreview.communitiesModel
property alias dirtyValues: profilePreview.dirtyValues
property alias dirty: profilePreview.dirty

View File

@ -9,10 +9,12 @@ ColumnLayout {
id: root
property ContactsStore contactsStore
property var networkConnectionStore
property var sendModal
SavedAddresses {
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
}
}

View File

@ -161,6 +161,7 @@ Item {
SavedAddressesView {
store: root.store
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
sendModal: root.sendModalPopup
networkFilter.visible: false

View File

@ -20,6 +20,7 @@ StatusListItem {
property var store
property var contactsStore
property var networkConnectionStore
property string name
property string address
property string ens
@ -79,6 +80,7 @@ StatusListItem {
type: StatusRoundButton.Type.Quinary
radius: 8
icon.name: "send"
enabled: root.networkConnectionStore.sendBuyBridgeEnabled
onClicked: root.openSendModal(d.visibleAddress)
},
StatusRoundButton {

View File

@ -66,7 +66,7 @@ Rectangle {
tooltipText: networkConnectionStore.sendBuyBridgeToolTipText
visible: !walletStore.overview.isWatchOnlyAccount && !root.isCommunityOwnershipTransfer && walletStore.overview.canSend
}
StatusFlatButton {
id: buySellBtn

View File

@ -31,6 +31,7 @@ StatusMenu {
id: root
property var contactsStore
property var networkConnectionStore
property bool areTestNetworksEnabled: false
property bool isSepoliaEnabled: false
@ -156,7 +157,10 @@ StatusMenu {
d.refreshShowOnActionsVisiblity(chainShortNameList)
saveAddressAction.enabled = d.addressName.length === 0
editAddressAction.enabled = !isWalletAccount && !isContact && d.addressName.length > 0
sendToAddressAction.enabled = true
if (root.networkConnectionStore.sendBuyBridgeEnabled)
sendToAddressAction.enabled = true
showQrAction.enabled = true
d.openMenu(delegate)
@ -343,6 +347,7 @@ StatusMenu {
StatusAction {
id: sendToAddressAction
enabled: false
visibleOnDisabled: true
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Sender:

View File

@ -434,6 +434,7 @@ ColumnLayout {
StatusAction {
enabled: root.sendEnabled
visibleOnDisabled: true
icon.name: "send"
text: qsTr("Send")
onTriggered: root.sendRequested(symbol)

View File

@ -250,6 +250,7 @@ RightTabBaseView {
showAllAccounts: RootStore.showAllAccounts
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
visible: (stack.currentIndex === 3)
}
}

View File

@ -20,6 +20,7 @@ ColumnLayout {
property var sendModal
property var contactsStore
property var networkConnectionStore
QtObject {
id: d
@ -148,6 +149,7 @@ ColumnLayout {
colorId: model.colorId
store: RootStore
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
areTestNetworksEnabled: RootStore.areTestNetworksEnabled
isSepoliaEnabled: RootStore.isSepoliaEnabled
onOpenSendModal: root.sendModal.open(recipient);

View File

@ -10,5 +10,6 @@ RightTabBaseView {
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
}
}

View File

@ -27,6 +27,7 @@ Item {
property var overview: WalletStores.RootStore.overview
property var contactsStore
property var networkConnectionStore
property var transaction
property int transactionIndex
property var sendModal
@ -787,6 +788,7 @@ Item {
areTestNetworksEnabled: WalletStores.RootStore.areTestNetworksEnabled
isSepoliaEnabled: WalletStores.RootStore.isSepoliaEnabled
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
onOpenSendModal: (address) => root.sendModal.open(address)
}

View File

@ -257,6 +257,7 @@ Item {
devicesStore: appMain.rootStore.profileSectionStore.devicesStore
currencyStore: appMain.currencyStore
walletAssetsStore: appMain.walletAssetsStore
networkConnectionStore: appMain.networkConnectionStore
isDevBuild: !production
onOpenExternalLink: globalConns.onOpenLink(link)

View File

@ -35,6 +35,7 @@ QtObject {
property var devicesStore
property CurrenciesStore currencyStore
property WalletStore.WalletAssetsStore walletAssetsStore
property var networkConnectionStore
property bool isDevBuild
signal openExternalLink(string link)
@ -448,6 +449,7 @@ QtObject {
id: profilePopup
profileStore: rootStore.profileSectionStore.profileStore
contactsStore: rootStore.profileSectionStore.contactsStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: rootStore.profileSectionStore.communitiesList
onClosed: {

View File

@ -13,6 +13,7 @@ StatusDialog {
property var profileStore
property var contactsStore
property var networkConnectionStore
property var communitiesModel
width: 640
@ -25,6 +26,7 @@ StatusDialog {
publicKey: root.publicKey
profileStore: root.profileStore
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: root.communitiesModel
onCloseRequested: root.close()
}

View File

@ -320,6 +320,7 @@ ColumnLayout {
StatusAction {
enabled: root.networkConnectionStore.sendBuyBridgeEnabled && !root.overview.isWatchOnlyAccount && root.overview.canSend
visibleOnDisabled: true
icon.name: "send"
text: qsTr("Send")
onTriggered: root.sendRequested(symbol)

View File

@ -33,6 +33,7 @@ Pane {
property var profileStore
property var contactsStore
property var walletStore: WalletNS.RootStore
property var networkConnectionStore
property var communitiesModel
property QtObject dirtyValues: null
@ -699,6 +700,7 @@ Pane {
readOnly: root.readOnly
profileStore: root.profileStore
walletStore: root.walletStore
networkConnectionStore: root.networkConnectionStore
communitiesModel: root.communitiesModel
onCloseRequested: root.closeRequested()

View File

@ -24,6 +24,7 @@ Control {
property bool readOnly
property var profileStore
property var walletStore
property var networkConnectionStore
property var communitiesModel
signal closeRequested()
@ -208,6 +209,7 @@ Control {
type: StatusFlatRoundButton.Type.Secondary
icon.name: "send"
tooltip.text: qsTr("Send")
enabled: root.networkConnectionStore.sendBuyBridgeEnabled
onClicked: {
Global.openSendModal(model.address)
}