feat: add enable/disable toggle for chore scheduling in ScheduleModal
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m39s

- Introduced a toggle button to enable or disable chores in the scheduler.
- The toggle will be available in both types of schedulers.
- Added UI design proposal and considerations for mobile dimensions.
- Included E2E tests to ensure toggle state persistence and correct behavior in child view.
This commit is contained in:
2026-03-20 16:42:13 -04:00
parent db6e0a7ce8
commit ef9cb01d92
45 changed files with 3543 additions and 232 deletions

View File

@@ -32,6 +32,7 @@ export interface ChoreSchedule {
interval_has_deadline: boolean // false = "Anytime" (no deadline)
interval_hour: number
interval_minute: number
enabled?: boolean // false = schedule paused; chore won't appear for child
created_at: number
updated_at: number
}

View File

@@ -44,8 +44,10 @@ export function intervalHitsToday(
* Returns true if the schedule applies today (localDate).
* - 'days' mode: today's weekday is in day_configs
* - 'interval' mode: intervalHitsToday
* - paused (enabled === false): always returns true (chore shows every day, like no schedule)
*/
export function isScheduledToday(schedule: ChoreSchedule, localDate: Date): boolean {
if (schedule.enabled === false) return true // paused = show always, like an unscheduled chore
if (schedule.mode === 'days') {
const todayWeekday = getLocalWeekday(localDate)
return schedule.day_configs.some((dc: DayConfig) => dc.day === todayWeekday)
@@ -56,6 +58,7 @@ export function isScheduledToday(schedule: ChoreSchedule, localDate: Date): bool
/**
* Returns the due time {hour, minute} for today, or null if:
* - the schedule is paused (enabled === false) → no deadline, acts like Anytime
* - the day is not scheduled, OR
* - the schedule has no deadline (interval_has_deadline === false → "Anytime")
*
@@ -65,6 +68,7 @@ export function getDueTimeToday(
schedule: ChoreSchedule,
localDate: Date,
): { hour: number; minute: number } | null {
if (schedule.enabled === false) return null // paused = no deadline, no expiry
if (schedule.mode === 'days') {
// default_has_deadline === false means 'Anytime' — no expiry for scheduled days
if (schedule.default_has_deadline === false) return null