Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(community): add option to see community rules #17022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions ui/app/AppLayouts/Communities/popups/CommunityRulesPopup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15

import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups.Dialog 0.1

StatusDialog {
id: root

required property string name
required property string introMessage
required property string image
required property string color


implicitWidth: 640 // design
title: qsTr("%1 community rules").arg(root.name)

onClosed: destroy()

contentItem: StatusScrollView {
id: scrollView
contentWidth: availableWidth
padding: 0

ColumnLayout {
width: scrollView.availableWidth
spacing: 24

StatusSmartIdenticon {
Layout.alignment: Qt.AlignHCenter
name: asset.isImage ? "" : root.name
asset.isImage: root.image !== ""
asset.name: root.image
asset.isLetterIdenticon: !asset.isImage
asset.color: root.color
asset.charactersLen: 1
asset.useAcronymForLetterIdenticon: false
asset.width: 64
asset.height: 64
}

StatusBaseText {
text: root.introMessage
Layout.fillWidth: true
Layout.fillHeight: true
wrapMode: Text.WordWrap
}
}
}

footer: StatusDialogFooter {
rightButtons: ObjectModel {
StatusButton {
text: qsTr("Done")
onClicked: root.close()
}
}
}
}
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Communities/popups/qmldir
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AlertPopup 1.0 AlertPopup.qml
BurnTokensPopup 1.0 BurnTokensPopup.qml
CommunityProfilePopup 1.0 CommunityProfilePopup.qml
CommunityRulesPopup 1.0 CommunityRulesPopup.qml
CreateCategoryPopup 1.0 CreateCategoryPopup.qml
CreateChannelPopup 1.0 CreateChannelPopup.qml
CreateCommunityPopup 1.0 CreateCommunityPopup.qml
Expand Down
10 changes: 8 additions & 2 deletions ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1009,11 +1009,17 @@ Item {
}

StatusAction {
text: qsTr("View Community")
icon.name: "group-chat"
text: qsTr("Community Info")
icon.name: "info"
onTriggered: popups.openCommunityProfilePopup(appMain.rootStore, model, communityContextMenu.chatCommunitySectionModule)
}

StatusAction {
text: qsTr("Community Rules")
icon.name: "text"
onTriggered: popups.openCommunityRulesPopup(model.name, model.introMessage, model.image, model.color)
}

StatusMenuSeparator {}

MuteChatMenuItem {
Expand Down
12 changes: 12 additions & 0 deletions ui/app/mainui/Popups.qml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ QtObject {
openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule})
}

function openCommunityRulesPopup(name, introMessage, image, color) {
openPopup(communityRulesPopup, { name, introMessage, image, color })
}

function openMarkAsIDVerifiedPopup(publicKey, cb) {
const contactDetails = Utils.getContactDetailsAsJson(
publicKey, true, true, true)
Expand Down Expand Up @@ -631,6 +635,14 @@ QtObject {
}
},

Component {
id: communityRulesPopup

CommunityRulesPopup {
onClosed: destroy()
}
},

Component {
id: pinnedMessagesPopup

Expand Down