From 668732f0188d9f98ac63bae368d4ecbff4cf571c Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Wed, 26 Jul 2023 15:34:07 +0800 Subject: Fetch and display announcement message --- contents/ui/ActivityView.qml | 4 +++- contents/ui/kanvas.js | 2 ++ contents/ui/main.qml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3