How tetashler/mrtcrowd works
MRTCrowd is a mobile-first Singapore MRT companion: passengers browse lines or a map, search stations, and open a line view for live crowd levels, operating status, and favourites. The React app routes between Home and LineScreen; both retrieve crowd data through a shared hook backed by Supabase, while station/line and timetable data drive presentation. Home also surfaces service alerts, a documented capability whose fetching implementation is not shown. Source excerpts support the principal UI calls and crowd-data read; several README capabilities and backend ingestion details are only documented or not evidenced in sampled source.
Main entry points: Home.tsx Home search · LineScreen.tsx Line detail · InteractiveMap.tsx Interactive map · stations.ts Line and station catalog
Components 23
Passenger experience
- App router
src/App.tsx - Home search
src/components/Home.tsx - Line detail
src/components/LineScreen.tsx - Interactive map
src/components/InteractiveMap.tsx - Favourite stations
src/components/FavouriteStations.tsx - Line cards
src/components/LineCard.tsx - Station cards
src/components/StationCard.tsx - Service alerts
src/components/DisruptionBanner.tsx - Station popup
src/components/StationPopup.tsx - Crowd indicator
src/components/CrowdIcon.tsx
Network and service data
- Line and station catalog
src/data/stations.ts - Map station layout
src/data/mrtStations.ts - Station coordinates
src/data/stationCoordinates.ts - Station positions
src/data/stationPositions.ts - Operating hours
src/data/operatingHours.ts
User preferences
- Favourite storage
src/utils/favourites.ts - Theme state
src/context/ThemeContext.tsx - Map-list state
src/context/ViewContext.tsx
Live data services
- Crowd data hook
src/hooks/useCrowdData.ts - Supabase crowd store
- Crowd ingestion
api/sync-crowd.js - Alert ingestion
api/sync-alerts.js
Other components
- Passenger
Connections 33
- Passenger → App router: opens app
README.md - App router → Home search: routes home
src/App.tsx - App router → Line detail: routes line
src/App.tsx - Home search → Line detail: navigates to
src/components/Home.tsx - Home search → Interactive map: renders map
src/components/Home.tsx - Home search → Favourite stations: renders favourites
src/components/Home.tsx - Home search → Line cards: renders lines
src/components/Home.tsx - Home search → Service alerts: renders alerts
src/components/Home.tsx - Home search → Line and station catalog: uses station catalog
src/components/Home.tsx - Home search → Theme state: reads theme
src/components/Home.tsx - Home search → Map-list state: reads view mode
src/components/Home.tsx - Line detail → Station cards: renders stations
src/components/LineScreen.tsx - Line detail → Line and station catalog: reads line data
src/components/LineScreen.tsx - Line detail → Operating hours: checks status
src/components/LineScreen.tsx - Line detail → Crowd data hook: loads crowd data
src/components/LineScreen.tsx - Line detail → Favourite storage: updates favourites
src/components/LineScreen.tsx - Line detail → Theme state: reads theme
src/components/LineScreen.tsx - Interactive map → Crowd data hook: loads crowd data
src/components/InteractiveMap.tsx - Interactive map → Map station layout: uses station layout
src/components/InteractiveMap.tsx - Interactive map → Operating hours: shows station hours
src/components/InteractiveMap.tsx - Interactive map → Crowd indicator: renders indicator
src/components/InteractiveMap.tsx - Interactive map → Station popup: shows station details
- Favourite stations → Favourite storage: reads favourites
src/components/FavouriteStations.tsx - Favourite stations → Crowd data hook: loads crowd data
src/components/FavouriteStations.tsx - Favourite stations → Line and station catalog: reads station names
src/components/FavouriteStations.tsx - Line cards → Line and station catalog: uses line data
src/components/LineCard.tsx - Station cards → Line and station catalog: uses station data
src/components/StationCard.tsx - Crowd data hook → Supabase crowd store: queries crowd rows
src/hooks/useCrowdData.ts - Crowd ingestion → Supabase crowd store: writes crowd rows
- Alert ingestion → Service alerts: provides service alerts
- Station coordinates → Interactive map: supplies coordinates
- Station positions → Interactive map: supplies positions
- Favourite storage → Passenger: persists choices
src/utils/favourites.ts