@@ -337,21 +337,30 @@ export function HomeView() {
337337 } , [ records , holidaySourceMap ] )
338338 const selectedHolidaySource = holidaySources . find ( ( item ) => item . id === DEFAULT_HOLIDAY_SOURCE_ID ) ?? holidaySources [ 0 ] ?? null
339339 const currentMonthSummary = useMemo ( ( ) => {
340- if ( ! selectedHolidaySource ) return { off : 0 , work : 0 }
340+ if ( ! selectedHolidaySource ) return { totalOff : 0 , remainingOff : 0 , totalWork : 0 , remainingWork : 0 }
341341
342342 const dayMap = buildHolidayDayMap ( selectedHolidaySource )
343343 const now = new Date ( )
344344 const prefix = `${ now . getFullYear ( ) } -${ String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) } -`
345- let off = 0
346- let work = 0
345+ const todayKey = `${ now . getFullYear ( ) } -${ String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) } -${ String ( now . getDate ( ) ) . padStart ( 2 , "0" ) } `
346+ let totalOff = 0
347+ let remainingOff = 0
348+ let totalWork = 0
349+ let remainingWork = 0
347350
348351 for ( const [ dateKey , info ] of dayMap . entries ( ) ) {
349352 if ( ! dateKey . startsWith ( prefix ) ) continue
350- if ( info . kind === "off" ) off += 1
351- if ( info . kind === "work" ) work += 1
353+ if ( info . kind === "off" ) {
354+ totalOff += 1
355+ if ( dateKey >= todayKey ) remainingOff += 1
356+ }
357+ if ( info . kind === "work" ) {
358+ totalWork += 1
359+ if ( dateKey >= todayKey ) remainingWork += 1
360+ }
352361 }
353362
354- return { off , work }
363+ return { totalOff , remainingOff , totalWork , remainingWork }
355364 } , [ selectedHolidaySource ] )
356365
357366 function saveStateSnapshot (
@@ -738,8 +747,10 @@ export function HomeView() {
738747 cleanupCandidateCount = { cleanupCandidateAlarmIds . length }
739748 currentHolidayTitle = { selectedHolidaySource ?. title || "" }
740749 syncedHolidayCount = { selectedHolidaySource ?. holidayDates . length ?? 0 }
741- currentMonthOffCount = { currentMonthSummary . off }
742- currentMonthWorkCount = { currentMonthSummary . work }
750+ currentMonthTotalOffCount = { currentMonthSummary . totalOff }
751+ currentMonthRemainingOffCount = { currentMonthSummary . remainingOff }
752+ currentMonthTotalWorkCount = { currentMonthSummary . totalWork }
753+ currentMonthRemainingWorkCount = { currentMonthSummary . remainingWork }
743754 lastSyncedAt = { selectedHolidaySource ?. lastSyncedAt ?? null }
744755 />
745756 </ NavigationStack >
0 commit comments