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) {