Enhanced Check-in System

The application features an enhanced check-in system that prioritizes ease of use for food truck owners.

Overview

The check-in system allows food truck owners to broadcast their current location to customers. It supports two main flows:

  • Default Flow: GPS-based nearby addresses discovery

  • Secondary Flow: Advanced map picker for custom locations

Default Flow: Nearby Addresses

This is the primary, streamlined check-in experience:

  1. User clicks "Check In"

  2. GPS location is obtained automatically

  3. Radar SDK searches for nearby addresses/places within 500m

  4. User selects from 3-5 closest addresses with distance indicators

  5. One-click check-in at selected location

Secondary Flow: Advanced Map Picker

For situations where the nearby addresses don’t match the desired location:

  1. User clicks "Choose Different Location"

  2. Interactive map opens with search functionality

  3. User can search for addresses or click on map

  4. Optional notes can be added

  5. Check-in with selected location

Features

GPS-based Discovery

Automatic location detection using the device’s GPS.

Distance Indicators

Shows how far each address is from the current position (e.g., "50m", "0.2km").

Address Types

Displays location types such as restaurant, park, business, etc.

Graceful Fallbacks

Falls back to map picker if GPS fails or is unavailable.

Error Handling

User-friendly error messages with alternatives when issues occur.

Time Span Options

Check-ins support automatic checkout with configurable durations:

Option Description

1 Hour

Check out automatically after 1 hour

2 Hours

Check out automatically after 2 hours

4 Hours

Check out automatically after 4 hours

8 Hours

Check out automatically after 8 hours

All Day

Check out at end of business day (6 PM)

Until Time

Check out at a specific time

Custom

Custom duration in minutes

Checkout Types

Check-ins can end in three ways:

Manual

Owner manually checks out the truck.

Automatic

System automatically checks out when the time span expires.

Superseded

A new check-in replaces the previous active one.

  • components/food-trucks/truck-checkin.tsx - Main check-in component

  • components/food-trucks/truck-checkin-demo.tsx - Demo/testing component

  • components/food-trucks/current-location.tsx - Current location display

  • components/food-trucks/location-selector.tsx - Location selection UI

  • components/map/location-picker.tsx - Interactive map picker

API Actions

The check-in system uses these server actions from app/actions/food-trucks.ts:

  • checkInTruck - Create a new check-in

  • checkOutTruck - Manually check out

  • getTruckCurrentLocation - Get current location with priority resolution

  • getTruckCheckInHistory - Get check-in history with pagination

  • getTruckCheckInStats - Get check-in statistics

Location Priority

When resolving a truck’s current location, the system uses this priority:

  1. Manual check-ins (highest) - Override all other locations

  2. Scheduled locations - Active during set times

  3. Base location (lowest) - Used when no other location is active