fix(@desktop/community): Add tags row on communities portal page

Close #6734
This commit is contained in:
MishkaRogachev 2022-08-08 22:41:25 +03:00 committed by Mikhail Rogachev
parent 25feb98190
commit 34671a27c1
5 changed files with 110 additions and 31 deletions

View File

@ -10,6 +10,7 @@ import StatusQ.Components 0.1
import utils 1.0
import shared.popups 1.0
import "controls"
import "stores"
import "popups"
@ -25,8 +26,6 @@ StatusScrollView {
QtObject {
id: d
property ListModel tagsModel: root.communitiesStore.tagsModel
property string searchText: ""
property int layoutVMargin: 70
property int layoutHMargin: 64
@ -101,36 +100,10 @@ StatusScrollView {
}
}
// Tags definition - Now hidden - Out of scope
// TODO: Replace by `StatusListItemTagRow`
Row {
visible: false//d.tagsModel.count > 0 --> out of scope
CommunityTagsRow {
tags: root.communitiesStore.communityTags
Layout.leftMargin: d.layoutHMargin
Layout.rightMargin: d.layoutHMargin
width: 1234 // by design
spacing: Style.current.halfPadding
Repeater {
model: d.tagsModel
delegate: StatusListItemTag {
border.color: Theme.palette.baseColor2
color: "transparent"
height: 32
radius: 36
closeButtonVisible: false
icon.emoji: model.emoji
icon.height: 32
icon.width: icon.height
icon.color: "transparent"
icon.isLetterIdenticon: true
title: model.name
titleText.font.pixelSize: 15
titleText.color: Theme.palette.primaryColor1
}
}
// TODO: Add next button
// ...
Layout.fillWidth: true
}
StatusBaseText {

View File

@ -0,0 +1,64 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14
import utils 1.0
import shared.panels 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import StatusQ.Controls 0.1
Item {
id: root
property string tags
onTagsChanged: {
var obj = JSON.parse(tags);
d.tagsModel.clear();
for (const key of Object.keys(obj)) {
d.tagsModel.append({ name: key, emoji: obj[key], selected: false });
}
}
QtObject {
id: d
property ListModel tagsModel: ListModel {}
}
implicitHeight: tagsFlow.height
clip: true
StatusScrollView {
id: scroll
anchors.fill: parent
padding: 0
contentWidth: tagsFlow.width
StatusScrollBar.horizontal.policy: StatusScrollBar.AlwaysOff
StatusCommunityTags {
id: tagsFlow
model: d.tagsModel
}
}
CommunityTagsRowButton {
anchors.left: parent.left
height: parent.height
visible: scroll.contentX > 0
onClicked: scroll.flick(scroll.width, 0)
}
CommunityTagsRowButton {
anchors.right: parent.right
height: parent.height
visible: scroll.contentX + scroll.width < scroll.contentWidth
mirrored: true
onClicked: scroll.flick(-scroll.width, 0)
}
}

View File

@ -0,0 +1,36 @@
import QtQuick 2.14
import utils 1.0
import shared.panels 1.0
Rectangle {
id: root
property bool mirrored: false
signal clicked()
width: height * 3
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: mirrored ? 0.0 : 1.0; color: "transparent" }
GradientStop { position: 0.5; color: "white" }
}
SVGImage {
source: mirrored ? Style.svg("arrow-next") : Style.svg("arrow-previous")
anchors.right: mirrored ? parent.right : undefined
anchors.left: mirrored ? undefined : parent.left
width: parent.height
height: width
}
MouseArea {
anchors.fill: parent
preventStealing: true
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
}
}

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.46967 5.46967C9.76256 5.17678 10.2374 5.17678 10.5303 5.46967L16.1768 11.1161C16.6649 11.6043 16.6649 12.3957 16.1768 12.8839L10.5303 18.5303C10.2374 18.8232 9.76256 18.8232 9.46967 18.5303C9.17678 18.2374 9.17678 17.7626 9.46967 17.4697L14.5858 12.3536C14.781 12.1583 14.781 11.8417 14.5858 11.6464L9.46967 6.53033C9.17678 6.23744 9.17678 5.76256 9.46967 5.46967Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.3232 5.46967C16.0303 5.17678 15.5555 5.17678 15.2626 5.46967L9.61608 11.1161C9.12798 11.6043 9.12798 12.3957 9.61608 12.8839L15.2626 18.5303C15.5555 18.8232 16.0303 18.8232 16.3232 18.5303C16.6161 18.2374 16.6161 17.7626 16.3232 17.4697L11.2071 12.3536C11.0119 12.1583 11.0119 11.8417 11.2071 11.6464L16.3232 6.53033C16.6161 6.23744 16.6161 5.76256 16.3232 5.46967Z" fill="#4360DF"/>
</svg>

After

Width:  |  Height:  |  Size: 540 B