Project Overview
Root Files
index.html
The main HTML file contains the complete page structure:- Header: Logo, language switcher, stats, hamburger menu
- Main layout: Globe section + side panel
- Side panel: Gallery and submission form
- Overlays: Popup, lightbox, success modal, dropdown menu
- Bootstrap 5.3.3 (CSS & JS)
- Globe.gl 2.27.2
- TopJSON Client 3
- Supabase JS SDK 2
app.js
The application entry point (index.html:274) orchestrates initialization:
app.js
loadMates(): Fetches mate submissions from SupabaseapplyI18n(): Updates UI text based on selected languageinitGPS(): Requests user locationsetInterval(loadMates, 30_000): Auto-refresh data
config/ Directory
constants.js
Central configuration file:config/constants.js
Supabase credentials are safe to commit because Row Level Security (RLS) is enabled on all tables.
data/ Directory
capital-coords.js
Coordinate data for capital cities, used as fallback when GPS coordinates aren’t available:countries.js
Country names in Spanish, English, and Portuguese for the form dropdown:i18n.js
All UI text translations for the three supported languages:iso-tables.js
Mappings between ISO country codes (ISO 3166-1) formats:numericToIso3: Numeric → Alpha-3 (e.g., “032” → “ARG”)nameToIso3: Country name → Alpha-3
modules/ Directory
form.js
Handles the mate submission form:- Field validation
- Photo upload and preview
- Preparation type toggle (amargo, dulce, tereré, cocido)
- Country autocomplete
- Supabase submission with image upload to storage
- Form validation and submission
- File drag & drop handling
- Success modal trigger
gallery.js
Displays recent mate submissions in the side panel:- Renders gallery cards
- Handles lightbox opening
- Shows skeleton loaders while data loads
app.js:48 (renderGallery())
globe.js
Manages the 3D globe visualization using Globe.gl:- Renders country polygons with colors
- Displays markers for mate locations
- Draws arcs from capitals to mate locations
- Handles popup on marker hover
- Camera controls and interactions
- Dark theme optimized for mate aesthetics
- Automatic camera rotation
- Interactive markers with tooltips
gps.js
Handles geolocation functionality:- Requests browser location permission
- Updates GPS status indicator
- Reverse geocodes coordinates to country
- Populates hidden form fields (lat, lng, country_code)
- “Solicitando GPS…” (Requesting)
- “GPS detectado” (Success)
- “GPS no disponible” (Failed/denied)
menu.js
Controls the hamburger dropdown menu:- Tab switching (About, Support, Moderation, Press)
- Footer navigation (FAQs, Terms, Privacy, Contact)
- Backdrop click handling
- Animation states
modal.js
Manages overlay components:- Success modal after form submission (with animated mate emoji)
- Lightbox for viewing full-size mate photos
- ID display and copy-to-clipboard functionality
state.js
Global state variables:modules/state.js
utils.js
Helper functions used across modules:t(key): Translation lookupresolveCoords(mate): Get coordinates from GPS or capital fallback- Coordinate resolution logic
styles/ Directory
style.css
All application styles in a single file (805 lines). See Styling Guide for detailed breakdown. Main sections:- CSS custom properties (design tokens)
- Layout (header, main, side panel)
- Components (cards, forms, buttons)
- Globe customization
- Modals and overlays
- Responsive breakpoints
Script Load Order
Scripts are loaded in dependency order (index.html:260-274):
Finding Specific Features
Language Switching
Location:
app.js:5-15, data/i18n.jsLanguage buttons trigger applyI18n() which updates all data-i18n attributesForm Submission
Location:
modules/form.jsHandles validation, image upload to Supabase Storage, and database insertionGlobe Visualization
Location:
modules/globe.jsSets up Globe.gl, renders polygons, markers, and arcsGPS Detection
Location:
modules/gps.jsUses Navigator Geolocation API and reverse geocodingNext: Styling Guide
Explore the CSS architecture and design system used in 200 Mates.