Rework day progress bar to use block-duration time instead of wall clock

Both the TV and parent dashboard progress bars now calculate % complete
based on total scheduled block time vs. remaining block + break time,
so the bar only advances while blocks are actively being worked.

TV bar labels changed to "🟢 Start" and "Finish 🏁".
Parent dashboard shows first block's scheduled start time on the left
and a live estimated finish time (now + remaining block/break time) on
the right.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
derekcandClaude Sonnet 4.6 committed 2026-03-03 13:38:40 -08:00
1 parent 87e5ab7b5b
commit c05543d855
3 files changed
+88 -57

No files matched your search

+14 -14
View File
@@ -17,11 +17,11 @@
</header>
<!-- Day progress bar — full width, always visible when day hours are set -->
<div class="tv-day-progress" v-if="scheduleStore.dayStartTime && scheduleStore.dayEndTime">
<div class="tv-day-progress" v-if="scheduleStore.blocks.length > 0">
<div class="tv-day-progress-meta">
<span class="tv-day-start">{{ formatDayTime(scheduleStore.dayStartTime) }}</span>
<span class="tv-day-start">🟢 Start</span>
<span class="tv-day-pct">{{ dayProgressPercent }}% through the day</span>
<span class="tv-day-end">{{ formatDayTime(scheduleStore.dayEndTime) }}</span>
<span class="tv-day-end">Finish 🏁</span>
</div>
<ProgressBar :percent="dayProgressPercent" />
</div>
@@ -167,12 +167,6 @@ const dateDisplay = computed(() =>
)
// Day progress helpers
function timeStrToMinutes(str) {
if (!str) return null
const [h, m] = str.split(':').map(Number)
return h * 60 + m
}
function formatDayTime(str) {
if (!str) return ''
const [h, m] = str.split(':').map(Number)
@@ -182,11 +176,17 @@ function formatDayTime(str) {
}
const dayProgressPercent = computed(() => {
const start = timeStrToMinutes(scheduleStore.dayStartTime)
const end = timeStrToMinutes(scheduleStore.dayEndTime)
if (start === null || end === null || end <= start) return 0
const nowMin = now.value.getHours() * 60 + now.value.getMinutes()
return Math.max(0, Math.min(100, Math.round((nowMin - start) / (end - start) * 100)))
const allBlocks = scheduleStore.blocks
if (!allBlocks.length) return 0
const totalSeconds = allBlocks.reduce((sum, b) => sum + (b.duration_minutes || 0) * 60, 0)
if (totalSeconds === 0) return 0
const remainingSeconds = allBlocks.reduce((sum, b) => {
if (scheduleStore.completedBlockIds.includes(b.id)) return sum
const blockTotal = (b.duration_minutes || 0) * 60
const elapsed = blockElapsed(b)
return sum + Math.max(0, blockTotal - elapsed)
}, 0)
return Math.max(0, Math.min(100, Math.round((totalSeconds - remainingSeconds) / totalSeconds * 100)))
})
// Countdown to first block