summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2023-07-26 15:34:07 +0800
committerFrederick Yin <fkfd@fkfd.me>2023-07-26 15:34:07 +0800
commit668732f0188d9f98ac63bae368d4ecbff4cf571c (patch)
treea8552e58524f65fdfd2c2d731e26a90a0fc8dfe8
parentd1486dfb2e7f46940ac544276877ce21c7eef6dc (diff)
Fetch and display announcement message
-rw-r--r--contents/ui/ActivityView.qml4
-rw-r--r--contents/ui/kanvas.js2
-rw-r--r--contents/ui/main.qml1
3 files changed, 6 insertions, 1 deletions
diff --git a/contents/ui/ActivityView.qml b/contents/ui/ActivityView.qml
index 3f82325..38b92f1 100644
--- a/contents/ui/ActivityView.qml
+++ b/contents/ui/ActivityView.qml
@@ -86,6 +86,7 @@ PlasmaComponents.ListItem {
PlasmaComponents3.ToolButton {
icon.name: "expand"
+ visible: type == "announcement"
// only show when mouse is hovering above this activity
opacity: activityItem.containsMouse ? 1 : 0
onClicked: () => {
@@ -137,8 +138,9 @@ PlasmaComponents.ListItem {
}
PlasmaExtras.Paragraph {
+ Layout.fillWidth: true
visible: expanded
- text: "Hello world!"
+ text: message
}
}
}
diff --git a/contents/ui/kanvas.js b/contents/ui/kanvas.js
index dbd2526..a8a8f7c 100644
--- a/contents/ui/kanvas.js
+++ b/contents/ui/kanvas.js
@@ -83,6 +83,7 @@ function syncCourses(courses, courseIndices, showSubmittedAssignments, userId) {
courseId: course.id,
course: course.code,
title: announcement.title,
+ message: announcement.message,
url: announcement.html_url,
important: plasmoid.configuration.importantAnnouncements
.includes(announcement.id.toString()),
@@ -133,6 +134,7 @@ function syncCourses(courses, courseIndices, showSubmittedAssignments, userId) {
courseId: course.id,
course: course.code,
title: assignment.name,
+ message: "",
// if null, use empty string to suppress errors
dueAt: assignment.due_at || "",
submitted: submitted,
diff --git a/contents/ui/main.qml b/contents/ui/main.qml
index 6fd20bc..0fb0b64 100644
--- a/contents/ui/main.qml
+++ b/contents/ui/main.qml
@@ -58,6 +58,7 @@ Item {
type: "announcement"
course: "CS101"
title: "Code quality"
+ message: "Code may be a little messy…"
url: "https://xkcd.com/1513"
important: true
finished: false