2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-02-10 20:37:17 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import "../../../imports"
|
|
|
|
import "../../../shared"
|
|
|
|
import "../../../shared/status"
|
|
|
|
import "./ContactsColumn"
|
2020-12-11 20:38:10 +00:00
|
|
|
import "./CommunityComponents"
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
// TODO unhardcode
|
|
|
|
property int chatGroupsListViewCount: channelList.channelListCount
|
|
|
|
|
|
|
|
id: root
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: createChannelPopup
|
|
|
|
CreateChannelPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: communityHeader
|
|
|
|
width: parent.width
|
2020-12-15 16:04:19 +00:00
|
|
|
height: communityHeaderButton.height
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 12
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
2020-12-15 16:04:19 +00:00
|
|
|
CommunityHeaderButton {
|
|
|
|
id: communityHeaderButton
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.left: parent.left
|
2020-12-15 16:04:19 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: -4
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 16:16:22 +00:00
|
|
|
StatusRoundButton {
|
2020-12-11 20:29:46 +00:00
|
|
|
id: optionsBtn
|
2021-03-04 16:16:22 +00:00
|
|
|
pressedIconRotation: 45
|
|
|
|
icon.name: "plusSign"
|
|
|
|
size: "medium"
|
|
|
|
width: 36
|
|
|
|
height: 36
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.bigPadding
|
2021-03-04 16:16:22 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 8
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-03-04 16:16:22 +00:00
|
|
|
onClicked: {
|
|
|
|
optionsBtn.state = "pressed"
|
|
|
|
let x = optionsBtn.iconX + optionsBtn.icon.width / 2 - optionsMenu.width / 2
|
|
|
|
optionsMenu.popup(x, optionsBtn.icon.height + 14)
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 16:16:22 +00:00
|
|
|
PopupMenu {
|
|
|
|
id: optionsMenu
|
|
|
|
x: optionsBtn.x + optionsBtn.width / 2 - optionsMenu.width / 2
|
|
|
|
y: optionsBtn.height
|
|
|
|
|
|
|
|
Action {
|
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
|
|
|
//% "Create channel"
|
|
|
|
text: qsTrId("create-channel")
|
|
|
|
icon.source: "../../img/hash.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
2021-03-05 10:54:18 +00:00
|
|
|
onTriggered: openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
2021-03-04 16:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
//% "Leave community"
|
|
|
|
text: qsTrId("leave-community")
|
|
|
|
icon.source: "../../img/delete.svg"
|
|
|
|
icon.color: Style.current.red
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
2021-03-05 09:01:29 +00:00
|
|
|
onTriggered: chatsModel.communities.leaveCurrentCommunity()
|
2021-03-04 16:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onAboutToHide: {
|
|
|
|
optionsBtn.state = "default"
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-11 19:06:39 +00:00
|
|
|
Loader {
|
|
|
|
id: membershipRequestsLoader
|
2021-02-10 20:37:17 +00:00
|
|
|
width: parent.width
|
2021-02-11 20:37:31 +00:00
|
|
|
active: chatsModel.communities.activeCommunity.admin
|
2021-02-10 20:37:17 +00:00
|
|
|
anchors.top: communityHeader.bottom
|
2021-02-11 19:06:39 +00:00
|
|
|
anchors.topMargin: item && item.visible ? Style.current.halfPadding : 0
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-02-11 19:06:39 +00:00
|
|
|
sourceComponent: Component {
|
|
|
|
MembershipRequestsButton {}
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MembershipRequestsPopup {
|
|
|
|
id: membershipRequestPopup
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
id: chatGroupsContainer
|
2021-02-11 19:06:39 +00:00
|
|
|
anchors.top: membershipRequestsLoader.bottom
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
rightPadding: Style.current.halfPadding
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
contentHeight: channelList.height + emptyViewAndSuggestions.height + 2 * Style.current.padding
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
ChannelList {
|
|
|
|
id: channelList
|
|
|
|
searchStr: ""
|
2021-02-11 20:37:31 +00:00
|
|
|
channelModel: chatsModel.communities.activeCommunity.chats
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CommunityWelcomeBanner {
|
|
|
|
id: emptyViewAndSuggestions
|
2021-03-11 12:49:29 +00:00
|
|
|
visible: !appSettings.hiddenCommunityWelcomeBanners.includes(chatsModel.communities.activeCommunity.id) && chatsModel.communities.activeCommunity.admin
|
2020-12-11 20:29:46 +00:00
|
|
|
width: parent.width
|
|
|
|
anchors.top: channelList.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
}
|
2020-12-15 16:04:19 +00:00
|
|
|
|
|
|
|
CommunityProfilePopup {
|
|
|
|
id: communityProfilePopup
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|