Skip to main content

Preset Editing

Source: app/(edit-preset)/ The (edit-preset) route group contains screens for creating, editing, and deleting presets. Presets are reusable configurations that can be attached to time slots with a single tap during commitment creation.

Preset Types


Location Preset Editor

The most complex preset editor (~400 lines). It integrates Google Maps with:
  • Full-screen MapView with a draggable pin marker for precise placement
  • Address search via Google Places API on the search-preset-location.tsx sub-screen
  • Radius slider for geofence configuration (10m - 500m range)
  • Name input for human-readable preset identification
  • Preview circle rendered on the map showing the geofence boundary

Digital Preset Editor

The blocklist preset editor reuses the same three-tab interface (Apps, Websites, Search) from the app blocker spoke screen:
  • Apps tab: Lists installed apps via AppListerModule with toggle selection
  • Websites tab: Manual URL input with domain validation
  • Package search: Full-text search across installed package names

Rule Preset Editor

Configures verification behavior presets:

Isolated State Architecture

Preset editing uses usePresetEditStore — a completely separate Zustand store isolated from both usePresetStore (read-only hydrated presets) and useTaskDraftStore (active wizard state). This guarantees that:
  • Editing a preset mid-wizard does not corrupt the in-progress commitment draft
  • Canceling a preset edit leaves all other stores untouched
  • The isDirty flag on the edit store enables “unsaved changes” confirmation dialogs

Persistence Flow