> ## Documentation Index
> Fetch the complete documentation index at: https://committ.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# December 30th, 2025

> Wrapping up the maps: Search integration, dynamic radius, and inverse geofencing.

# December 30th, 2025

Today was about taking our basic map implementation and "taming" it for the real-world use cases of CommitT. We wanted to move from just "showing a map" to having a fully functional location discovery and geofencing engine.

## 1. Search & Discovery

We integrated the Google Places API to allow users to find specific locations without scanning the map manually.

* **The Search Interface**: When a user taps the search icon, they are navigated to a dedicated search screen.
* **Concepts Behind the Autocomplete**: We implemented a debounced search that fetches predictions from Google Maps. Once a place is selected, we fetch its detailed geometry (latitude and longitude) to update our global state.

<img src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thsearchicon.png?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=98fee4084bee9300c569b5a24744478f" alt="Search Icon" width="115" height="113" data-path="2025/december/pow/30thsearchicon.png" />

<img src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thsearchplace.png?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=e710eee4d2255ebdec5deee8d80974e3" alt="Search Interface" width="335" height="749" data-path="2025/december/pow/30thsearchplace.png" />

***

## 2. State Management: Camera vs. Location

One of the trickiest parts was managing where the user is *looking* versus where the user is *committing*. We used **Zustand** to maintain two distinct states:

* **Camera Target**: Where the map is focused. Clicking a search result card updates this target, smoothly sliding the map to the new area.
* **Actual Location**: The specific point where the commitment circle/geofence is placed.

<img src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thafterclickingthecard.png?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=63e12b4fb228a0c926379b6dfef7246d" alt="Map focused after search selection" width="342" height="733" data-path="2025/december/pow/30thafterclickingthecard.png" />

***

## 3. Interaction & Dynamic Feedback

The map now feels like a physical tool thanks to real-time interactions:

* **Long Press for Placement**: Instead of just sticking a circle in the center, users can long-press anywhere on the map to set their commitment location instantly.
* **Native Slider for Radius**: We replaced dummy controls with a real native slider. As the user slides, the radius updates in the central store, and the map's circle expands or shrinks in real-time.

***

## 4. The Inverse Geofence (The "Stay In" vs "Stay Out" Logic)

This is a core feature for discipline. Sometimes you need to stay *within* a area (like the Gym), but sometimes you need to stay *out* of an area (like a bar or a friend's house).

We implemented an "Inverse" toggle:

* **Inward Fill**: A standard translucent blue circle indicating your allowed zone.
* **Outward Fill (Inverse)**: We used a complex polygon calculation (wrapping the entire globe and cutting a circle out of it) to shade everything *outside* the target zone. This visually reinforces that the rest of the world is "off-limits" for the duration of the commitment.

<div style={{ display: 'flex', gap: '10px' }}>
  <img src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thinwardradius.png?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=dda7e94c2c3276a80e237c698e1505b9" alt="Inward Radius" style={{ width: '48%' }} width="347" height="696" data-path="2025/december/pow/30thinwardradius.png" />

  <img src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thoutwardfill.png?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=74c39a1772542a2eec92c768ac15148a" alt="Outward Inverse Fill" style={{ width: '48%' }} width="343" height="721" data-path="2025/december/pow/30thoutwardfill.png" />
</div>

***

## Proof of Work: Final Wrap-up

The video below demonstrates the full flow: searching for a place, navigating through results, placing a commitment via long-press, adjusting the radius, and toggling the inverse geofence.

<video controls src="https://mintcdn.com/committ/vJRJdsP9RLqiZY2d/2025/december/pow/30thFinalwork.mp4?fit=max&auto=format&n=vJRJdsP9RLqiZY2d&q=85&s=5b4b27572f639b1b0d2da2e9c2d355f5" width="100%" data-path="2025/december/pow/30thFinalwork.mp4" />
