From 440fd1dd8c194e4e02fc47725296812fba31df5d Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Thu, 3 Oct 2024 10:48:42 -0300 Subject: Better layout --- kodereviewer/qml/PullRequestPage.qml | 104 ++++++++++++++++++++++++++++++++--- 1 file changed, 95 insertions(+), 9 deletions(-) (limited to 'kodereviewer/qml/PullRequestPage.qml') diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml index 5a687e9..e99d81b 100644 --- a/kodereviewer/qml/PullRequestPage.qml +++ b/kodereviewer/qml/PullRequestPage.qml @@ -20,6 +20,41 @@ Kirigami.ScrollablePage { property string currentView: "info" + actions: [ + Kirigami.Action { + id: reviewChangesAction + text: "Review changes" + icon.name: "preview-symbolic" + enabled: !!root.pullRequest + onTriggered: reviewChangesDialog.open() + } + ] + + Kirigami.Dialog { + id: reviewChangesDialog + standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel + title: i18nc("@title:window", "Review changes") + padding: Kirigami.Units.largeSpacing + preferredWidth: Kirigami.Units.gridUnit * 20 + ColumnLayout { + MarkdownTextArea { + Layout.fillWidth: true + } + Kirigami.Separator { + Kirigami.FormData.isSection: true + Layout.fillWidth: true + } + QQC2.RadioButton { + text: "Approve" + } + QQC2.RadioButton { + text: "Comment" + } + QQC2.RadioButton { + text: "Request changes" + } + } + } CommentModel { id: commentModel @@ -28,7 +63,6 @@ Kirigami.ScrollablePage { onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number) } - Kirigami.PlaceholderMessage { visible: !root.pullRequest anchors.centerIn: parent @@ -36,11 +70,10 @@ Kirigami.ScrollablePage { text: "Select a pull request" } - ColumnLayout { - id: mainLayout + Kirigami.FormLayout { + id: descriptionLayout visible: !!root.pullRequest && root.currentView == "info" - - spacing: Kirigami.Units.largeSpacing * 2 + anchors.fill: parent Kirigami.Heading { Layout.fillWidth: true @@ -52,9 +85,57 @@ Kirigami.ScrollablePage { wrapMode: Text.WordWrap } - Kirigami.ListSectionHeader { - Layout.fillWidth: true - text: "description" + Kirigami.Separator { + Kirigami.FormData.isSection: true + } + + RowLayout { + QQC2.Label { + text: "State: " + elide: Text.ElideRight + } + QQC2.Label { + text: root.pullRequest.state + elide: Text.ElideLeft + } + } + RowLayout { + QQC2.Label { + text: "Draft?: " + elide: Text.ElideRight + } + QQC2.Label { + text: root.pullRequest.draft ? i18n("Yes") : i18n("No") + elide: Text.ElideLeft + } + } + + RowLayout { + Repeater { + model: LabelModel { + pullRequest: root.pullRequest + } + delegate: Rectangle { + required property string name + required property string labelColor + required property string textColor + color: labelColor + width: thelabel.implicitWidth + height: thelabel.implicitHeight + radius: 5 + QQC2.Label { + id: thelabel + padding: Kirigami.Units.smallSpacing + text: name + color: textColor + } + } + } + } + + Kirigami.Separator { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: "Description" } MarkdownLabel { @@ -62,7 +143,8 @@ Kirigami.ScrollablePage { Layout.fillHeight: false leftPadding: Kirigami.Units.largeSpacing rightPadding: Kirigami.Units.largeSpacing - text: root.pullRequest ? root.pullRequest.body : "" + text: root.pullRequest ? + (root.pullRequest.body != "" ? root.pullRequest.body : "*No description provided.*") : "" } } ColumnLayout { @@ -73,6 +155,10 @@ Kirigami.ScrollablePage { } } + FilesView { + visible: !!root.pullRequest && root.currentView == "files" + } + footer: Kirigami.NavigationTabBar { actions: [ Kirigami.Action { -- cgit v1.2.3-70-g09d2