summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/CommentDelegate.qml
diff options
context:
space:
mode:
authorMatias Linares <matias.linares@comprandoengrupo.net>2024-09-22 15:37:36 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2024-09-22 15:37:36 -0300
commitc651ae6d7a11c77a607543a1afae863b20b6d174 (patch)
tree812d3b8fdb1b6d32b8046f0d55f882ed6db991ff /kodereviewer/qml/CommentDelegate.qml
parent504d29accac51c537d5dcd42b129deb6f7463457 (diff)
downloadkodereviewer-c651ae6d7a11c77a607543a1afae863b20b6d174.tar.gz
Pull request description and comments working
Diffstat (limited to 'kodereviewer/qml/CommentDelegate.qml')
-rw-r--r--kodereviewer/qml/CommentDelegate.qml77
1 files changed, 77 insertions, 0 deletions
diff --git a/kodereviewer/qml/CommentDelegate.qml b/kodereviewer/qml/CommentDelegate.qml
new file mode 100644
index 0000000..bac75d0
--- /dev/null
+++ b/kodereviewer/qml/CommentDelegate.qml
@@ -0,0 +1,77 @@
+import QtQml
+import QtQuick 6.7
+import QtQuick.Layouts 6.7
+import QtQuick.Controls 6.7 as QQC2
+
+import org.kde.kirigami as Kirigami
+import org.kde.kirigamiaddons.components as KirigamiComponents
+
+Kirigami.AbstractCard {
+ id: root
+ required property url avatarUrl
+ required property string createdAt
+ required property string username
+ required property string body
+
+ header: RowLayout {
+ KirigamiComponents.Avatar {
+ name: root.username
+ source: root.avatarUrl
+ Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
+ Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
+ }
+ Kirigami.Heading {
+ Layout.fillWidth: true
+ id: commentHeading
+ level: 3
+ text: `@${root.username}`
+ }
+ QQC2.Label {
+ text: new Date(root.createdAt).toLocaleString(Qt.locale(), Locale.ShortFormat)
+ }
+ Kirigami.ActionToolBar {
+ Layout.fillWidth: false
+ actions: [
+ Kirigami.Action {
+ icon.name: "overflow-menu"
+
+ Kirigami.Action {
+ text: "Edit"
+ icon.name: "edit-comment"
+ }
+
+ Kirigami.Action {
+ text: "Delete"
+ icon.name: "delete-comment"
+ }
+ }
+ ]
+
+ position: QQC2.ToolBar.Header
+ }
+ }
+
+ contentItem: Item {
+ implicitWidth: delegateLayout.implicitWidth
+ implicitHeight: delegateLayout.implicitHeight
+ ColumnLayout {
+ id: delegateLayout
+ spacing: Kirigami.Units.largeSpacing
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ }
+
+ Kirigami.Separator {
+ Layout.fillWidth: true
+ }
+ QQC2.Label {
+ Layout.fillWidth: true
+ text: root.body
+ textFormat: Text.MarkdownText
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+}