Add Morning Routine to Admin and TV greeting state

Adds a per-user Morning Routine item list that appears in the TV
dashboard Activities panel during the "Good Morning" countdown
(before the first block starts).

- morning_routine_items table (auto-created on startup)
- CRUD API at /api/morning-routine (auth-required)
- Items included in the public DashboardSnapshot so TV gets them
  without auth
- Morning Routine section in Admin page (same add/edit/delete UX
  as subject options)
- TV Activities column shows routine items when no block is active,
  switches to subject options once a block starts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 22:19:15 -08:00
parent b5f4188396
commit 5cd537a445
9 changed files with 222 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ export const useScheduleStore = defineStore('schedule', () => {
const blockElapsedCache = ref({}) // blockId → total elapsed seconds (survives block switches)
const dayStartTime = ref(null) // "HH:MM:SS" string or null
const dayEndTime = ref(null) // "HH:MM:SS" string or null
const morningRoutine = ref([]) // list of text strings shown during greeting state
const currentBlock = computed(() =>
session.value?.current_block_id
@@ -40,6 +41,7 @@ export const useScheduleStore = defineStore('schedule', () => {
if (snapshot.child) child.value = snapshot.child
dayStartTime.value = snapshot.day_start_time || null
dayEndTime.value = snapshot.day_end_time || null
morningRoutine.value = snapshot.morning_routine || []
// Restore elapsed time from server-computed value and seed the per-block cache
const serverElapsed = snapshot.block_elapsed_seconds || 0
if (snapshot.session?.current_block_id && serverElapsed > 0) {
@@ -165,6 +167,7 @@ export const useScheduleStore = defineStore('schedule', () => {
blockElapsedCache,
dayStartTime,
dayEndTime,
morningRoutine,
currentBlock,
progressPercent,
applySnapshot,