2023-02-01 10:54:12 +00:00
import QtQuick 2.14
import QtQuick . Controls 2.14
import QtQuick . Layouts 1.14
import StatusQ . Core 0.1
import StatusQ . Components 0.1
import StatusQ . Core . Theme 0.1
import Storybook 1.0
import Models 1.0
SplitView {
id: root
Logs { id: logs }
QtObject {
id: d
2023-09-19 08:25:48 +00:00
readonly property var messagesModel: ListModel {
2023-02-01 10:54:12 +00:00
ListElement {
2023-09-19 08:25:48 +00:00
timestamp: 1656937930123
senderId: "zq123456789"
2023-02-01 10:54:12 +00:00
senderDisplayName: "simon"
profileImage: " data: image / png ; base64 , iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh / 5 nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7 /
nzPcxEzGExhBdJGYihtAYQlO + tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD //+wwFVpz+yqXAAAAAElFTkSuQmCC"
contentType: StatusMessage . ContentType . Text
2023-09-19 08:25:48 +00:00
message: "Hello, this is awesome! Feels like decentralized Discord! And it even supports HTML markup, like <b>bold</b>, <i>italics</i> or <u>underline</u>"
2023-02-01 10:54:12 +00:00
isContact: true
2023-09-19 08:25:48 +00:00
isAReply: false
2023-02-01 10:54:12 +00:00
trustIndicator: StatusContactVerificationIcons . TrustedType . Verified
}
ListElement {
2023-09-19 08:25:48 +00:00
timestamp: 1657937930135
senderId: "zqABCDEFG"
2023-02-01 10:54:12 +00:00
senderDisplayName: "Mark Cuban"
contentType: StatusMessage . ContentType . Text
message: "I know a lot of you really seem to get off or be validated by arguing with strangers online but please know it's a complete waste of your time and energy"
isContact: false
2023-09-19 08:25:48 +00:00
isAReply: false
2023-02-01 10:54:12 +00:00
trustIndicator: StatusContactVerificationIcons . TrustedType . Untrustworthy
}
2023-09-19 08:25:48 +00:00
ListElement {
timestamp: 1667937930159
senderId: "zqdeadbeef"
senderDisplayName: "replicator.stateofus.eth"
contentType: StatusMessage . ContentType . Text
message: "Test reply; the original text above should have a horizontal gradient mask"
isContact: true
isAReply: true
trustIndicator: StatusContactVerificationIcons . TrustedType . None
}
2023-02-01 10:54:12 +00:00
}
2023-09-19 08:25:48 +00:00
readonly property var colorHash: ListModel {
2023-02-01 10:54:12 +00:00
ListElement { colorId: 13 ; segmentLength: 5 }
ListElement { colorId: 31 ; segmentLength: 5 }
ListElement { colorId: 10 ; segmentLength: 1 }
ListElement { colorId: 2 ; segmentLength: 5 }
ListElement { colorId: 26 ; segmentLength: 2 }
ListElement { colorId: 19 ; segmentLength: 4 }
ListElement { colorId: 28 ; segmentLength: 3 }
}
}
SplitView {
orientation: Qt . Vertical
SplitView.fillWidth: true
Rectangle {
SplitView.fillWidth: true
SplitView.fillHeight: true
color: Theme . palette . statusAppLayout . rightPanelBackgroundColor
ListView {
2023-09-19 08:25:48 +00:00
anchors.margins: 16
2023-02-01 10:54:12 +00:00
anchors.fill: parent
spacing: 16
model: d . messagesModel
delegate: StatusMessage {
width: ListView . view . width
timestamp: model . timestamp
2023-09-19 08:25:48 +00:00
messageDetails {
readonly property bool isEnsVerified: model . senderDisplayName . endsWith ( ".eth" )
2023-02-01 10:54:12 +00:00
messageText: model . message
contentType: model . contentType
2023-09-19 08:25:48 +00:00
sender.id: isEnsVerified ? "" : model . senderId
2023-02-01 10:54:12 +00:00
sender.displayName: model . senderDisplayName
sender.isContact: model . isContact
sender.trustIndicator: model . trustIndicator
2023-09-19 08:25:48 +00:00
sender.isEnsVerified: isEnsVerified
sender . profileImage {
2023-02-01 10:54:12 +00:00
name: model . profileImage || ""
2023-09-19 08:25:48 +00:00
colorId: index
2023-02-01 10:54:12 +00:00
colorHash: d . colorHash
}
}
2023-09-19 08:25:48 +00:00
isAReply: model . isAReply
replyDetails {
amISender: true
sender.id: "0xdeadbeef"
sender . profileImage {
width: 20
height: 20
name: ModelsData . icons . dribble
colorHash: d . colorHash
}
messageText: ModelsData . descriptions . mediumLoremIpsum
}
onSenderNameClicked: logs . logEvent ( "StatusMessage::senderNameClicked" )
onProfilePictureClicked: logs . logEvent ( "StatusMessage::profilePictureClicked" )
onReplyProfileClicked: logs . logEvent ( "StatusMessage::replyProfileClicked" )
onReplyMessageClicked: logs . logEvent ( "StatusMessage::replyMessageClicked" )
2023-02-01 10:54:12 +00:00
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
logsView.logText: logs . logText
}
}
}
2023-07-31 12:21:14 +00:00
// category: Components