A professional, modular web application for locating Girls in Gear programs across the United States. Built with modern JavaScript ES6 modules, Mapbox GL JS, and responsive design.
The project has been refactored from a single index.html
file into a well-organized, modular structure:
βββ index.html # Main HTML structure
βββ styles/
β βββ main.css # Core styles and components
β βββ responsive.css # Mobile and responsive styles
βββ js/
β βββ config.js # Configuration and constants
β βββ data-service.js # Google Sheets data fetching
β βββ geocoding-service.js # Mapbox geocoding services
β βββ ui-components.js # UI manipulation and components
β βββ map-controller.js # Map initialization and control
β βββ search-controller.js # Search functionality
β βββ main.js # Application initialization
βββ README.md # Project documentation
- π Interactive Map: Mapbox GL JS with custom styling
- π Smart Search: Location-based search with autocomplete
- π± Responsive Design: Works on desktop, tablet, and mobile
- ποΈ Data Integration: Real-time Google Sheets integration
- β‘ Fast Performance: Optimized loading and caching
- π οΈ Developer Tools: Built-in debugging and utilities
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Web server (for local development)
- Clone or download the project
- Serve the files using a local web server:
# Using Python 3
python -m http.server 8000
# Using Node.js (http-server)
npx http-server
# Using PHP
php -S localhost:8000
- Open your browser and navigate to
http://localhost:8000
Central configuration file containing:
- Mapbox access tokens and styles
- Google Sheets URLs and CORS proxies
- Default map settings
Handles data operations:
- Fetches data from Google Sheets
- Processes and normalizes CSV data
- Manages fallback mechanisms
- Provides search functionality
Location services powered by Mapbox:
- Address to coordinates conversion
- Location search suggestions
- Reverse geocoding
- Rate limiting and error handling
User interface management:
- DOM manipulation utilities
- Dynamic content generation
- Event handling
- Error and success notifications
Map functionality:
- Mapbox GL JS initialization
- Marker management
- Map navigation and controls
- Bounds calculation and fitting
Search functionality:
- Real-time search suggestions
- Keyboard navigation
- Location-based filtering
- Search marker management
Application coordinator:
- Module initialization
- Error handling
- Debug utilities
- Global state management
The application includes built-in debugging tools accessible via browser console:
// Get application status
debug.status();
// View detailed application info
debug.info();
// Reload data from Google Sheets
debug.reload();
// Export current data
debug.export();
// Reset application
debug.reset();
// Test geocoding
debug.testGeocode('New York, NY');
// Test search
debug.testSearch('California');
// Show all available commands
debug.help();
Update the Mapbox access token in js/config.js
:
MAPBOX_ACCESS_TOKEN: 'your_mapbox_token_here';
Configure your Google Sheets URL in js/config.js
:
GOOGLE_SHEET_URL: 'your_google_sheets_csv_url_here';
Customize the appearance by modifying:
styles/main.css
- Core stylesstyles/responsive.css
- Mobile styles
The application is fully responsive with breakpoints for:
- Desktop: 1024px and above
- Tablet: 768px - 1023px
- Mobile: Below 768px
- Small Mobile: Below 480px
- Maintainability: Each module has a single responsibility
- Debuggability: Easy to isolate and fix issues
- Collaboration: Multiple developers can work on different modules
- Testing: Modules can be tested independently
- Caching: Individual files can be cached separately
- Loading: Potential for lazy loading modules
- Minification: Each file can be optimized individually
- Self-contained: All dependencies are clearly defined
- Portable: Easy to embed in other applications
- Configurable: Settings can be easily modified
- Reliable: Better error handling and fallback mechanisms
For debugging and development, the following objects are available in the browser console:
GigMapApp
- Main application controllerDataService
- Data operationsMapController
- Map managementSearchController
- Search functionalityUIComponents
- UI utilitiesGeocodingService
- Location servicesglobalGigData
- Current program dataGIG_CONFIG
- Application configurationdebug
- Debug utilities
- Initialization: Application loads and initializes modules
- Map Setup: Mapbox map is created and configured
- Data Fetching: Google Sheets data is retrieved and processed
- Geocoding: Addresses are converted to coordinates
- Rendering: Markers are placed on map and UI is updated
- Interaction: User can search, filter, and navigate
The application includes comprehensive error handling:
- Network connectivity issues
- API rate limiting
- Invalid data formats
- Geocoding failures
- Map rendering errors
- Debounced Search: Prevents excessive API calls
- Rate Limiting: Respects Mapbox API limits
- Lazy Loading: UI components load as needed
- Memory Management: Proper cleanup of markers and events
- Caching: Geocoded results are cached
- Input Sanitization: All user inputs are properly escaped
- CORS Handling: Multiple fallback proxies for data fetching
- API Key Management: Secure token handling
- XSS Prevention: HTML content is properly escaped
Developed for Girls in Gear | Built with modern web technologies for maximum compatibility and performance.