2020-12-11 20:38:10 +00:00
import QtQuick 2.3
2021-04-29 19:54:09 +00:00
import QtQuick . Dialogs 1.3
2022-06-08 14:43:46 +00:00
import QtQuick . Layouts 1.14
2021-10-01 15:58:36 +00:00
2021-09-28 15:04:06 +00:00
import utils 1.0
2020-12-11 20:38:10 +00:00
2021-10-18 12:32:48 +00:00
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Controls 0.1
2021-10-27 21:27:49 +00:00
import shared . panels 1.0
import shared . popups 1.0
2021-10-18 12:32:48 +00:00
2020-12-11 20:38:10 +00:00
Item {
id: root
anchors.left: parent . left
2021-08-30 09:50:45 +00:00
height: rectangleBubbleLoader . height
2021-04-30 14:45:13 +00:00
width: rectangleBubbleLoader . width
2020-12-11 20:38:10 +00:00
2021-10-21 00:41:54 +00:00
property string communityId
property var invitedCommunity
property int innerMargin: 12
property bool isLink: false
property var store
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
function getCommunity ( ) {
2022-02-11 21:41:34 +00:00
try {
const communityJson = root . store . getSectionByIdJson ( communityId )
if ( ! communityJson ) {
return null
}
2021-07-22 15:22:02 +00:00
2022-02-11 21:41:34 +00:00
return JSON . parse ( communityJson ) ;
} catch ( e ) {
console . error ( "Error parsing community" , e )
}
2021-07-22 15:22:02 +00:00
2022-02-11 21:41:34 +00:00
return null
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
2020-12-11 20:38:10 +00:00
Component.onCompleted: {
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
root . invitedCommunity = getCommunity ( )
}
2020-12-11 20:38:10 +00:00
2022-02-11 21:41:34 +00:00
Connections {
target: root . store . communitiesModuleInst
onCommunityChanged: function ( communityId ) {
if ( communityId === root . communityId ) {
root . invitedCommunity = getCommunity ( )
}
}
}
2020-12-11 20:38:10 +00:00
2021-07-12 17:49:06 +00:00
Component {
id: confirmationPopupComponent
ConfirmationDialog {
property string settingsProp: ""
property var onConfirmed: ( function ( ) { } )
showCancelButton: true
2021-07-16 20:22:50 +00:00
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: qsTrId ( "this-feature-is-experimental-and-is-meant-for-testing-purposes-by-core-contributors-and-the-community--it-s-not-meant-for-real-use-and-makes-no-claims-of-security-or-integrity-of-funds-or-data--use-at-your-own-risk-" )
//% "I understand"
confirmButtonLabel: qsTrId ( "i-understand" )
2021-07-12 17:49:06 +00:00
onConfirmButtonClicked: {
onConfirmed ( )
close ( )
}
onCancelButtonClicked: {
close ( )
}
onClosed: {
destroy ( )
}
}
}
2021-07-20 12:08:36 +00:00
2022-05-26 15:46:02 +00:00
Component {
id: communityIntroDialog
CommunityIntroDialog {
anchors.centerIn: parent
property var joinMethod: ( ) = > { }
name: root . invitedCommunity ? root.invitedCommunity.name : ""
introMessage: root . invitedCommunity ? root.invitedCommunity.introMessage : ""
imageSrc: root . invitedCommunity ? root.invitedCommunity.image : ""
onJoined: joinMethod ( )
}
}
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
2020-12-11 20:38:10 +00:00
Loader {
id: rectangleBubbleLoader
active: ! ! invitedCommunity
sourceComponent: Component {
Rectangle {
id: rectangleBubble
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
property alias button: joinBtn
2022-02-11 21:41:34 +00:00
property bool isPendingRequest: root . store . isCommunityRequestPending ( communityId )
2020-12-11 20:38:10 +00:00
width: 270
2022-06-08 14:43:46 +00:00
height: column . implicitHeight
2020-12-11 20:38:10 +00:00
radius: 16
color: Style . current . background
border.color: Style . current . border
border.width: 1
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
states: [
State {
name: "requiresEns"
2022-02-11 21:41:34 +00:00
when: invitedCommunity . ensOnly && ! userProfile . ensName
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Membership requires an ENS username"
text: qsTrId ( "membership-requires-an-ens-username" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "inviteOnly"
when: invitedCommunity . access === Constants . communityChatInvitationOnlyAccess
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "You need to be invited"
text: qsTrId ( "you-need-to-be-invited" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "pending"
when: invitedCommunity . access === Constants . communityChatOnRequestAccess &&
rectangleBubble . isPendingRequest
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Pending"
text: qsTrId ( "invite-chat-pending" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "joined"
2021-09-14 06:01:43 +00:00
when: ( invitedCommunity . joined && invitedCommunity . isMember ) ||
( invitedCommunity . access === Constants . communityChatPublicAccess &&
invitedCommunity . joined )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "View"
text: qsTrId ( "view" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
} ,
State {
name: "requestToJoin"
when: invitedCommunity . access === Constants . communityChatOnRequestAccess &&
2022-02-11 21:41:34 +00:00
! invitedCommunity . joined && ! invitedCommunity . isMember &&
2021-07-20 12:08:36 +00:00
invitedCommunity . canRequestAccess
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Request Access"
text: qsTrId ( "request-access" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
} ,
State {
name: "unjoined"
2021-09-14 06:01:43 +00:00
when: ( invitedCommunity . access === Constants . communityChatOnRequestAccess &&
invitedCommunity . isMember ) ||
( invitedCommunity . access === Constants . communityChatPublicAccess &&
! invitedCommunity . joined )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Join"
text: qsTrId ( "join" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
}
]
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// Connections {
// target: root.store.chatsModelInst.communities
// onMembershipRequestChanged: function(communityId, communityName, requestAccepted) {
// if (communityId === root.communityId) {
// rectangleBubble.isPendingRequest = false
// }
// }
// }
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
2022-06-08 14:43:46 +00:00
ColumnLayout {
id: column
width: parent . width
spacing: Style . current . halfPadding
// TODO add check if verified
StatusBaseText {
id: title
color: invitedCommunity . verifed ? Theme.palette.primaryColor1 : Theme . palette . baseColor1
text: invitedCommunity . verifed ?
//% "Verified community invitation"
qsTrId ( "verified-community-invitation" ) :
//% "Community invitation"
qsTrId ( "community-invitation" )
font.weight: Font . Medium
Layout.topMargin: Style . current . halfPadding
Layout.leftMargin: root . innerMargin
font.pixelSize: 13
}
StatusBaseText {
id: invitedYou
visible: text != ""
text: {
// Not Refactored Yet
return ""
// if (root.store.chatsModelInst.channelView.activeChannel.chatType === Constants.chatType.oneToOne) {
// return isCurrentUser ?
// //% "You invited %1 to join a community"
// qsTrId("you-invited--1-to-join-a-community").arg(root.store.chatsModelInst.userNameOrAlias(root.store.chatsModelInst.channelView.activeChannel.id))
// //% "%1 invited you to join a community"
// : qsTrId("-1-invited-you-to-join-a-community").arg(displayUserName)
// } else {
// return isCurrentUser ?
// //% "You shared a community"
// qsTrId("you-shared-a-community")
// //% "A community has been shared"
// : qsTrId("a-community-has-been-shared")
// }
}
Layout.leftMargin: root . innerMargin
Layout.rightMargin: root . innerMargin
Layout.fillWidth: true
wrapMode: Text . WordWrap
font.pixelSize: 15
color: Theme . palette . directColor1
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
2020-12-11 20:38:10 +00:00
2022-06-08 14:43:46 +00:00
Separator {
Layout.fillWidth: true
}
2020-12-11 20:38:10 +00:00
2022-06-08 14:43:46 +00:00
// TODO add image when it's supported
StatusBaseText {
id: communityName
text: invitedCommunity . name
Layout.topMargin: 2
Layout.leftMargin: root . innerMargin
Layout.fillWidth: true
Layout.rightMargin: root . innerMargin
font.weight: Font . Bold
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
font.pixelSize: 17
color: Theme . palette . directColor1
}
2020-12-11 20:38:10 +00:00
2022-06-08 14:43:46 +00:00
StatusBaseText {
id: communityDesc
text: invitedCommunity . description
Layout.leftMargin: root . innerMargin
Layout.rightMargin: root . innerMargin
Layout.fillWidth: true
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
font.pixelSize: 15
color: Theme . palette . directColor1
}
2020-12-11 20:38:10 +00:00
2022-06-08 14:43:46 +00:00
StatusBaseText {
id: communityNbMembers
// TODO add the plural support
//% "%1 members"
text: qsTrId ( "-1-members" ) . arg ( invitedCommunity . nbMembers )
Layout.leftMargin: root . innerMargin
font.pixelSize: 13
font.weight: Font . Medium
color: Theme . palette . baseColor1
}
2020-12-11 20:38:10 +00:00
2022-06-08 14:43:46 +00:00
Separator {
Layout.fillWidth: true
}
Item {
id: btnItemId
Layout.topMargin: - column . spacing
Layout.fillWidth: true
height: 44
clip: true
StatusFlatButton {
id: joinBtn
anchors.fill: parent
anchors.verticalCenter: parent . verticalCenter
radius: 16
enabled: true
text: qsTr ( "Unsupported state" )
onClicked: {
let onBtnClick = function ( ) {
let error
if ( rectangleBubble . state === "joined" ) {
root . store . setActiveCommunity ( communityId ) ;
return
}
if ( rectangleBubble . state === "unjoined" ) {
Global . openPopup ( communityIntroDialog , { joinMethod: ( ) = > {
let error = root . store . joinCommunity ( communityId )
if ( error ) joiningError . showError ( error )
} } ) ;
}
else if ( rectangleBubble . state === "requestToJoin" ) {
Global . openPopup ( communityIntroDialog , { joinMethod: ( ) = > {
let error = root . store . requestToJoinCommunity ( communityId , userProfile . name )
if ( error ) joiningError . showError ( error )
else rectangleBubble . isPendingRequest = root . store . isCommunityRequestPending ( communityId )
} } ) ;
}
if ( error ) joiningError . showError ( error )
2022-02-11 21:41:34 +00:00
}
2021-07-20 12:08:36 +00:00
2022-06-08 14:43:46 +00:00
if ( localAccountSensitiveSettings . communitiesEnabled ) {
onBtnClick ( ) ;
} else {
Global . openPopup ( confirmationPopupComponent , { onConfirmed: onBtnClick } ) ;
}
2022-02-11 21:41:34 +00:00
}
2021-07-12 17:49:06 +00:00
2022-06-08 14:43:46 +00:00
MessageDialog {
id: joiningError
2021-04-29 19:54:09 +00:00
2022-06-08 14:43:46 +00:00
function showError ( error ) {
joiningError . text = error
joiningError . open ( )
}
2022-05-26 15:46:02 +00:00
2022-06-08 14:43:46 +00:00
//% "Error joining the community"
title: qsTrId ( "error-joining-the-community" )
icon: StandardIcon . Critical
standardButtons: StandardButton . Ok
2022-05-26 15:46:02 +00:00
}
2021-04-29 19:54:09 +00:00
}
}
2020-12-11 20:38:10 +00:00
}
}
}
}
}