diff --git a/public/bus_routes.json b/public/bus_routes.json index a28aeaf..75aa07a 100644 --- a/public/bus_routes.json +++ b/public/bus_routes.json @@ -65,14 +65,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.08095, + "lng": 80.27076 } ], "from_lat": 13.184827, "from_lng": 80.31205, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.08095, + "to_lng": 80.27076, "polyline": [ [ 13.184827, @@ -1146,14 +1146,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.08095, + "lng": 80.27076 } ], "from_lat": 13.128881, "from_lng": 80.290792, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.08095, + "to_lng": 80.27076, "polyline": [ [ 13.184827, @@ -2193,14 +2193,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.08095, + "lng": 80.27076 } ], "from_lat": 13.08095, "from_lng": 80.27076, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.08095, + "to_lng": 80.27076, "polyline": [ [ 13.184827, @@ -3258,14 +3258,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0761258, "from_lng": 80.270781, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.100598, @@ -4211,14 +4211,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.090276, "from_lng": 80.265585, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.118326, @@ -5196,14 +5196,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0884944, "from_lng": 80.1909707, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.118326, @@ -6207,14 +6207,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.089154, "from_lng": 80.230054, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.118326, @@ -7220,14 +7220,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.085333, "from_lng": 80.187393, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.085333, @@ -7847,14 +7847,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0293843, "from_lng": 80.2342825, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R05A", @@ -7934,14 +7934,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0617032, "from_lng": 80.2346118, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R06", @@ -8023,14 +8023,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.062841, "from_lng": 80.197105, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.066018, @@ -13337,14 +13337,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R10", @@ -15473,14 +15473,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.2820098, "from_lng": 80.2537109, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R13", @@ -15560,14 +15560,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R13A", @@ -15623,14 +15623,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.1001091, "from_lng": 80.2145485, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R14", @@ -15698,14 +15698,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R14B", @@ -15743,14 +15743,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.1305159, "from_lng": 79.9243758, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R15", @@ -15818,14 +15818,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R15A", @@ -15929,14 +15929,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R15B", @@ -16010,14 +16010,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R16", @@ -16085,14 +16085,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R16B", @@ -16184,14 +16184,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R17", @@ -16245,14 +16245,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.040666, "from_lng": 80.17222, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.054006, @@ -16860,14 +16860,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.040666, "from_lng": 80.17222, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.054006, @@ -17479,14 +17479,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 12.984051, "from_lng": 80.2175088, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R18A", @@ -17542,14 +17542,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R18B", @@ -17635,14 +17635,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 12.7871437, "from_lng": 80.219987, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R19", @@ -17704,14 +17704,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R19A", @@ -17749,14 +17749,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R20", @@ -17818,14 +17818,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R20A", @@ -17881,14 +17881,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R21", @@ -17944,14 +17944,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R22", @@ -18043,14 +18043,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R22A", @@ -18136,14 +18136,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R23", @@ -18211,14 +18211,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R24", @@ -18346,14 +18346,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R25", @@ -18409,14 +18409,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.1331405, "from_lng": 80.1701786, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R25A", @@ -18460,14 +18460,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R26", @@ -18535,14 +18535,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.1938755, "from_lng": 80.2685646, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R27", @@ -20662,14 +20662,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.1158603, "from_lng": 80.2300407, - "to_lat": 13.03868, - "to_lng": 80.045138, + "to_lat": 13.0118, + "to_lng": 80.0214, "polyline": [ [ 13.115889, @@ -21543,14 +21543,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R29A", @@ -21600,14 +21600,14 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 }, { "number": "R29B", @@ -21669,13 +21669,13 @@ { "name": "RIT Campus", "time": "07:40 AM", - "lat": 13.03868, - "lng": 80.045138 + "lat": 13.0118, + "lng": 80.0214 } ], "from_lat": 13.0118, "from_lng": 80.0214, - "to_lat": 13.03868, - "to_lng": 80.045138 + "to_lat": 13.0118, + "to_lng": 80.0214 } ] \ No newline at end of file diff --git a/src/components/BusRouteMap/BusRouteMap.tsx b/src/components/BusRouteMap/BusRouteMap.tsx index 084f95a..844dee0 100644 --- a/src/components/BusRouteMap/BusRouteMap.tsx +++ b/src/components/BusRouteMap/BusRouteMap.tsx @@ -17,74 +17,28 @@ L.Icon.Default.mergeOptions({ shadowUrl: markerShadow, }); -// Glowing Live Bus Icon const liveBusIcon = L.divIcon({ - html: `
🚌
`, + html: `
🚌
`, className: '', iconSize: [40, 40], iconAnchor: [20, 20], }); -// Stopped Bus Icon const stoppedBusIcon = L.divIcon({ - html: `
🚌
`, + html: `
🚌
`, className: '', iconSize: [40, 40], iconAnchor: [20, 20], }); -// Helper: Create Clean Start Point Icon (Starting Location Name Only) -function createStartIcon(locationName: string) { - return L.divIcon({ - html: ` -
- -
- 📍 - ${locationName} -
-
- `, - className: '', - iconSize: [160, 40], - iconAnchor: [80, 20], - }); -} - -// Helper: Create Clean Destination Point Icon (RIT Campus Only) -function createDestinationIcon(locationName: string) { - const displayName = locationName.includes('RIT') ? locationName : 'RIT Campus'; - return L.divIcon({ - html: ` -
- -
- 🏫 - ${displayName} -
-
- `, - className: '', - iconSize: [160, 40], - iconAnchor: [80, 20], - }); -} - -// Helper component to auto-fit map view bounds when route changes -function MapPanFocus({ bounds }: { bounds: L.LatLngBoundsExpression | null }) { +// Helper component to pan map to active bus marker when selected +function MapPanFocus({ center }: { center: [number, number] | null }) { const map = useMap(); - useEffect(() => { - if (bounds) { - map.fitBounds(bounds, { - padding: [80, 80], - maxZoom: 14, - animate: true, - duration: 0.8, - }); + if (center) { + map.setView(center, 13, { animate: true }); } - }, [bounds, map]); - + }, [center, map]); return null; } @@ -93,8 +47,7 @@ interface BusRouteMapProps { allRoutes?: BusRoute[]; } -const RIT_CAMPUS_COORDS: [number, number] = [13.03868, 80.045138]; // True RIT Campus Kuthambakkam / Poonamallee -const DEFAULT_CENTER: [number, number] = RIT_CAMPUS_COORDS; +const DEFAULT_CENTER: [number, number] = [13.0118, 80.0214]; // RIT Campus default export default function BusRouteMap({ selectedRoute }: BusRouteMapProps) { const [allLiveLocations, setAllLiveLocations] = useState< @@ -147,52 +100,36 @@ export default function BusRouteMap({ selectedRoute }: BusRouteMapProps) { return () => clearInterval(interval); }, []); - // Compute Start and Destination coordinates only - const routeData = useMemo(() => { + // Determine center focus point if a bus is live or selected + const activeFocusCenter = useMemo<[number, number] | null>(() => { if (!selectedRoute) return null; - // Start coordinates - let startCoords: [number, number] | null = null; - let startName = selectedRoute.from || 'Start Point'; + const normalizeRouteNum = (str: string) => (str || '').replace(/^[Rr]0*/, '').trim().toUpperCase(); + const matchLocKey = Object.keys(allLiveLocations).find( + (k) => normalizeRouteNum(k) === normalizeRouteNum(selectedRoute.number) + ); - if (selectedRoute.from_lat && selectedRoute.from_lng) { - startCoords = [selectedRoute.from_lat, selectedRoute.from_lng]; - } else if (selectedRoute.stops && selectedRoute.stops.length > 0) { - const firstStop = selectedRoute.stops[0]; - if (firstStop.lat && firstStop.lng) { - startCoords = [firstStop.lat, firstStop.lng]; - startName = firstStop.name || startName; - } + if (matchLocKey && allLiveLocations[matchLocKey]) { + const loc = allLiveLocations[matchLocKey]; + return [loc.latitude, loc.longitude]; } - // Destination is ALWAYS the true RIT Campus location (Kuthambakkam) - const destCoords: [number, number] = RIT_CAMPUS_COORDS; - const destName = 'RIT Campus'; + if (selectedRoute.from_lat && selectedRoute.from_lng) { + return [selectedRoute.from_lat, selectedRoute.from_lng]; + } - // Compute bounding box for map view auto-fit (start & destination only) - const allPoints: [number, number][] = []; - if (startCoords) allPoints.push(startCoords); - if (destCoords) allPoints.push(destCoords); - - const bounds: L.LatLngBoundsExpression | null = - allPoints.length > 0 ? (allPoints as L.LatLngBoundsExpression) : null; - - return { - startCoords, - startName, - destCoords, - destName, - bounds, - }; - }, [selectedRoute]); + return DEFAULT_CENTER; + }, [selectedRoute, allLiveLocations]); return (
@@ -201,52 +138,7 @@ export default function BusRouteMap({ selectedRoute }: BusRouteMapProps) { url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> - {/* ── SELECTED ROUTE MARKERS (Starting Point & RIT Campus Destination ONLY) ── */} - {selectedRoute && routeData && ( - <> - {/* START Point Marker */} - {routeData.startCoords && ( - - -
- - 📍 ORIGIN / PICKUP - -

{routeData.startName}

-

- Departure: {selectedRoute.departureTime || 'Early Morning'} -

-
-
-
- )} - - {/* DESTINATION Point Marker (RIT Campus) */} - {routeData.destCoords && ( - - -
- - 🏫 DESTINATION - -

{routeData.destName}

-

- Arrival: {selectedRoute.arrivalTime || '08:30 AM'} -

-
-
-
- )} - - )} - - {/* ── LIVE GPS BUS TRACKING MARKERS ── */} + {/* Live GPS Bus Markers ONLY - No polyline routes */} {Object.entries(allLiveLocations).map(([rNum, loc]) => { const normalizeRouteNum = (str: string) => (str || '').replace(/^[Rr]0*/, '').trim().toUpperCase(); if (selectedRoute && normalizeRouteNum(selectedRoute.number) !== normalizeRouteNum(rNum)) return null; @@ -282,8 +174,7 @@ export default function BusRouteMap({ selectedRoute }: BusRouteMapProps) { ); })} - {/* Auto fit map bounds when selected route changes */} - +
{/* Floating Info Card on Selected Route */} @@ -292,21 +183,21 @@ export default function BusRouteMap({ selectedRoute }: BusRouteMapProps) {
{selectedRoute.number} {selectedRoute.name}
-

- 📍 Start: {selectedRoute.from} ({selectedRoute.departureTime}) +

+ 🏁 Start: {selectedRoute.from} ({selectedRoute.departureTime})

-

- 🏫 Destination: RIT Campus ({selectedRoute.arrivalTime}) +

+ 🏫 Destination: RIT Campus ({selectedRoute.arrivalTime})

-

- 📍 {selectedRoute.stops.length} mapped stops along route +

+ 📍 Stops: {selectedRoute.stops.length} mapped stops

diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index a2f90bd..a27b419 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -58,32 +58,32 @@ export default function Navbar() { initial={{ y: -100, opacity: 0 }} animate={{ y: 0, opacity: 1 }} transition={{ duration: 0.6, ease: 'easeOut' }} - className="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[96%] max-w-7xl transition-all duration-300 shadow-[0_8px_32px_rgba(0,0,0,0.3)]" + className="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[95%] max-w-6xl transition-all duration-300 shadow-[0_8px_32px_rgba(0,0,0,0.25)]" style={{ - background: 'linear-gradient(to right, rgba(15, 23, 42, 0.75) 0%, rgba(30, 41, 59, 0.65) 50%, rgba(15, 23, 42, 0.75) 100%)', + background: 'linear-gradient(to right, rgba(15, 23, 42, 0.45) 0%, rgba(30, 41, 59, 0.35) 50%, rgba(15, 23, 42, 0.45) 100%)', backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)', borderRadius: '20px', - border: '1px solid rgba(255, 255, 255, 0.15)', + border: '1px solid rgba(255, 255, 255, 0.1)', }} > -
+
{/* Logo - RIT Event Hub Style */} - + {/* Logo Image */}
- + rit -
-
+
+
RAJALAKSHMI INSTITUTE OF TECHNOLOGY @@ -92,14 +92,14 @@ export default function Navbar() { {/* Desktop Nav */} -
+
{NAV_LINKS.map((link) => { const isActive = checkIsActive(link.path); return ( {/* Right Side: Auth + Mobile Toggle */} -
+
{/* Auth Section */} {isAuthenticated && user ? (
@@ -140,8 +140,8 @@ export default function Navbar() { {user.name.charAt(0).toUpperCase()}
)} -
- +
+ {user.name.split(' ')[0]} {isVerifiedStudent && ( @@ -150,7 +150,7 @@ export default function Navbar() { )}
- + {/* Profile Dropdown */} @@ -213,10 +213,10 @@ export default function Navbar() {
) : ( diff --git a/src/constants/index.ts b/src/constants/index.ts index 3424b18..55d64b3 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -4,7 +4,7 @@ import type { Feature, Stat, BusRoute, Faculty, Event, Club, Question, ToolkitIt export const NAV_LINKS = [ { label: 'Home', path: '/' }, { label: 'Notes', path: '/notes' }, - { label: 'Toolkit', path: '/toolkit' }, + { label: 'Toolkit', path: '/notes?section=toolkit' }, { label: 'Chatbot', path: '/ai-assistant' }, { label: 'Campus Map', path: '/campus' }, { label: 'Bus Routes', path: '/bus-routes' }, @@ -98,24 +98,6 @@ export const FEATURES: Feature[] = [ color: '#06B6D4', bgColor: '#ECFEFF', }, - { - id: 'collab', - icon: 'Code2', - title: 'Dev Collab', - description: 'Connect with peer developers, build campus projects, share repositories, and collaborate.', - path: '/collab', - color: '#6366F1', - bgColor: '#EEF2FF', - }, - { - id: 'leetcode', - icon: 'Trophy', - title: 'LeetCode Leaderboard', - description: 'Track peer coding rankings, solve daily problems, and compete on the campus leaderboard.', - path: '/leetcode', - color: '#F59E0B', - bgColor: '#FEF3C7', - }, ]; // ─── Bus Routes ────────────────────────────────────────────────────────────── diff --git a/src/pages/Campus/Campus.tsx b/src/pages/Campus/Campus.tsx index 92c052f..4f7ff5d 100644 --- a/src/pages/Campus/Campus.tsx +++ b/src/pages/Campus/Campus.tsx @@ -23,9 +23,8 @@ const BLUEPRINT_LEGEND = [ { id: 'a-block', label: 'A Block', color: '#60A5FA', bg: 'bg-blue-50/80', text: 'text-blue-900', border: 'border-blue-200' }, { id: 'b-block', label: 'B Block', color: '#93C5FD', bg: 'bg-blue-50/60', text: 'text-blue-900', border: 'border-blue-200' }, { id: 'c-block', label: 'C Block', color: '#BFDBFE', bg: 'bg-blue-50/40', text: 'text-blue-900', border: 'border-blue-200' }, - { id: 'h-block', label: 'H Block', color: '#C084FC', bg: 'bg-purple-50/80', text: 'text-purple-900', border: 'border-purple-200' }, { id: 'admin', label: 'Admin / Facility', color: '#FDBA74', bg: 'bg-orange-50/80', text: 'text-orange-950', border: 'border-orange-200' }, - { id: 'hostel', label: 'Hostel / Mess', color: '#F472B6', bg: 'bg-pink-50/80', text: 'text-pink-950', border: 'border-pink-200' }, + { id: 'hostel', label: 'Hostel / Mess', color: '#C084FC', bg: 'bg-purple-50/80', text: 'text-purple-950', border: 'border-purple-200' }, { id: 'lab', label: 'Lab / Academic', color: '#FDE047', bg: 'bg-yellow-50/80', text: 'text-yellow-950', border: 'border-yellow-200' }, { id: 'amenity', label: 'Amenity', color: '#BEF264', bg: 'bg-lime-50/80', text: 'text-lime-950', border: 'border-lime-200' }, { id: 'parking', label: 'Parking Area', color: '#94A3B8', bg: 'bg-slate-100/80', text: 'text-slate-900', border: 'border-slate-300' }, @@ -40,15 +39,15 @@ const LOCATION_SPOTS: LocationSpot[] = [ { name: 'Girls Mess', x: 14.5, y: 31.0, category: 'Hostel / Mess', desc: 'Dedicated Dining Hall for Women', area: 'West Wing' }, { name: 'MEC Lab', x: 14.0, y: 39.5, category: 'Lab / Academic', desc: 'Mechanical Engineering Laboratory', area: 'West Wing' }, { name: 'EPL Lab', x: 13.0, y: 47.5, category: 'Lab / Academic', desc: 'Engineering Practices Laboratory', area: 'West Wing' }, - { name: 'B Block (Nikola Tesla Block)', x: 40.5, y: 36.5, category: 'B Block', desc: 'Main Electrical & Engineering Research Block', area: 'Central Block' }, + { name: 'Nikola Tesla Block', x: 40.5, y: 36.5, category: 'B Block', desc: 'Main Electrical & Engineering Research Block', area: 'Central Block' }, { name: 'Astronaut Statue', x: 51.0, y: 23.0, category: 'Amenity', desc: 'Iconic Landmark Monument', area: 'Central Park' }, { name: 'Campus Centre', x: 67.0, y: 23.0, category: 'Admin / Facility', desc: 'Student Activity & Administrative Center', area: 'North East' }, { name: 'Hut', x: 70.0, y: 37.0, category: 'Amenity', desc: 'Student Discussion & Rest Area', area: 'Central East' }, - { name: 'H Block (Homi Jehangir Bhabha Block)', x: 87.0, y: 24.0, category: 'H Block', desc: 'Science & Physics Research Block', area: 'East Wing' }, - { name: 'Boys Mess', x: 87.0, y: 17.5, category: 'Hostel / Mess', desc: 'Ground Floor Dining Hall for Men (H Block)', area: 'East Wing' }, - { name: 'Staff Mess', x: 87.0, y: 30.5, category: 'Amenity', desc: 'First Floor Dining Hall for Faculty & Staff (H Block)', area: 'East Wing' }, + { name: 'Homi Jehangir Bhabha Block', x: 87.0, y: 24.0, category: 'A Block', desc: 'Science & Physics Research Block', area: 'East Wing' }, + { name: 'Boys Mess', x: 87.0, y: 17.5, category: 'Hostel / Mess', desc: 'Ground Floor Dining Hall for Men (Homi Bhabha Block)', area: 'East Wing' }, + { name: 'Staff Mess', x: 87.0, y: 30.5, category: 'Amenity', desc: 'First Floor Dining Hall for Faculty & Staff (Homi Bhabha Block)', area: 'East Wing' }, { name: 'C Block', x: 87.0, y: 38.0, category: 'C Block', desc: 'Labs, Classrooms & Staff Rooms', area: 'East Wing' }, - { name: 'A Block (Alan Turing Block)', x: 77.0, y: 53.0, category: 'A Block', desc: 'Computer Science & AI Labs', area: 'East Wing' }, + { name: 'Alan Turing Block', x: 77.0, y: 53.0, category: 'Lab / Academic', desc: 'Computer Science & AI Labs', area: 'East Wing' }, { name: 'Arcade', x: 35.0, y: 57.0, category: 'Amenity', desc: 'Student Hub & Stores', area: 'Central South' }, { name: 'Green Building', x: 23.0, y: 71.0, category: 'Admin / Facility', desc: 'Eco-Friendly Academic Complex & Library', area: 'South West' }, { name: 'Security Booth', x: 49.0, y: 77.0, category: 'Amenity', desc: 'Main Gate Security Checkpoint', area: 'South Entrance' }, @@ -60,9 +59,9 @@ const LOCATION_SPOTS: LocationSpot[] = [ ]; const CATEGORY_MAP_SPOTS: Record = { - dept: ['A Block (Alan Turing Block)', 'B Block (Nikola Tesla Block)', 'C Block', 'H Block (Homi Jehangir Bhabha Block)', 'Steve Jobs Block', 'Green Building'], + dept: ['Homi Jehangir Bhabha Block', 'Nikola Tesla Block', 'C Block', 'Steve Jobs Block', 'Alan Turing Block', 'Green Building'], library: ['Green Building'], - labs: ['MEC Lab', 'EPL Lab', 'A Block (Alan Turing Block)', 'B Block (Nikola Tesla Block)', 'C Block', 'H Block (Homi Jehangir Bhabha Block)', 'Steve Jobs Block'], + labs: ['MEC Lab', 'EPL Lab', 'Steve Jobs Block', 'Alan Turing Block', 'Nikola Tesla Block', 'C Block'], hostel: ['Girls Hostel', 'Boys Mess'], canteen: ['Canteen', 'Girls Mess', 'Boys Mess', 'Staff Mess', 'Arcade'], auditorium: ['Steve Jobs Block', 'Campus Centre'], @@ -120,7 +119,6 @@ export default function Campus() { if (activeLegend === 'a-block' && spot.category === 'A Block') highlightedSpotNames.add(spot.name); if (activeLegend === 'b-block' && spot.category === 'B Block') highlightedSpotNames.add(spot.name); if (activeLegend === 'c-block' && spot.category === 'C Block') highlightedSpotNames.add(spot.name); - if (activeLegend === 'h-block' && spot.category === 'H Block') highlightedSpotNames.add(spot.name); if (activeLegend === 'admin' && spot.category === 'Admin / Facility') highlightedSpotNames.add(spot.name); if (activeLegend === 'hostel' && spot.category === 'Hostel / Mess') highlightedSpotNames.add(spot.name); if (activeLegend === 'lab' && spot.category === 'Lab / Academic') highlightedSpotNames.add(spot.name); @@ -135,7 +133,6 @@ export default function Campus() { if (activeLegend === 'a-block') return fac.category === 'A Block'; if (activeLegend === 'b-block') return fac.category === 'B Block'; if (activeLegend === 'c-block') return fac.category === 'C Block'; - if (activeLegend === 'h-block') return fac.category === 'H Block'; if (activeLegend === 'admin') return fac.category === 'Admin / Facility'; if (activeLegend === 'hostel') return fac.category === 'Hostel / Mess'; if (activeLegend === 'lab') return fac.category === 'Lab / Academic';