2020-12-15 16:04:19 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import "../../../../shared"
|
2021-03-23 19:13:36 +00:00
|
|
|
import "../../../../shared/status"
|
2020-12-15 16:04:19 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
import "../components"
|
|
|
|
import "./"
|
|
|
|
|
|
|
|
Button {
|
2021-05-28 02:55:50 +00:00
|
|
|
implicitWidth: Math.max(communityImage.width + communityName.width + (Style.current.halfPadding * 3), 200)
|
2020-12-15 16:04:19 +00:00
|
|
|
implicitHeight: communityImage.height + Style.current.padding
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
id: btnBackground
|
|
|
|
radius: Style.current.radius
|
2021-02-22 19:00:08 +00:00
|
|
|
color: Style.current.transparent
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
id: content
|
2021-03-23 19:13:36 +00:00
|
|
|
Loader {
|
2020-12-15 16:04:19 +00:00
|
|
|
id: communityImage
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-03-23 19:13:36 +00:00
|
|
|
active: true
|
|
|
|
sourceComponent: !chatsModel.communities.activeCommunity.thumbnailImage ? letterIdenticon : imageIcon
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|
2021-03-23 19:13:36 +00:00
|
|
|
Component {
|
|
|
|
id: imageIcon
|
|
|
|
RoundedImage {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
source: chatsModel.communities.activeCommunity.thumbnailImage
|
|
|
|
noMouseArea: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: letterIdenticon
|
|
|
|
StatusLetterIdenticon {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
chatName: chatsModel.communities.activeCommunity.name
|
|
|
|
color: chatsModel.communities.activeCommunity.communityColor || Style.current.blue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-04-09 09:13:09 +00:00
|
|
|
Item {
|
|
|
|
height: childrenRect.height
|
|
|
|
width: childrenRect.width
|
2020-12-15 16:04:19 +00:00
|
|
|
anchors.left: communityImage.right
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
2021-04-09 09:13:09 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-12-15 16:04:19 +00:00
|
|
|
|
2021-04-09 09:13:09 +00:00
|
|
|
StyledText {
|
|
|
|
id: communityName
|
|
|
|
text: chatsModel.communities.activeCommunity.name
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: communityNbMember
|
|
|
|
text: chatsModel.communities.activeCommunity.nbMembers === 1 ?
|
|
|
|
qsTr("1 member") :
|
|
|
|
qsTr("%1 members").arg(chatsModel.communities.activeCommunity.nbMembers)
|
|
|
|
anchors.left: communityName.left
|
|
|
|
anchors.top: communityName.bottom
|
|
|
|
font.pixelSize: 14
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseAreaBtn
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
2021-03-09 13:25:00 +00:00
|
|
|
onPressed: {
|
|
|
|
communityProfilePopup.open();
|
|
|
|
}
|
2020-12-15 16:04:19 +00:00
|
|
|
hoverEnabled: true
|
|
|
|
onExited: {
|
2021-02-22 19:00:08 +00:00
|
|
|
btnBackground.color = Style.current.transparent
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
onEntered: {
|
2021-02-18 19:07:23 +00:00
|
|
|
btnBackground.color = Style.current.backgroundHover
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-17 16:47:12 +00:00
|
|
|
}
|