Skip to content

Commit

Permalink
feat(Communities): Add button Join community to not joined communities
Browse files Browse the repository at this point in the history
Part of: #7072
  • Loading branch information
borismelnik committed Sep 8, 2022
1 parent b248560 commit 333e313
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ui/app/AppLayouts/Chat/views/ChatContentView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ ColumnLayout {

property bool stickersLoaded: false

property var activeSectionData: rootStore.mainModuleInst ? rootStore.mainModuleInst.activeSection || {} : {}
property bool isJoined: activeSectionData.joined

// NOTE: Used this property change as it is the current way used for displaying new channel/chat data of content view.
// If in the future content is loaded dynamically, input focus should be activated when loaded / created content view.
onHeightChanged: {
Expand Down Expand Up @@ -204,6 +207,16 @@ ColumnLayout {
value: qsTr("This user has been blocked.")
}

Binding on chatInputPlaceholder {
when: !root.isJoined
value: qsTr("You need to join this community to send messages ")
}

Binding on enabled {
when: !root.isJoined
value: root.isJoined
}

onSendTransactionCommandButtonClicked: {
if(!chatContentModule) {
console.debug("error on sending transaction command - chat content module is not set")
Expand Down
15 changes: 14 additions & 1 deletion ui/app/AppLayouts/Chat/views/CommunityColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,25 @@ Item {
}
}

StatusButton {
id: joinCommunityButton
text: root.communityData.access === Constants.communityChatOnRequestAccess
? qsTr("Request to join")
: qsTr("Join Community")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: communityHeader.bottom
anchors.topMargin: 8
anchors.bottomMargin: Style.current.halfPadding
visible: !communityData.joined
onClicked: root.store.requestToJoinCommunity(communityData.id, root.store.userProfileInst.name)
}

Loader {
id: membershipRequests

property int nbRequests: root.communityData.pendingRequestsToJoin.count || 0

anchors.top: communityHeader.bottom
anchors.top: joinCommunityButton.visible ? joinCommunityButton.bottom : communityHeader.bottom
anchors.topMargin: active ? 8 : 0
anchors.horizontalCenter: parent.horizontalCenter

Expand Down

0 comments on commit 333e313

Please sign in to comment.