From c651ae6d7a11c77a607543a1afae863b20b6d174 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 22 Sep 2024 15:37:36 -0300 Subject: Pull request description and comments working --- kodereviewer/qml/CommentDelegate.qml | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 kodereviewer/qml/CommentDelegate.qml (limited to 'kodereviewer/qml/CommentDelegate.qml') 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 + } + } + } +} -- cgit v1.2.3-70-g09d2