From d59b7c18b13c8f881912248ab70126ffd7dbefdc Mon Sep 17 00:00:00 2001 From: rating89us <45968869+rating89us@users.noreply.github.com> Date: Sat, 12 Jun 2021 15:01:39 +0200 Subject: [PATCH] History: "Reset filters" buttons; detailed "No results" messages --- pages/History.qml | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/pages/History.qml b/pages/History.qml index 8711aca7..d12e6d44 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -95,8 +95,11 @@ Rectangle { RowLayout { id: sortAndFilter - visible: root.txCount > 0 + visible: isFiltering || root.txCount > 0 property bool collapsed: false + property bool isFiltering: searchInput.text != "" || + fromDatePicker.currentDate.toDateString() !== fromDatePicker.minimumDate.toDateString() || + toDatePicker.currentDate.toDateString() !== toDatePicker.maximumDate.toDateString() Layout.alignment: Qt.AlignRight | Qt.AlignBottom Layout.preferredWidth: 100 Layout.preferredHeight: 15 @@ -106,6 +109,7 @@ Rectangle { Layout.alignment: Qt.AlignVCenter font.family: MoneroComponents.Style.fontRegular.name font.pixelSize: 15 + visible: !sortAndFilter.isFiltering text: qsTr("Sort & filter") + translationManager.emptyString color: MoneroComponents.Style.defaultFontColor @@ -119,9 +123,22 @@ Rectangle { } } + MoneroComponents.StandardButton { + id: smallResetFiltersButton + text: qsTr("Reset filters") + translationManager.emptyString + visible: sortAndFilter.isFiltering + small: true + onClicked: { + searchInput.text = ""; + fromDatePicker.currentDate = fromDatePicker.minimumDate; + toDatePicker.currentDate = toDatePicker.maximumDate; + } + } + MoneroEffects.ImageMask { id: sortCollapsedIcon Layout.alignment: Qt.AlignVCenter + visible: !sortAndFilter.isFiltering height: 8 width: 12 image: "qrc:///images/whiteDropIndicator.png" @@ -1337,17 +1354,14 @@ Rectangle { } } - Item { + ColumnLayout { visible: sortAndFilter.collapsed - Layout.topMargin: 10 + Layout.topMargin: 8 Layout.bottomMargin: 10 - Layout.leftMargin: sideMargin - Layout.rightMargin: sideMargin + Layout.alignment: Qt.AlignHCenter MoneroComponents.TextPlain { // status message - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter font.family: MoneroComponents.Style.fontRegular.name font.pixelSize: 15 text: root.historyStatusMessage; @@ -1355,6 +1369,14 @@ Rectangle { themeTransitionBlackColor: MoneroComponents.Style._b_dimmedFontColor themeTransitionWhiteColor: MoneroComponents.Style._w_dimmedFontColor } + + MoneroComponents.StandardButton { + visible: sortAndFilter.isFiltering && root.txCount == 0 + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: 5 + text: qsTr("Reset filters") + translationManager.emptyString + onClicked: smallResetFiltersButton.clicked() + } } MoneroComponents.CheckBox2 { @@ -1658,7 +1680,11 @@ Rectangle { if(root.txModelData.length <= 0){ root.historyStatusMessage = qsTr("No transaction history yet.") + translationManager.emptyString; } else if (root.txData.length <= 0){ - root.historyStatusMessage = qsTr("No results.") + translationManager.emptyString; + if (fromDatePicker.currentDate.toDateString() !== fromDatePicker.minimumDate.toDateString() || toDatePicker.currentDate.toDateString() !== toDatePicker.maximumDate.toDateString()) { + root.historyStatusMessage = qsTr("No results found.") + " " + (searchInput.text == "" ? qsTr("Please change your dates.") : qsTr("Please change your dates or refine your search.")) + translationManager.emptyString; + } else { + root.historyStatusMessage = qsTr("No results found.") + " " + qsTr("Please refine your search.") + translationManager.emptyString; + } } else { root.historyStatusMessage = qsTr("%1 transactions total, showing %2.").arg(root.txData.length).arg(txListViewModel.count) + translationManager.emptyString; }