Skip to content

feat: scheduled habits, push notifications & Google Calendar sync#189

Open
Dimsum-art wants to merge 2 commits intodohsimpson:mainfrom
Dimsum-art:001-habit-schedule-gcal
Open

feat: scheduled habits, push notifications & Google Calendar sync#189
Dimsum-art wants to merge 2 commits intodohsimpson:mainfrom
Dimsum-art:001-habit-schedule-gcal

Conversation

@Dimsum-art
Copy link
Copy Markdown

Summary

  • Weekly Agenda view — new calendar view with time-blocked habits in a 30-min time grid and all-day habits in a counter band; week navigation, mobile day-switcher, respects weekStartDay setting
  • Scheduled habits — habits can be all-day (default, backward-compatible) or time-blocked with startTime/endTime; counter habits support up to 100 daily completions with +/- UX and progress bar
  • Push notifications — persistent per-user subscriptions stored in data/pushSubscriptions.json; server-side checker runs every 5 min via cron; time-blocked habits notified at startTime, all-day habits at 08:00/12:00/18:00; auto-cancelled on completion
  • Google Calendar sync — OAuth2 integration; habits sync as GCal events with RRULE passthrough; 15-min polling syncs completions back; feature-flagged via GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET env vars

New environment variables (optional)

Variable Purpose
GOOGLE_CLIENT_ID Enable Google Calendar integration
GOOGLE_CLIENT_SECRET Enable Google Calendar integration
COMPLETE_HMAC_SECRET Secure habit completion URLs (defaults to a dev value)

Backward compatibility

All new Habit fields (scheduleType, startTime, endTime, notificationsEnabled, googleCalendarEventId) are optional — existing habits work identically without migration.

Test plan

  • Existing habits still display and complete normally (backward compat)
  • Create a time-blocked habit — verify it appears in weekly agenda time grid at correct slot
  • Create a counter habit (target > 1) — verify +/- buttons, progress bar, fraction label
  • Enable notifications in Settings — grant browser permission, send test notification
  • Connect Google Calendar (requires GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET) — verify GCal event created on habit save, deleted on habit delete
  • Week navigation (prev/next/Today) and month/week view toggle

🤖 Generated with Claude Code

Dimsum-art and others added 2 commits April 1, 2026 08:24
Add gamified social challenges with goals, leaderboards, real-time chat,
and stats — ported from APE's Supabase-based model to HabitTrove's
JSON file persistence. Includes per-challenge file storage with atomic
writes, 5s polling chat, period-key completion system, multi-step
creation wizard, join-by-code, and i18n for 10 languages plus Dutch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Data model: adds ScheduleType, time-blocked fields (startTime/endTime),
  per-habit notificationsEnabled, googleCalendarEventId, NotificationSettings,
  GoogleCalendarSettings, PushSubscriptionsData to types.ts
- Utilities: getEffectiveScheduleType() and isTimeBlocked() helpers
- Atoms: weekStartAtom, weeklyHabitsAtom, BrowserSettings.calendarView
- Weekly Agenda: WeeklyAgenda, AgendaAllDayRow, AgendaTimeSlot components
  with time grid, all-day band, mobile day-switcher, week navigation
- Habit editor: schedule type toggle, time inputs, notification toggle,
  counter targetCompletions raised to 100
- HabitItem: counter +/- UX, time display, GCal sync badge
- DailyOverview: inline quick-increment for counter habits
- HabitCalendar: time-blocked display and startTime sort
- Push notifications: persistent per-user subscriptions (data/pushSubscriptions.json),
  server-side notification-checker.ts, 5-min cron, NotificationPermission component,
  enhanced service worker (tag, habitId, deep links)
- Google Calendar: OAuth2 client, sync engine (create/update/delete events,
  RRULE passthrough, extendedProperties.private.habitId), OAuth callback route,
  HMAC-signed completion URL route, server actions (connect/disconnect/triggerSync),
  15-min cron, settings card, useHabits sync on save/delete
- i18n: WeeklyAgenda, Notifications, GoogleCalendar namespaces in all 10 locales

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant