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 <[email protected]>
This commit is contained in:
1 parent
93e0494864
commit
417b3adfe8
68 files changed
+3919
No files matched your search
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div class="timer-wrap">
|
||||
<!-- SVG circular ring -->
|
||||
<svg class="timer-ring" viewBox="0 0 200 200">
|
||||
<circle cx="100" cy="100" r="88" class="ring-bg" />
|
||||
<circle
|
||||
cx="100" cy="100" r="88"
|
||||
class="ring-fill"
|
||||
:style="{ strokeDashoffset: dashOffset, stroke: ringColor }"
|
||||
/>
|
||||
</svg>
|
||||
<div class="timer-inner">
|
||||
<div class="timer-time">{{ display }}</div>
|
||||
<div class="timer-label">{{ label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onUnmounted, ref, watch } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
block: { type: Object, default: null },
|
||||
session: { type: Object, default: null },
|
||||
})
|
||||
|
||||
const elapsed = ref(0)
|
||||
let interval = null
|
||||
|
||||
function parseTime(str) {
|
||||
if (!str) return 0
|
||||
const [h, m, s = 0] = str.split(':').map(Number)
|
||||
return h * 3600 + m * 60 + s
|
||||
}
|
||||
|
||||
const blockDuration = computed(() => {
|
||||
if (!props.block) return 0
|
||||
return parseTime(props.block.time_end) - parseTime(props.block.time_start)
|
||||
})
|
||||
|
||||
const remaining = computed(() => Math.max(0, blockDuration.value - elapsed.value))
|
||||
|
||||
const display = computed(() => {
|
||||
const s = remaining.value
|
||||
const m = Math.floor(s / 60)
|
||||
const sec = s % 60
|
||||
return `${String(m).padStart(2, '0')}:${String(sec).padStart(2, '0')}`
|
||||
})
|
||||
|
||||
const label = computed(() => {
|
||||
if (remaining.value === 0) return 'Done!'
|
||||
return 'remaining'
|
||||
})
|
||||
|
||||
const CIRCUMFERENCE = 2 * Math.PI * 88
|
||||
const dashOffset = computed(() => {
|
||||
if (!blockDuration.value) return CIRCUMFERENCE
|
||||
const pct = remaining.value / blockDuration.value
|
||||
return CIRCUMFERENCE * (1 - pct)
|
||||
})
|
||||
|
||||
const ringColor = computed(() => props.block?.subject?.color || '#4f46e5')
|
||||
|
||||
// Tick timer
|
||||
watch(() => props.block?.id, () => { elapsed.value = 0 })
|
||||
|
||||
function startTick() {
|
||||
if (interval) clearInterval(interval)
|
||||
interval = setInterval(() => { elapsed.value++ }, 1000)
|
||||
}
|
||||
|
||||
startTick()
|
||||
onUnmounted(() => clearInterval(interval))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.timer-wrap {
|
||||
position: relative;
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
}
|
||||
|
||||
.timer-ring {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.ring-bg {
|
||||
fill: none;
|
||||
stroke: #1e293b;
|
||||
stroke-width: 12;
|
||||
}
|
||||
|
||||
.ring-fill {
|
||||
fill: none;
|
||||
stroke-width: 12;
|
||||
stroke-linecap: round;
|
||||
stroke-dasharray: 552.92; /* 2π×88 */
|
||||
transition: stroke-dashoffset 1s linear, stroke 0.5s;
|
||||
}
|
||||
|
||||
.timer-inner {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.timer-time {
|
||||
font-size: 4rem;
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.timer-label {
|
||||
font-size: 0.9rem;
|
||||
color: #64748b;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user