From b91a1c18f26a2d26f6f3ea93d705d1e0004c743c Mon Sep 17 00:00:00 2001 From: Cuteivist Date: Thu, 4 May 2023 06:43:39 +0200 Subject: [PATCH] feat(@desktop/activity): Updated section delegate (#10472) * feat(@desktop/activity): Updated section delegate Closes #10432 * feat(@desktop/activity): Section delegate code remarks --- ui/imports/shared/views/HistoryView.qml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ui/imports/shared/views/HistoryView.qml b/ui/imports/shared/views/HistoryView.qml index a53089d802..372807422c 100644 --- a/ui/imports/shared/views/HistoryView.qml +++ b/ui/imports/shared/views/HistoryView.qml @@ -138,21 +138,30 @@ ColumnLayout { ScrollBar.vertical: StatusScrollBar {} section.property: "date" - section.delegate: Item { + section.delegate: ColumnLayout { id: sectionDelegate readonly property bool isFirstSection: ListView.view.firstSection === section width: ListView.view.width - height: isFirstSection || section.length > 1 ? 40 : 0 // 1 because we don't use empty for loading state - visible: height > 0 // display always first section. Other sections when more items are being fetched must not be visible + // display always first section. Other sections when more items are being fetched must not be visible + visible: isFirstSection || section.length > 1 + spacing: 0 required property string section + Separator { + Layout.fillWidth: true + Layout.topMargin: sectionDelegate.isFirstSection ? 0 : 20 + implicitHeight: 1 + } + StatusTextWithLoadingState { id: sectionText - anchors.verticalCenter: parent.verticalCenter + Layout.topMargin: 12 + leftPadding: 16 + bottomPadding: 8 text: loading ? "dummy" : parent.section // dummy text because loading component height depends on text height, and not visible with height == 0 Binding on width { when: sectionText.loading @@ -160,7 +169,8 @@ ColumnLayout { restoreMode: Binding.RestoreBindingOrValue } customColor: Theme.palette.baseColor1 - font.pixelSize: 15 + font.pixelSize: 13 + verticalAlignment: Qt.AlignBottom loading: { // First section must be loading when first item in the list is loading. Other sections are never visible until have date value if (parent.ListView.view.count > 0) { const firstItem = parent.ListView.view.itemAtIndex(0)