From 8524e37844b3232791e5eb9dbc4d0ba8d076f396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Tue, 25 Jul 2023 15:55:06 +0200 Subject: [PATCH] chore(Communities): Fees box - add showAccountsSelector flag It allows to show/hide selector without losing it's state. --- storybook/pages/FeesBoxPage.qml | 5 ++++- ui/app/AppLayouts/Communities/controls/FeesBoxFooter.qml | 7 ++++--- ui/app/AppLayouts/Communities/panels/FeesBox.qml | 9 ++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/storybook/pages/FeesBoxPage.qml b/storybook/pages/FeesBoxPage.qml index f34fb30750..69d4a8efbb 100644 --- a/storybook/pages/FeesBoxPage.qml +++ b/storybook/pages/FeesBoxPage.qml @@ -53,7 +53,10 @@ SplitView { width: 600 model: filteredModel - accountsModel: accountsSwitch.checked ? accountsModel : null + + accountsSelector.model: accountsModel + showAccountsSelector: accountsSwitch.checked + placeholderText: placeholderTextField.text totalFeeText: totalCheckBox.checked ? diff --git a/ui/app/AppLayouts/Communities/controls/FeesBoxFooter.qml b/ui/app/AppLayouts/Communities/controls/FeesBoxFooter.qml index 349531c2c0..1eb2ef486d 100644 --- a/ui/app/AppLayouts/Communities/controls/FeesBoxFooter.qml +++ b/ui/app/AppLayouts/Communities/controls/FeesBoxFooter.qml @@ -16,7 +16,9 @@ Control { property bool showTotal: true property alias totalFeeText: feeTotalRow.feeText - property alias accountsModel: accountSelector.model + readonly property alias accountsSelector: accountSelector + property bool showAccountsSelector: true + property alias accountErrorText: accountErrorText.text component Separator: Rectangle { @@ -28,7 +30,6 @@ Control { } component ErrorText: StatusBaseText { - Layout.fillWidth: true Layout.topMargin: Style.current.halfPadding horizontalAlignment: Text.AlignRight @@ -85,7 +86,7 @@ Control { Layout.fillWidth: true Layout.topMargin: Style.current.halfPadding - visible: !!model + visible: root.showAccountsSelector } ErrorText { diff --git a/ui/app/AppLayouts/Communities/panels/FeesBox.qml b/ui/app/AppLayouts/Communities/panels/FeesBox.qml index 828f16c67f..9479077f70 100644 --- a/ui/app/AppLayouts/Communities/panels/FeesBox.qml +++ b/ui/app/AppLayouts/Communities/panels/FeesBox.qml @@ -18,8 +18,11 @@ StatusGroupBox { // feeText (string) // error (bool), optional property alias model: feesBox.model + readonly property alias count: feesBox.count + + readonly property alias accountsSelector: footer.accountsSelector + property alias showAccountsSelector: footer.showAccountsSelector - property alias accountsModel: footer.accountsModel property alias placeholderText: feesBox.placeholderText property alias totalFeeText: footer.totalFeeText @@ -43,8 +46,8 @@ StatusGroupBox { footer: FeesBoxFooter { id: footer - visible: !!accountsModel || showTotal - || root.generalErrorText || root.accountErrorText + visible: feesBox.count && (root.showAccountsSelector || showTotal + || root.generalErrorText) showTotal: feesBox.count > 1 }