summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/ReviewList.qml
blob: e8821af2572d8f37aa72db00ead67b2f822aa333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
pragma ComponentBehavior: Bound
import QtQuick
import QtCore
import QtQuick.Controls as QQC2
import QtQuick.Layouts

import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.kirigamiaddons.components as KirigamiComponents


Kirigami.CardsListView {
    id: root

    Kirigami.PlaceholderMessage {
        visible: root.count == 0
        anchors.centerIn: parent
        text: "No reviews!"
    }

    delegate: Kirigami.AbstractCard {
        id: delegate

        required property int id
        required property string diff
        required property var reviews

        clip: true

        header: Editor {
            text: delegate.diff
            file: "bla.txt"
        }

        contentItem: Item {
            implicitHeight: commentsLayout.implicitHeight
            implicitWidth: commentsLayout.implicitWidth
            ColumnLayout {
                id: commentsLayout
                anchors.fill: parent

                Repeater {
                    model: delegate.reviews
                    ColumnLayout {
                        required property var modelData

                        Kirigami.Separator {
                            Layout.fillWidth: true
                        }
                        RowLayout {
                            Layout.fillWidth: true
                            Layout.fillHeight: true

                            KirigamiComponents.Avatar {
                                name: modelData.user.username
                                source: modelData.user.avatarUrl
                                Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
                                Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
                                Layout.fillWidth: false
                                Layout.alignment: Qt.AlignTop
                            }
                            QQC2.Label {
                                text: `@${modelData.user.username}`
                                Layout.fillWidth: false
                                Layout.alignment: Qt.AlignTop
                            }
                        }
                        MarkdownLabel {
                            Layout.fillWidth: true
                            text: modelData.body
                        }

                    }
                }

                MarkdownTextArea {
                    id: addComment
                    Layout.fillWidth: true
                }
            }
        }
    }
}