chore(Community): remove unused popups

This commit is contained in:
Jonathan Rainville 2023-03-09 14:56:08 -05:00
parent 3008e56455
commit fee9b31a88
3 changed files with 0 additions and 412 deletions

View File

@ -1,157 +0,0 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import utils 1.0
import shared 1.0
StatusModal {
id: popup
property var communitiesList
signal setActiveCommunity(string id)
signal setObservedCommunity(string id)
signal openCommunityDetail()
signal importCommunityClicked()
signal createCommunityClicked()
onOpened: {
contentItem.searchBox.input.text = "";
contentItem.searchBox.input.forceActiveFocus(Qt.MouseFocusReason)
}
header.title: qsTr("Communities")
headerActionButton: StatusFlatRoundButton {
type: StatusFlatRoundButton.Type.Secondary
width: 32
height: 32
icon.name: "more"
onClicked: contextMenu.popup(-contextMenu.width+width, height + 4)
StatusMenu {
id: contextMenu
width: 230
StatusAction {
icon.name: "download"
text: qsTr("Access existing community")
onTriggered: {
popup.importCommunityClicked();
}
}
}
}
contentItem: Item {
Column {
id: contentItem
anchors.horizontalCenter: parent.horizontalCenter
property alias searchBox: searchBox
Item {
height: 8
width: parent.width
}
StatusInput {
id: searchBox
anchors.horizontalCenter: parent.horizontalCenter
placeholderText: qsTr("Search for communities or topics")
input.asset.name: "search"
}
StatusModalDivider { topPadding: 8 }
StatusScrollView {
width: parent.width
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
topPadding: 8
bottomPadding: 8
height: 400
StatusListView {
anchors.fill: parent
model: communitiesDelegateModel
spacing: 4
id: communitiesList
section.property: "name"
section.criteria: ViewSection.FirstCharacter
section.delegate: Column {
StatusBaseText {
anchors.left: parent.left
anchors.leftMargin: 16
text: section.toUpperCase()
font.pixelSize: 15
font.weight: Font.Medium
color: Theme.palette.directColor1
}
StatusModalDivider {
bottomPadding: 8
}
}
}
DelegateModelGeneralized {
id: communitiesDelegateModel
lessThan: [
function(left, right) {
return left.name.toLowerCase() < right.name.toLowerCase()
}
]
model: popup.communitiesList
delegate: StatusListItem {
visible: {
if (!searchBox.input.text) {
return true
}
const lowerCaseSearchStr = searchBox.input.text.toLowerCase()
return model.name.toLowerCase().includes(lowerCaseSearchStr) || model.description.toLowerCase().includes(lowerCaseSearchStr)
}
height: visible ? implicitHeight : 0
anchors.horizontalCenter: parent.horizontalCenter
title: model.name
subTitle: model.description
tertiaryTitle: qsTr("%n member(s)", "", model.members.count)
statusListItemTitle.font.weight: Font.Bold
statusListItemTitle.font.pixelSize: 17
asset.name: model.image
asset.isImage: !!model.image
asset.isLetterIdenticon: !model.image
asset.bgColor: model.color || Theme.palette.primaryColor1
onClicked: {
if (model.joined && model.isMember) {
popup.setActiveCommunity(model.id);
} else {
popup.setObservedCommunity(model.id);
popup.openCommunityDetail();
}
popup.close()
}
}
}
}
}
}
rightButtons: [
StatusButton {
text: qsTr("Create a community")
onClicked: {
popup.createCommunityClicked();
popup.close()
}
}
]
}

View File

@ -1,217 +0,0 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import utils 1.0
StatusModal {
id: root
property var store
property QtObject community: root.store.communitiesModuleInst.observedCommunity
property string communityId: community.id
property string name: community.name
property string description: community.description
property int access: community.access
property string source: community.image
property int nbMembers: community.members.count
property bool ensOnly: community.ensOnly
property bool canJoin: community.canJoin
property bool canRequestAccess: community.canRequestAccess
property bool isMember: community.isMember
property string communityColor: community.color || Style.current.blue
header.title: name
header.subTitle: {
let subTitle = ""
switch(access) {
case Constants.communityChatPublicAccess:
subTitle = qsTr("Public community");
break;
case Constants.communityChatInvitationOnlyAccess:
subTitle = qsTr("Invitation only community");
break;
case Constants.communityChatOnRequestAccess:
subTitle = qsTr("On request community");
break;
default:
subTitle = qsTr("Unknown community");
break;
}
if (ensOnly) {
subTitle += qsTr(" - ENS only")
}
return subTitle
}
contentItem: Column {
width: root.width
Item {
height: childrenRect.height + 8
width: parent.width - 32
anchors.horizontalCenter: parent.horizontalCenter
StatusBaseText {
id: description
anchors.top: parent.top
anchors.topMargin: 16
text: root.description
font.pixelSize: 15
color: Theme.palette.directColor1
wrapMode: Text.WordWrap
width: parent.width
textFormat: Text.PlainText
}
StatusIcon {
id: statusIcon
anchors.top: description.bottom
anchors.topMargin: 16
anchors.left: parent.left
icon: "tiny/contact"
width: 16
color: Theme.palette.directColor1
}
StatusBaseText {
text: qsTr("%n member(s)", "", nbMembers)
font.pixelSize: 15
font.weight: Font.Medium
color: Theme.palette.directColor1
anchors.left: statusIcon.right
anchors.leftMargin: 2
anchors.verticalCenter: statusIcon.verticalCenter
}
}
StatusModalDivider {
topPadding: 8
bottomPadding: 8
}
Item {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 32
height: 34
StatusBaseText {
text: qsTr("Channels")
anchors.bottom: parent.bottom
anchors.bottomMargin: 4
font.pixelSize: 15
color: Theme.palette.baseColor1
}
}
StatusScrollView {
width: root.width
height: 300
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
StatusListView {
id: chatList
anchors.fill: parent
model: community.chats
delegate: StatusListItem {
anchors.horizontalCenter: parent.horizontalCenter
title: "#" + model.name
subTitle: model.description
asset.isLetterIdenticon: true
asset.bgColor: root.communityColor
}
}
}
}
leftButtons: [
StatusBackButton {
id: backButton
onClicked: {
root.close()
}
}
]
rightButtons: [
StatusButton {
property bool isPendingRequest: {
if (access !== Constants.communityChatOnRequestAccess) {
return false
}
return false
// Not Refactored Yet
// return root.store.chatsModelInst.communities.isCommunityRequestPending(root.communityId)
}
text: {
// Not Refactored Yet
// if (root.ensOnly && !root.store.profileModelInst.profile.ensVerified) {
// return qsTr("Membership requires an ENS username")
// }
if (root.canJoin) {
return qsTr("Join %1").arg(root.name);
}
if (isPendingRequest) {
return qsTr("Pending")
}
switch(root.access) {
case Constants.communityChatPublicAccess: return qsTr("Join %1").arg(root.name);
case Constants.communityChatInvitationOnlyAccess: return qsTr("You need to be invited");
case Constants.communityChatOnRequestAccess: return qsTr("Request to join %1").arg(root.name);
default: return qsTr("Unknown community");
}
}
enabled: {
// Not Refactored Yet
// if (root.ensOnly && !root.store.profileModelInst.profile.ensVerified) {
// return false
// }
if (root.access === Constants.communityChatInvitationOnlyAccess || isPendingRequest) {
return false
}
if (canJoin) {
return true
}
return true
}
onClicked: {
// Not Refactored Yet
let error
if (access === Constants.communityChatOnRequestAccess &&
!root.community.amISectionAdmin
&& !root.isMember) {
// TODO refactor
return
// error = root.store.chatsModelInst.communities.requestToJoinCommunity(root.communityId, userProfile.name)
// if (!error) {
// enabled = false
// text = qsTr("Pending")
// }
} else {
error = root.store.communitiesModuleInst.requestToJoinCommunity(root.communityId, root.store.userProfileInst.preferredName)
}
if (error) {
joiningError.text = error
return joiningError.open()
}
root.close()
}
}
]
MessageDialog {
id: joiningError
title: qsTr("Error joining the community")
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
}

View File

@ -223,44 +223,6 @@ Item {
}
}
Component {
id: communitiesPopupComponent
CommunitiesPopup {
anchors.centerIn: parent
communitiesList: root.store.communitiesList
onSetActiveCommunity: {
root.store.setActiveCommunity(id)
}
onSetObservedCommunity: {
root.store.setObservedCommunity(id)
}
onClosed: {
destroy()
}
onOpenCommunityDetail: {
Global.openPopup(communityDetailPopup);
}
onImportCommunityClicked: {
root.importCommunityClicked();
}
onCreateCommunityClicked: {
root.createCommunityClicked();
}
}
}
Component {
id: communityDetailPopup
CommunityDetailPopup {
anchors.centerIn: parent
store: root.store
onClosed: {
Global.openPopup(communitiesPopupComponent)
destroy()
}
}
}
Connections {
target: root.store