status-desktop/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml

77 lines
2.6 KiB
QML
Raw Normal View History

2020-12-15 16:04:19 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../shared"
import "../../../../imports"
import "../components"
import "./"
Button {
implicitWidth: Math.max(communityImage.width + communityName.width + Style.current.padding, 200)
implicitHeight: communityImage.height + Style.current.padding
background: Rectangle {
id: btnBackground
radius: Style.current.radius
color: Style.current.transparent
2020-12-15 16:04:19 +00:00
}
contentItem: Item {
id: content
RoundedImage {
id: communityImage
width: 40
height: 40
source: chatsModel.communities.activeCommunity.thumbnailImage
2020-12-15 16:04:19 +00:00
anchors.verticalCenter: parent.verticalCenter
noHover: true
2020-12-15 16:04:19 +00:00
}
StyledText {
id: communityName
text: chatsModel.communities.activeCommunity.name
2020-12-15 16:04:19 +00:00
anchors.left: communityImage.right
anchors.leftMargin: Style.current.halfPadding
anchors.top: parent.top
font.pixelSize: 15
font.weight: Font.Medium
}
StyledText {
id: communityNbMember
text: chatsModel.communities.activeCommunity.nbMembers === 1 ?
qsTr("1 member") :
qsTr("%1 members").arg(chatsModel.communities.activeCommunity.nbMembers)
2020-12-15 16:04:19 +00:00
anchors.left: communityName.left
anchors.top: communityName.bottom
font.pixelSize: 12
font.weight: Font.Thin
color: Style.current.secondaryText
}
}
MouseArea {
id: mouseAreaBtn
enabled: chatsModel.communities.activeCommunity.admin
visible: enabled
2020-12-15 16:04:19 +00:00
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onPressed: {
communityProfilePopup.communityId = chatsModel.communities.activeCommunity.id;
communityProfilePopup.name = chatsModel.communities.activeCommunity.name;
communityProfilePopup.description = chatsModel.communities.activeCommunity.description;
communityProfilePopup.access = chatsModel.communities.activeCommunity.access;
communityProfilePopup.nbMembers = chatsModel.communities.activeCommunity.nbMembers;
communityProfilePopup.isAdmin = chatsModel.communities.activeCommunity.admin
communityProfilePopup.open();
}
2020-12-15 16:04:19 +00:00
hoverEnabled: true
onExited: {
btnBackground.color = Style.current.transparent
2020-12-15 16:04:19 +00:00
}
onEntered: {
btnBackground.color = Style.current.backgroundHover
2020-12-15 16:04:19 +00:00
}
}
}