feat(@desktop/activity): Updated section delegate (#10472)

* feat(@desktop/activity): Updated section delegate

Closes #10432

* feat(@desktop/activity): Section delegate code remarks
This commit is contained in:
Cuteivist 2023-05-04 06:43:39 +02:00 committed by GitHub
parent f656088112
commit b91a1c18f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -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)