feat(GODT-3121): finalize UI for KB suggestions.

This commit is contained in:
Xavier Michelon
2023-12-01 17:18:51 +01:00
parent 39b31abef8
commit 120ddbbcbb
3 changed files with 122 additions and 113 deletions

View File

@ -36,7 +36,7 @@ Item {
} }
function showBugQuestion() { function showBugQuestion() {
bugQuestion.setCategoryId(root.categoryId); bugQuestion.setCategoryId(root.categoryId);
bugQuestion.positionViewAtBegining(); bugQuestion.positionViewAtBeginning();
bugReportFlow.currentIndex = 1; bugReportFlow.currentIndex = 1;
} }
function showBugReport() { function showBugReport() {

View File

@ -18,7 +18,6 @@ import ".."
SettingsView { SettingsView {
id: root id: root
property var selectedAddress property var selectedAddress
property var categoryId: -1 property var categoryId: -1
property string category: Backend.getBugCategory(root.categoryId) property string category: Backend.getBugCategory(root.categoryId)
@ -53,6 +52,9 @@ SettingsView {
root.setDefaultValue(); root.setDefaultValue();
} }
ColumnLayout {
spacing: 32
Label { Label {
colorScheme: root.colorScheme colorScheme: root.colorScheme
text: qsTr("Send report") text: qsTr("Send report")
@ -68,7 +70,6 @@ SettingsView {
Layout.minimumHeight: heightForLinesVisible(4) Layout.minimumHeight: heightForLinesVisible(4)
colorScheme: root.colorScheme colorScheme: root.colorScheme
textFormat: Text.MarkdownText textFormat: Text.MarkdownText
// set implicitHeight to explicit height because se don't // set implicitHeight to explicit height because se don't
// want TextArea implicitHeight (which is height of all text) // want TextArea implicitHeight (which is height of all text)
// to be considered in SettingsView internal scroll view // to be considered in SettingsView internal scroll view
@ -99,8 +100,12 @@ SettingsView {
} }
} }
RowLayout {
spacing: 12
TextField { TextField {
id: address id: address
Layout.preferredWidth: 1
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: root.colorScheme
label: qsTr("Your contact email") label: qsTr("Your contact email")
@ -113,6 +118,7 @@ SettingsView {
} }
TextField { TextField {
id: emailClient id: emailClient
Layout.preferredWidth: 1
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: root.colorScheme
label: qsTr("Your email client (including version)") label: qsTr("Your email client (including version)")
@ -123,37 +129,36 @@ SettingsView {
} }
} }
} }
}
RowLayout { RowLayout {
spacing: 12
CheckBox { CheckBox {
id: includeLogs id: includeLogs
checked: true checked: true
colorScheme: root.colorScheme colorScheme: root.colorScheme
text: qsTr("Include my recent logs") text: qsTr("Include my recent logs")
} }
Button { Button {
Layout.leftMargin: 12
colorScheme: root.colorScheme colorScheme: root.colorScheme
secondary: true secondary: true
text: qsTr("View logs") text: qsTr("View logs")
onClicked: Backend.openExternalLink(Backend.logsPath) onClicked: Backend.openExternalLink(Backend.logsPath)
} }
}
TextEdit { Label {
Layout.fillWidth: true Layout.fillWidth: true
verticalAlignment: Qt.AlignVCenter
colorScheme: root.colorScheme
type: Label.Caption
color: root.colorScheme.text_weak color: root.colorScheme.text_weak
font.family: ProtonStyle.font_family
font.letterSpacing: ProtonStyle.caption_letter_spacing
font.pixelSize: ProtonStyle.caption_font_size
font.weight: ProtonStyle.fontWeight_400
readOnly: true
selectByMouse: true
selectedTextColor: root.colorScheme.text_invert
// No way to set lineHeight: ProtonStyle.caption_line_height
selectionColor: root.colorScheme.interaction_norm
text: qsTr("Reports are not end-to-end encrypted, please do not send any sensitive information.") text: qsTr("Reports are not end-to-end encrypted, please do not send any sensitive information.")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
}
Button { Button {
id: sendButton id: sendButton
colorScheme: root.colorScheme colorScheme: root.colorScheme
@ -174,13 +179,17 @@ SettingsView {
function onBugReportSendSuccess() { function onBugReportSendSuccess() {
root.bugReportWasSent(); root.bugReportWasSent();
} }
function onReportBugFinished() { function onReportBugFinished() {
sendButton.loading = false; sendButton.loading = false;
} }
function onReceivedKnowledgeBaseSuggestions(suggestions) { function onReceivedKnowledgeBaseSuggestions(suggestions) {
root.suggestions = suggestions root.suggestions = suggestions
} }
target: Backend target: Backend
} }
} }
} }
}

View File

@ -30,7 +30,7 @@ Item {
property bool fillHeight: false property bool fillHeight: false
default property alias items: content.children default property alias items: content.children
function positionViewAtBegining() { function positionViewAtBeginning() {
scrollView.ScrollBar.vertical.position = 0 scrollView.ScrollBar.vertical.position = 0
} }
signal back signal back