From 4349e4f2c39a963041399be022ce314ac9f9b1ce Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Mon, 3 Feb 2025 15:25:43 -0500 Subject: [PATCH] Added Today View and show message with week info when in grading view. --- .../classroom_compliance/EntriesTable.vue | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/app/src/apps/classroom_compliance/EntriesTable.vue b/app/src/apps/classroom_compliance/EntriesTable.vue index db99efb..cdd46d1 100644 --- a/app/src/apps/classroom_compliance/EntriesTable.vue +++ b/app/src/apps/classroom_compliance/EntriesTable.vue @@ -22,7 +22,8 @@ const apiClient = new ClassroomComplianceAPIClient(authStore) enum TableView { FULL = "Full", GRADING = "Grading", - WHITEBOARD = "Whiteboard" + WHITEBOARD = "Whiteboard", + TODAY = "Today" } const students: Ref = ref([]) @@ -55,6 +56,12 @@ onMounted(async () => { } saveSortPreference() }) + // If the user selects "Today View", forcibly load the current week, so they'll only see today. + watch(selectedView, () => { + if (selectedView.value === TableView.TODAY) { + showThisWeek() + } + }) attemptSortByStoredPreference() }) @@ -185,6 +192,19 @@ async function discardEdits() { } } +function getVisibleDates(): string[] { + if (selectedView.value === TableView.FULL) return dates.value + if (selectedView.value === TableView.TODAY) { + const today = new Date() + today.setUTCHours(0, 0, 0, 0) + const todayStr = today.toISOString().substring(0, 10) + for (const date of dates.value) { + if (date === todayStr) return [date] + } + } + return [] +} + function addAllEntriesForDate(dateStr: string) { for (let i = 0; i < students.value.length; i++) { const student = students.value[i] @@ -198,9 +218,10 @@ function addAllEntriesForDate(dateStr: string) {