fix(CommunitiesGridView): don't display header labels when section empty
Do not display the Featured/Popular labels when the corresponding section is emtpy Fixes: #7946
This commit is contained in:
parent
8121f052ef
commit
f722dc0761
|
@ -162,6 +162,7 @@ StatusSectionLayout {
|
|||
clip: true
|
||||
|
||||
CommunitiesGridView {
|
||||
id: communitiesGrid
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: d.preventShadowClipMargin
|
||||
anchors.leftMargin: d.preventShadowClipMargin
|
||||
|
@ -180,7 +181,7 @@ StatusSectionLayout {
|
|||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: parent.height / 3.1
|
||||
visible: d.searchMode && filteredCommunitiesModel.count === 0
|
||||
visible: (d.searchMode && filteredCommunitiesModel.count === 0) || communitiesGrid.isEmpty
|
||||
text: qsTr("No communities found")
|
||||
color: Theme.palette.baseColor1
|
||||
font.pixelSize: 15
|
||||
|
|
|
@ -17,6 +17,8 @@ StatusScrollView {
|
|||
property var model
|
||||
property bool searchLayout: false
|
||||
|
||||
readonly property bool isEmpty: !featuredRepeater.count && !popularRepeater.count
|
||||
|
||||
signal cardClicked(string communityId)
|
||||
|
||||
clip: false
|
||||
|
@ -83,7 +85,7 @@ StatusScrollView {
|
|||
|
||||
StatusBaseText {
|
||||
id: featuredLabel
|
||||
visible: !root.searchLayout
|
||||
visible: !root.searchLayout && featuredRepeater.count
|
||||
Layout.topMargin: d.scrollViewTopMargin
|
||||
text: qsTr("Featured")
|
||||
font.weight: Font.Bold
|
||||
|
@ -98,15 +100,17 @@ StatusScrollView {
|
|||
columns: 3
|
||||
columnSpacing: Style.current.padding
|
||||
rowSpacing: Style.current.padding
|
||||
visible: featuredRepeater.count
|
||||
|
||||
Repeater {
|
||||
id: featuredRepeater
|
||||
model: root.searchLayout ? root.model : featuredModel
|
||||
delegate: communityCardDelegate
|
||||
}
|
||||
}
|
||||
|
||||
StatusBaseText {
|
||||
visible: !root.searchLayout
|
||||
visible: !root.searchLayout && popularRepeater.count
|
||||
Layout.topMargin: 20
|
||||
text: qsTr("Popular")
|
||||
font.weight: Font.Bold
|
||||
|
@ -121,6 +125,7 @@ StatusScrollView {
|
|||
rowSpacing: Style.current.padding
|
||||
|
||||
Repeater {
|
||||
id: popularRepeater
|
||||
model: popularModel
|
||||
delegate: communityCardDelegate
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue