- Node.js 18+ installed
- Supabase project created
.env.localfile configured
npm installImportant: Run this first to populate sample data!
npm run seedThis will create:
- 2 Organizations
- 2 Projects
- 3 Sites
- 3 Species
- 3 Field Workers
- 2 Planting Batches
- 3 Sample Measurements
npm run devVisit: http://localhost:3000
URL: /dashboard/org
Features:
- View KPIs (projects, sites, total area)
- Create new projects (modal)
- View recent projects and sites
Test Flow:
- Click "Create Project"
- Fill in project details
- Submit → see new project in list
URL: /dashboard/sites
Features:
- View all sites in table
- Create new sites (modal)
- Access site details
Test Flow:
- Click "Create Site"
- Select project from dropdown
- Enter coordinates, area, habitat type
- Submit → see new site in table
- Click "View" to see site details
URL: /dashboard/sites/[siteId]
Features:
- View site metadata
- Add planting batches (modal)
- Manage field workers
- View measurements
Test Flow:
- From sites list, click "View"
- See site details with GPS coordinates
- Click "Add Planting Batch"
- Select species and quantities
- Submit → batch created
URL: /dashboard/field
Features:
- Select assigned site
- GPS auto-detection
- Mobile camera capture
- Submit measurements
Test Flow (Desktop):
- Click on a site card
- Click "📍 Auto-Detect GPS" (will fail on desktop, that's OK)
- Manually enter latitude/longitude
- Fill in measurement data
- Click "📷 Capture Photos" (select files)
- Submit measurement
Test Flow (Mobile):
- Open
/dashboard/fieldon phone - Select a site
- GPS auto-detects your location ✅
- Camera opens for rear camera capture 📸
- Take photos of vegetation
- Fill measurement form
- Submit → returns to site selection
URL: /dashboard/verifier
Features:
- View sites requiring verification
- Review recent measurements
- See pending verifications
Test Flow:
- View sites table
- Click "Review" on any site
- See site details and measurements
For Android:
- Connect phone to same WiFi
- Get your computer's local IP:
ipconfig(look for IPv4) - On phone, visit:
http://YOUR_IP:3000/dashboard/field - Grant location permissions
- GPS will auto-detect your coordinates
For iOS:
- Same as Android
- May need HTTPS for GPS to work
- Use ngrok or similar for HTTPS tunnel
After seeding, you'll have:
- Tamil Nadu Coastal Restoration
- Kerala Blue Carbon Initiative
- Pichavaram Mangrove Restoration 2024 (250.5 ha)
- Vembanad Lake Seagrass Restoration (180 ha)
- Pichavaram North Zone (75.2 ha) - Mangrove Forest
- Pichavaram South Zone (82.5 ha) - Mangrove Forest
- Vembanad East Meadow (60 ha) - Seagrass Meadow
- Rajesh Kumar (Supervisor)
- Priya Sharma (Field Worker)
- Arun Nair (Field Worker)
- Red Mangrove (Rhizophora mangle)
- Black Mangrove (Avicennia germinans)
- Eelgrass (Zostera marina)
- All creation forms use modals
- ESC key closes modal
- Click outside closes modal
- Cancel button works
- Auto-detection button
- Accuracy display (±Xm)
- Manual coordinate override
- Error handling for unsupported devices
- Rear camera opens on mobile
- Multiple photos supported
- Photo preview with thumbnails
- Remove individual photos
- All dashboards work on mobile
- Tables scroll horizontally
- Buttons stack on small screens
- Touch-friendly hit areas
Failed to fetch data
Fix: Check .env.local has correct Supabase credentials
GPS not supported on this device
Fix: GPS only works in browser on mobile/HTTPS. Desktop requires manual entry.
Note: Photo upload to Supabase Storage not yet implemented. Photos are captured and previewed locally only.
Fix: Run npm run seed to create sample sites
// Add to middleware.ts
import { createMiddlewareClient } from '@supabase/auth-helpers-nextjs'-- Filter sites by organization
CREATE POLICY "Users see own org sites"
ON sites FOR SELECT
USING (auth.uid() IN (
SELECT user_id FROM user_organizations
WHERE organization_id = sites.project.organization_id
));// Upload to Supabase Storage
const { data, error } = await supabase.storage
.from('site-photos')
.upload(`${siteId}/${Date.now()}.jpg`, photoFile);Run npm run dev and explore the dashboards. All features are functional and ready for testing!
Questions? Check DASHBOARD_IMPLEMENTATION.md for detailed technical documentation.