How thanreiz/nextstep works
Lunti is an offline-first rice-farming PWA that helps a farmer decide whether to drain a paddy, records confirmed actions, and supports block-level water-delivery planning. The core workflow is: configure a parcel and crop, refresh cached weather and typhoon data, assemble local readings into a decision input, apply safe-AWD rules, show the verdict, and record farmer-confirmed draining. The graph also includes water measurement, ledger, and source-information screens. Several screen and integration links rely on README or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: decisionRepository.ts Decision assembly · App.tsx App navigation · DecisionScreen.tsx Decision screen · db.ts IndexedDB
Components 34
Farmer experience
- App navigation
src/App.tsx - Parcel setup
src/ui/screens/OnboardingScreen.tsx - Decision screen
src/ui/screens/DecisionScreen.tsx - Water entry
src/ui/screens/WaterScreen.tsx - Action ledger
src/ui/screens/LedgerScreen.tsx - Block schedule
src/ui/screens/BlocksScreen.tsx - Tube guide
src/ui/screens/TubeGuideScreen.tsx - Sources screen
src/ui/screens/SourcesScreen.tsx
Decision coordination
- Decision hook
src/ui/hooks/useDecision.ts - Refresh hook
src/ui/hooks/useRefresh.ts - Decision assembly
src/data/repositories/decisionRepository.ts
Agronomy and planning
- AWD rules
src/domain/awdEngine.ts - Crop phenology
src/domain/cropCycle.ts - Rain rules
src/domain/weather.ts - Typhoon assessment
src/domain/hazard.ts - Block planner
src/domain/blockPlan.ts - Ledger estimates
src/domain/ledger.ts
Local data and integrations
- IndexedDB
src/data/db.ts - Parcel repository
src/data/repositories/parcelRepository.ts - Crop-cycle repository
src/data/repositories/cropCycleRepository.ts - Water-reading repository
src/data/repositories/waterReadingRepository.ts - Drain-event repository
src/data/repositories/drainEventRepository.ts - Hazard repository
src/data/repositories/hazardRepository.ts - Weather repository
src/data/repositories/weatherRepository.ts - Demo observations
src/data/repositories/seed.ts - NOAH track client
src/data/noah.ts - Open-Meteo client
src/data/openMeteo.ts - Typed results
src/data/result.ts - Refresh flags
src/data/flags.ts
Language and guidance
- Translations
src/i18n/index.ts - Language provider
src/ui/i18n.tsx
Other components
- Farmer
- UP NOAH service
- Open-Meteo service
Connections 46
- Farmer → App navigation: uses
README.md - App navigation → Parcel setup: routes to
src/App.tsx - App navigation → Decision screen: routes to
src/App.tsx - App navigation → Water entry: routes to
src/App.tsx - App navigation → Action ledger: routes to
src/App.tsx - App navigation → Block schedule: routes to
src/App.tsx - App navigation → Tube guide: routes to
src/App.tsx - App navigation → Sources screen: routes to
src/App.tsx - Parcel setup → Parcel repository: saves parcel
src/ui/screens/OnboardingScreen.tsx - Parcel setup → Crop-cycle repository: saves crop cycle
src/ui/screens/OnboardingScreen.tsx - Parcel setup → Water-reading repository: saves reading
src/ui/screens/OnboardingScreen.tsx - Parcel setup → Demo observations: seeds demo
src/ui/screens/OnboardingScreen.tsx - Decision screen → Decision hook: gets verdict
src/ui/screens/DecisionScreen.tsx - Decision screen → Refresh hook: requests refresh
src/ui/screens/DecisionScreen.tsx - Decision screen → Drain-event repository: confirms drain
src/ui/screens/DecisionScreen.tsx - Decision hook → Decision assembly: requests decision
src/ui/hooks/useDecision.ts - Refresh hook → Weather repository: refreshes weather
src/ui/hooks/useRefresh.ts - Refresh hook → Hazard repository: refreshes hazard
src/ui/hooks/useRefresh.ts - Decision assembly → Parcel repository: loads parcel
src/data/repositories/decisionRepository.ts - Decision assembly → Crop-cycle repository: loads crop cycle
src/data/repositories/decisionRepository.ts - Decision assembly → Water-reading repository: loads reading
src/data/repositories/decisionRepository.ts - Decision assembly → Weather repository: loads cached rain
src/data/repositories/decisionRepository.ts - Decision assembly → Hazard repository: loads threat
src/data/repositories/decisionRepository.ts - Decision assembly → AWD rules: runs rules
src/data/repositories/decisionRepository.ts - Decision assembly → Block planner: plans block
src/data/repositories/decisionRepository.ts - AWD rules → Crop phenology: checks stage
src/domain/awdEngine.ts - AWD rules → Rain rules: checks rainfall
src/domain/awdEngine.ts - Block schedule → Decision assembly: requests block plan
src/ui/screens/BlocksScreen.tsx - Action ledger → Drain-event repository: reads confirmed log
- Drain-event repository → IndexedDB: writes events
src/data/repositories/drainEventRepository.ts - Parcel repository → IndexedDB: reads and writes
src/data/repositories/parcelRepository.ts - Crop-cycle repository → IndexedDB: reads and writes
src/data/repositories/cropCycleRepository.ts - Water-reading repository → IndexedDB: reads and writes
src/data/repositories/waterReadingRepository.ts - Hazard repository → IndexedDB: caches threat
src/data/repositories/hazardRepository.ts - Weather repository → IndexedDB: caches forecast
src/data/repositories/weatherRepository.ts - Demo observations → IndexedDB: writes demo data
src/data/repositories/seed.ts - Hazard repository → NOAH track client: refreshes track
src/data/repositories/hazardRepository.ts - NOAH track client → UP NOAH service: fetches track
README.md - Weather repository → Open-Meteo client: fetches forecast
src/data/repositories/weatherRepository.ts - Open-Meteo client → Open-Meteo service: requests forecast
README.md - Hazard repository → Typhoon assessment: resolves threat
src/data/repositories/hazardRepository.ts - Weather repository → Refresh flags: uses staleness flags
src/data/repositories/weatherRepository.ts - Hazard repository → Typed results: returns typed result
src/data/repositories/hazardRepository.ts - Decision screen → Ledger estimates: shows estimates
src/ui/screens/DecisionScreen.tsx - Decision screen → Language provider: translates verdict
src/ui/screens/DecisionScreen.tsx - Language provider → Translations: loads translations
src/ui/i18n.tsx