2021-08-30 09:50:45 +00:00
|
|
|
import QtQuick 2.14
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2022-03-14 19:32:52 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-04-01 11:46:32 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2021-01-25 20:01:00 +00:00
|
|
|
Column {
|
2021-10-21 22:39:53 +00:00
|
|
|
id: root
|
2021-01-25 20:01:00 +00:00
|
|
|
spacing: Style.current.padding
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-08-30 09:50:45 +00:00
|
|
|
topPadding: visible ? Style.current.bigPadding : 0
|
|
|
|
bottomPadding: visible? 50 : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2022-01-27 18:10:21 +00:00
|
|
|
property bool amIChatAdmin: false
|
2021-12-10 16:11:18 +00:00
|
|
|
property string chatName: ""
|
2022-04-01 11:46:32 +00:00
|
|
|
property string chatId: ""
|
2021-12-10 16:11:18 +00:00
|
|
|
property int chatType: -1
|
|
|
|
property string chatColor: ""
|
2022-03-14 19:32:52 +00:00
|
|
|
property string chatEmoji: ""
|
2021-12-10 16:11:18 +00:00
|
|
|
property string chatIcon: ""
|
2022-02-11 16:01:36 +00:00
|
|
|
property bool didIJoinedChat: true
|
|
|
|
|
|
|
|
signal joinChatClicked()
|
|
|
|
signal rejectJoiningChatClicked()
|
2021-10-21 22:39:53 +00:00
|
|
|
|
2022-04-01 11:46:32 +00:00
|
|
|
StatusSmartIdenticon {
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-04-01 11:46:32 +00:00
|
|
|
name: root.chatName
|
|
|
|
icon {
|
2020-07-15 21:04:14 +00:00
|
|
|
width: 120
|
|
|
|
height: 120
|
2022-04-01 11:46:32 +00:00
|
|
|
color: root.chatColor
|
|
|
|
emoji: root.chatEmoji
|
|
|
|
charactersLen: root.chatType === Constants.chatType.oneToOne ? 2 : 1
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
2022-04-01 11:46:32 +00:00
|
|
|
image {
|
|
|
|
width: 120
|
|
|
|
height: 120
|
|
|
|
source: root.chatIcon
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
2022-04-01 11:46:32 +00:00
|
|
|
ringSettings.ringSpecModel: root.chatType === Constants.chatType.oneToOne ? Utils.getColorHashAsJson(root.chatId) : undefined
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: channelName
|
|
|
|
wrapMode: Text.Wrap
|
2021-12-10 16:11:18 +00:00
|
|
|
text: root.chatName
|
2020-07-15 21:04:14 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 22
|
2020-07-17 11:36:36 +00:00
|
|
|
color: Style.current.textColor
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
2021-04-28 17:33:10 +00:00
|
|
|
StyledText {
|
|
|
|
id: descText
|
|
|
|
wrapMode: Text.Wrap
|
2020-08-07 21:36:35 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-04-28 17:33:10 +00:00
|
|
|
width: 310
|
|
|
|
text: {
|
2021-12-10 16:11:18 +00:00
|
|
|
switch(root.chatType) {
|
|
|
|
case Constants.chatType.privateGroupChat:
|
|
|
|
//% "Welcome to the beginning of the <span style='color: %1'>%2</span> group!"
|
|
|
|
return qsTrId("welcome-to-the-beginning-of-the--span-style--color---1---2--span--group-").arg(Style.current.textColor).arg(root.chatName);
|
|
|
|
case Constants.chatType.oneToOne:
|
|
|
|
//% "Any messages you send here are encrypted and can only be read by you and <span style='color: %1'>%2</span>"
|
|
|
|
return qsTrId("any-messages-you-send-here-are-encrypted-and-can-only-be-read-by-you-and--span-style--color---1---2--span-").arg(Style.current.textColor).arg(root.chatName)
|
2021-04-28 17:33:10 +00:00
|
|
|
default: return "";
|
2020-08-07 21:36:35 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-28 17:33:10 +00:00
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
textFormat: Text.RichText
|
2020-08-07 21:36:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
Item {
|
2022-02-11 16:01:36 +00:00
|
|
|
id: joinOrDecline
|
|
|
|
visible: root.chatType === Constants.chatType.privateGroupChat && !root.amIChatAdmin && !root.didIJoinedChat
|
2020-09-18 13:11:51 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-04-28 17:33:10 +00:00
|
|
|
width: visible ? joinChat.width : 0
|
|
|
|
height: visible ? 100 : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: joinChat
|
|
|
|
//% "Join chat"
|
|
|
|
text: qsTrId("join-chat")
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: Style.current.blue
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2022-02-11 16:01:36 +00:00
|
|
|
root.joinChatClicked()
|
|
|
|
joinOrDecline.visible = false // Once we start getting member `joined` updates from `status-go` we can remove this
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
//% "Decline invitation"
|
|
|
|
text: qsTrId("group-chat-decline-invitation")
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: Style.current.blue
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: joinChat.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2022-02-11 16:01:36 +00:00
|
|
|
root.rejectJoiningChatClicked()
|
|
|
|
joinOrDecline.visible = false // Once we start getting member `joined` updates from `status-go` we can remove this
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|