summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-04-09 14:56:05 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-04-09 14:56:05 +0800
commit3cdfc988b4de612f0da54a4d9450c7c5822f54b5 (patch)
tree627c84d5caf037e6c3ec515f51bad95782724bbb
parent6eb030cc676ea0c8941e7fe2951dc36ae1652ad6 (diff)
Show "Submitted" instead of due date when applicable
-rw-r--r--contents/ui/ActivityView.qml13
-rw-r--r--contents/ui/main.qml2
2 files changed, 9 insertions, 6 deletions
diff --git a/contents/ui/ActivityView.qml b/contents/ui/ActivityView.qml
index b3ba66c..7bc66ed 100644
--- a/contents/ui/ActivityView.qml
+++ b/contents/ui/ActivityView.qml
@@ -77,16 +77,18 @@ RowLayout {
}
humanDueString += " " + Qt.formatTime(due)
-
- if (pastDue) {
- humanDueString += " " + i18n("(missed)")
- }
return humanDueString
} catch (e) {
return isoDue // screw it
}
}
+ function dueLabelText() {
+ if (type != "assignment") { return "" }
+ if (submitted) { return i18n("Submitted") }
+ return i18n("Due: ") + humanDue(dueAt)
+ }
+
RowLayout {
Layout.fillWidth: true
PlasmaComponents3.CheckBox {
@@ -104,13 +106,12 @@ RowLayout {
color: important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor
elide: Text.ElideRight
Layout.fillWidth: true
-
}
PlasmaComponents3.Label {
id: dueLabel
visible: type == "assignment"
- text: dueAt ? ("Due: " + humanDue(dueAt)) : ""
+ text: dueLabelText()
color: activityLabel.color
Layout.fillWidth: true
}
diff --git a/contents/ui/main.qml b/contents/ui/main.qml
index 5b3ebb5..5593b8c 100644
--- a/contents/ui/main.qml
+++ b/contents/ui/main.qml
@@ -79,6 +79,7 @@ Item {
course: course[1],
title: assignment.name,
dueAt: assignment.due_at,
+ submitted: assignment.has_submitted_submissions,
url: assignment.html_url,
important: plasmoid.configuration.importantAssignments.includes(assignment.id.toString()),
}
@@ -154,6 +155,7 @@ Item {
course: "EE210"
title: "Title"
dueAt: "2022-04-10T15:59:59Z"
+ submitted: true
url: "https://xkcd.com"
important: true
activityId: 1