status-desktop/ui/app/AppLayouts/Communities/popups/CommunityProfilePopup.qml

86 lines
2.8 KiB
QML
Raw Normal View History

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import utils 1.0
2020-12-15 16:04:19 +00:00
import AppLayouts.Communities.panels 1.0
StatusModal {
id: root
property var community
property bool hasAddedContacts
property var communitySectionModule
onClosed: {
while (contentItem.depth > 1) {
contentItem.pop()
}
}
headerSettings.title: contentItem.currentItem.headerTitle
headerSettings.subTitle: contentItem.currentItem.headerSubtitle || ""
headerSettings.asset.name: contentItem.currentItem.headerImageSource || ""
headerSettings.asset.isImage: !!contentItem.currentItem.headerImageSource
headerSettings.asset.isLetterIdenticon: contentItem.currentItem.headerTitle === root.community.name && !contentItem.currentItem.headerImageSource
headerSettings.asset.bgColor: root.community.color
contentItem: StackView {
id: stack
initialItem: profileOverview
width: root.width
implicitHeight: currentItem.implicitHeight || currentItem.height
2020-12-16 18:56:48 +00:00
pushEnter: Transition { enabled: false }
pushExit: Transition { enabled: false }
popEnter: Transition { enabled: false }
popExit: Transition { enabled: false }
2020-12-18 20:15:00 +00:00
Component {
id: profileOverview
ProfilePopupOverviewPanel {
width: stack.width
headerTitle: root.community.name
headerSubtitle: {
switch(root.community.access) {
case Constants.communityChatPublicAccess: return qsTr("Public community");
case Constants.communityChatInvitationOnlyAccess: return qsTr("Invitation only community");
case Constants.communityChatOnRequestAccess: return qsTr("On request community");
default: return qsTr("Unknown community");
2020-12-17 13:24:33 +00:00
}
}
headerImageSource: root.community.image
community: root.community
onLeaveButtonClicked: {
root.close();
root.community.spectated ? communitySectionModule.leaveCommunity()
: Global.leaveCommunityRequested(root.community.name, root.community.id, root.community.outroMessage)
}
onCopyToClipboard: {
Utils.copyToClipboard(link);
}
}
}
}
2020-12-18 20:15:00 +00:00
leftButtons: [
StatusBackButton {
id: backButton
visible: contentItem.depth > 1
height: !visible ? 0 : implicitHeight
onClicked: {
contentItem.pop()
2020-12-16 18:56:48 +00:00
}
Layout.minimumWidth: implicitWidth
2020-12-16 18:56:48 +00:00
}
]
2020-12-15 16:04:19 +00:00
}