Initial project scaffold
Full-stack homeschool web app with FastAPI backend, Vue 3 frontend, MySQL database, and Docker Compose orchestration. Includes JWT auth, WebSocket real-time TV dashboard, schedule builder, activity logging, and multi-child support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
242
frontend/src/views/TVView.vue
Normal file
242
frontend/src/views/TVView.vue
Normal file
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<div class="tv-root">
|
||||
<!-- Header bar -->
|
||||
<header class="tv-header">
|
||||
<div class="tv-child-name">{{ scheduleStore.child?.name || 'Loading...' }}</div>
|
||||
<div class="tv-clock">{{ clockDisplay }}</div>
|
||||
<div class="tv-date">{{ dateDisplay }}</div>
|
||||
</header>
|
||||
|
||||
<!-- No session state -->
|
||||
<div v-if="!scheduleStore.session" class="tv-idle">
|
||||
<div class="tv-idle-icon">🌟</div>
|
||||
<div class="tv-idle-text">No active school session today</div>
|
||||
</div>
|
||||
|
||||
<!-- Active session -->
|
||||
<div v-else class="tv-main">
|
||||
<!-- Current block (big display) -->
|
||||
<div class="tv-current" v-if="scheduleStore.currentBlock">
|
||||
<div
|
||||
class="tv-subject-badge"
|
||||
:style="{ background: currentSubjectColor }"
|
||||
>
|
||||
{{ currentSubjectIcon }} {{ currentSubjectName }}
|
||||
</div>
|
||||
<TimerDisplay
|
||||
:block="scheduleStore.currentBlock"
|
||||
:session="scheduleStore.session"
|
||||
/>
|
||||
<div class="tv-block-notes" v-if="scheduleStore.currentBlock.notes">
|
||||
{{ scheduleStore.currentBlock.notes }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tv-sidebar">
|
||||
<!-- Progress -->
|
||||
<div class="tv-progress-section">
|
||||
<div class="tv-progress-label">
|
||||
Day Progress — {{ scheduleStore.progressPercent }}%
|
||||
</div>
|
||||
<ProgressBar :percent="scheduleStore.progressPercent" />
|
||||
<div class="tv-block-count">
|
||||
{{ scheduleStore.completedBlockIds.length }} of {{ scheduleStore.blocks.length }} blocks
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Schedule list -->
|
||||
<div class="tv-schedule-list">
|
||||
<ScheduleBlock
|
||||
v-for="block in scheduleStore.blocks"
|
||||
:key="block.id"
|
||||
:block="block"
|
||||
:is-current="block.id === scheduleStore.session?.current_block_id"
|
||||
:is-completed="scheduleStore.completedBlockIds.includes(block.id)"
|
||||
compact
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- WS connection indicator -->
|
||||
<div class="tv-ws-status" :class="{ connected: wsConnected }">
|
||||
{{ wsConnected ? '● Live' : '○ Reconnecting...' }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useScheduleStore } from '@/stores/schedule'
|
||||
import { useWebSocket } from '@/composables/useWebSocket'
|
||||
import TimerDisplay from '@/components/TimerDisplay.vue'
|
||||
import ProgressBar from '@/components/ProgressBar.vue'
|
||||
import ScheduleBlock from '@/components/ScheduleBlock.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const scheduleStore = useScheduleStore()
|
||||
const childId = parseInt(route.params.childId)
|
||||
|
||||
// Clock
|
||||
const now = ref(new Date())
|
||||
setInterval(() => { now.value = new Date() }, 1000)
|
||||
|
||||
const clockDisplay = computed(() =>
|
||||
now.value.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })
|
||||
)
|
||||
const dateDisplay = computed(() =>
|
||||
now.value.toLocaleDateString([], { weekday: 'long', month: 'long', day: 'numeric' })
|
||||
)
|
||||
|
||||
// Subject display helpers
|
||||
const currentSubjectColor = computed(() => {
|
||||
const block = scheduleStore.currentBlock
|
||||
return block?.subject?.color || '#4F46E5'
|
||||
})
|
||||
const currentSubjectIcon = computed(() => scheduleStore.currentBlock?.subject?.icon || '📚')
|
||||
const currentSubjectName = computed(() =>
|
||||
scheduleStore.currentBlock?.label || scheduleStore.currentBlock?.subject?.name || 'Current Block'
|
||||
)
|
||||
|
||||
// WebSocket
|
||||
const wsConnected = ref(false)
|
||||
const { connected } = useWebSocket(childId, (msg) => {
|
||||
scheduleStore.applyWsEvent(msg)
|
||||
})
|
||||
wsConnected.value = connected.value
|
||||
|
||||
// Initial data load
|
||||
onMounted(async () => {
|
||||
await scheduleStore.fetchDashboard(childId)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tv-root {
|
||||
min-height: 100vh;
|
||||
background: #0f172a;
|
||||
color: #f1f5f9;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 2rem;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.tv-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 2px solid #1e293b;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.tv-child-name {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
color: #818cf8;
|
||||
}
|
||||
|
||||
.tv-clock {
|
||||
font-size: 3rem;
|
||||
font-weight: 300;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #f8fafc;
|
||||
}
|
||||
|
||||
.tv-date {
|
||||
font-size: 1.25rem;
|
||||
color: #94a3b8;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tv-idle {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.tv-idle-icon { font-size: 5rem; }
|
||||
.tv-idle-text { font-size: 2rem; color: #64748b; }
|
||||
|
||||
.tv-main {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 380px;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.tv-current {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tv-subject-badge {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 600;
|
||||
padding: 0.75rem 2rem;
|
||||
border-radius: 999px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tv-block-notes {
|
||||
font-size: 1.25rem;
|
||||
color: #94a3b8;
|
||||
text-align: center;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.tv-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.tv-progress-section {
|
||||
background: #1e293b;
|
||||
border-radius: 1rem;
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.tv-progress-label {
|
||||
font-size: 0.9rem;
|
||||
color: #64748b;
|
||||
margin-bottom: 0.5rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.tv-block-count {
|
||||
font-size: 0.85rem;
|
||||
color: #475569;
|
||||
margin-top: 0.5rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tv-schedule-list {
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
max-height: 60vh;
|
||||
}
|
||||
|
||||
.tv-ws-status {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
right: 1rem;
|
||||
font-size: 0.75rem;
|
||||
color: #ef4444;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.tv-ws-status.connected {
|
||||
color: #22c55e;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user