- Added error handling for Bootstrap JavaScript loading
- Created fallback mechanisms when Bootstrap is not available
- Added Bootstrap initialization checks
- Extracted inline CSS to separate file (
Navigation.css) - Removed large CSS block from JSX component
- Improved component re-render performance
- Added try-catch blocks for localStorage access
- Added error handling for Bootstrap API calls
- Added fallback for mobile menu toggle
- Fixed dynamic route path mapping issue
- Corrected
/places/:placeNameroute lookup - Added error handling for route prefetching
- Replaced direct DOM manipulation with React refs
- Moved prefetching to useEffect with cleanup
- Removed unnecessary React.memo usage
- Added useMemo for route visibility calculations
- Sanitized logging to prevent log injection
- Improved TypeScript type safety
- Extracted Logo component for better maintainability
- Optimized Bootstrap initialization to run only once
client/src/components/Navigation.tsx- Main navbar componentclient/src/components/Navigation.css- Extracted CSS stylesclient/src/components/Logo.tsx- Extracted logo componentclient/src/utils/routeConfig.ts- Fixed route configurationclient/src/App.tsx- Improved prefetching logic with useMemoclient/src/utils/bootstrapInit.ts- Bootstrap initialization utility
After these fixes, the navbar should:
- Render properly for all users who clone the repo
- Work without Bootstrap JavaScript in fallback mode
- Have better performance with external CSS
- Handle errors gracefully
- Work on all devices and screen sizes
Ensure these are installed:
npm install bootstrap@^5.3.3 lucide-react@^0.536.0The navbar will now work even if Bootstrap JavaScript fails to load, with graceful degradation.