2020-12-11 20:38:10 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../shared"
|
|
|
|
import "../../../../../shared/status"
|
|
|
|
import "../../../../../imports"
|
|
|
|
import "./TransactionComponents"
|
|
|
|
import "../../../Wallet/data"
|
|
|
|
|
|
|
|
Item {
|
2021-03-08 20:21:56 +00:00
|
|
|
property string communityId
|
2020-12-11 20:38:10 +00:00
|
|
|
property var invitedCommunity
|
|
|
|
property int innerMargin: 12
|
|
|
|
property bool joined: false
|
2021-03-08 20:21:56 +00:00
|
|
|
property bool isLink: false
|
2020-12-11 20:38:10 +00:00
|
|
|
|
|
|
|
id: root
|
|
|
|
anchors.left: parent.left
|
|
|
|
height: childrenRect.height
|
2021-03-08 20:21:56 +00:00
|
|
|
width: rectangleBubbleLoader.width + chatImage.width
|
2020-12-11 20:38:10 +00:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
2021-03-08 20:21:56 +00:00
|
|
|
chatsModel.communities.setObservedCommunity(root.communityId)
|
2020-12-11 20:38:10 +00:00
|
|
|
|
2021-02-11 20:37:31 +00:00
|
|
|
root.invitedCommunity = chatsModel.communities.observedCommunity
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UserImage {
|
|
|
|
id: chatImage
|
2021-03-08 20:21:56 +00:00
|
|
|
visible: (!isLink && authorCurrentMsg !== authorPrevMsg && !isCurrentUser) ||
|
|
|
|
(appSettings.useCompactMode && isCurrentUser && authorCurrentMsg !== authorPrevMsg)
|
2020-12-11 20:38:10 +00:00
|
|
|
anchors.left: parent.left
|
2021-03-08 20:21:56 +00:00
|
|
|
anchors.leftMargin: visible ? Style.current.padding : 0
|
2020-12-11 20:38:10 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: rectangleBubbleLoader
|
|
|
|
active: !!invitedCommunity
|
|
|
|
width: item.width
|
|
|
|
height: item.height
|
2021-03-08 20:21:56 +00:00
|
|
|
anchors.left: !isLink && (!isCurrentUser || (isCurrentUser === appSettings.useCompactMode)) ? chatImage.right : undefined
|
|
|
|
anchors.leftMargin: isLink ? 0 : Style.current.smallPadding
|
|
|
|
anchors.right: !appSettings.useCompactMode && isCurrentUser ? parent.right : undefined
|
2020-12-11 20:38:10 +00:00
|
|
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
Rectangle {
|
|
|
|
id: rectangleBubble
|
|
|
|
width: 270
|
|
|
|
height: childrenRect.height + Style.current.halfPadding
|
|
|
|
radius: 16
|
|
|
|
color: Style.current.background
|
|
|
|
border.color: Style.current.border
|
|
|
|
border.width: 1
|
|
|
|
|
|
|
|
// TODO add check if verified
|
|
|
|
StyledText {
|
|
|
|
id: title
|
|
|
|
color: invitedCommunity.verifed ? Style.current.primary : Style.current.secondaryText
|
|
|
|
text: invitedCommunity.verifed ?
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Verified community invitation"
|
|
|
|
qsTrId("verified-community-invitation") :
|
|
|
|
//% "Community invitation"
|
|
|
|
qsTrId("community-invitation")
|
2020-12-11 20:38:10 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: root.innerMargin
|
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: invitedYou
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "%1 invited you to join a community"
|
|
|
|
text: qsTrId("-1-invited-you-to-join-a-community").arg(userName)
|
2020-12-11 20:38:10 +00:00
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: 4
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: root.innerMargin
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: root.innerMargin
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep1
|
|
|
|
anchors.top: invitedYou.bottom
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO add image when it's supported
|
|
|
|
StyledText {
|
|
|
|
id: communityName
|
|
|
|
text: invitedCommunity.name
|
|
|
|
anchors.top: sep1.bottom
|
|
|
|
anchors.topMargin: root.innerMargin
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: root.innerMargin
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: root.innerMargin
|
|
|
|
font.weight: Font.Bold
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: communityDesc
|
|
|
|
text: invitedCommunity.description
|
|
|
|
anchors.top: communityName.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: root.innerMargin
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: root.innerMargin
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: communityNbMembers
|
|
|
|
// TODO add the plural support
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "%1 members"
|
|
|
|
text: qsTrId("-1-members").arg(invitedCommunity.nbMembers)
|
2020-12-11 20:38:10 +00:00
|
|
|
anchors.top: communityDesc.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: root.innerMargin
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep2
|
|
|
|
anchors.top: communityNbMembers.bottom
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
type: "secondary"
|
|
|
|
anchors.top: sep2.bottom
|
|
|
|
width: parent.width
|
|
|
|
height: 44
|
|
|
|
enabled: !invitedCommunity.joined
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Joined"
|
|
|
|
text: root.joined || invitedCommunity.joined ? qsTrId("joined") :
|
|
|
|
//% "Join"
|
|
|
|
qsTrId("join")
|
2020-12-11 20:38:10 +00:00
|
|
|
onClicked: {
|
2021-03-05 09:05:04 +00:00
|
|
|
chatsModel.communities.joinCommunity(communityId, true)
|
2020-12-11 20:38:10 +00:00
|
|
|
root.joined = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#4c4e50";formeditorZoom:1.25}
|
|
|
|
}
|
|
|
|
##^##*/
|