Commit 5ee0a9c8 authored by Nate Graham's avatar Nate Graham 🔩

Overhaul presentation of link buttons in the Reviews section

Summary: Move the link buttons in the {nav Reviews} section around to improve their presentation. In the process, allow people to write reviews of installed apps without having to first open the review pop-up.

Test Plan:
{F5932817}

{F5932816}

{F5932835}

{F5932813}

{F5932812}

Reviewers: #discover_software_store, #vdg, apol

Reviewed By: #discover_software_store, apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13678
parent 3539dc6a
......@@ -29,6 +29,7 @@ import "navigation.js" as Navigation
DiscoverPage {
id: appInfo
property QtObject application: null
readonly property int visibleReviews: 3
clip: true
background: Rectangle { color: Kirigami.Theme.viewBackgroundColor }
......@@ -197,11 +198,27 @@ DiscoverPage {
}
Kirigami.Heading {
RowLayout {
Layout.topMargin: Kirigami.Units.largeSpacing
text: i18n("Reviews")
level: 2
visible: rep.count > 0
Layout.fillWidth: true
Kirigami.Heading {
Layout.fillWidth: true
text: i18n("Reviews")
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
level: 2
visible: rep.count > 0
}
LinkButton {
visible: reviewsModel.count > visibleReviews
text: i18n("Show all %1 reviews...", reviewsModel.count)
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
onClicked: {
reviewsSheet.open()
}
}
}
Rectangle {
......@@ -215,7 +232,7 @@ DiscoverPage {
id: rep
model: PaginateModel {
sourceModel: reviewsSheet.model
pageSize: 3
pageSize: visibleReviews
}
delegate: ReviewDelegate {
Layout.topMargin: Kirigami.Units.largeSpacing
......@@ -225,19 +242,28 @@ DiscoverPage {
}
}
LinkButton {
text: appInfo.application.isInstalled? i18n("Be the first to write a review!") : i18n("Install this app and be the first to write a review!")
function writeReviewText() {
if (appInfo.application.isInstalled) {
if (reviewsModel.count > 0) {
return i18n("Write a review!")
} else {
return i18n("Be the first to write a review!")
}
// App not installed
} else {
if (reviewsModel.count > 0) {
return i18n("Install this app to write a review!")
} else {
return i18n("Install this app and be the first to write a review!")
}
}
}
text: writeReviewText()
Layout.alignment: Qt.AlignCenter
onClicked: reviewsSheet.openReviewDialog()
enabled: appInfo.application.isInstalled
visible: !commentsButton.visible && reviewsModel.backend && reviewsModel.backend.isResourceSupported(appInfo.application)
}
LinkButton {
id: commentsButton
visible: reviewsModel.count > 0
text: i18n("Show all %1 reviews...", reviewsModel.count)
onClicked: {
reviewsSheet.open()
}
visible: reviewsModel.backend && reviewsModel.backend.isResourceSupported(appInfo.application)
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment