/* Public landing page: in-page jumps, and the social-proof strip. The numbers only render once they carry weight. Thin numbers are worse than none, so every block has a threshold and the section stays hidden below it. The static trust row is always there. */ document.addEventListener( 'DOMContentLoaded', function(){ qsa( 'a[href^="#"]' ).forEach( function( link ){ link.addEventListener( 'click', function( event ){ const target = qs( link.getAttribute( 'href' ) ); if ( !target ) return; event.preventDefault(); target.scrollIntoView( { behavior: 'smooth', block: 'start' } ); } ); } ); loadProof(); } ); function loadProof(){ api( '/stats', 'GET', null, { silent: true, noBounce: true } ) .then( function( stats ){ const tiles = []; if ( ( stats.travellers || 0 ) >= 25 ){ tiles.push( { value: stats.travellers, label: 'verified travellers' } ); } if ( ( stats.trips_upcoming || 0 ) >= 10 ){ tiles.push( { value: stats.trips_upcoming, label: 'upcoming trips' } ); } if ( ( stats.cities_30d || 0 ) >= 5 ){ tiles.push( { value: stats.cities_30d, label: 'cities the next 30 days' } ); } if ( ( stats.connections || 0 ) >= 10 ){ tiles.push( { value: stats.connections, label: 'connections made' } ); } const strip = qs( '#stat-strip' ); if ( tiles.length >= 2 ){ strip.innerHTML = tiles.map( function( tile ){ return '
' + Number( tile.value ).toLocaleString() + '' + '' + escapeHtml( tile.label ) + '
'; } ).join( '' ); qs( '#live-proof' ).hidden = false; } // The ticker: cities with three or more travellers soon const cities = stats.cities || []; if ( cities.length >= 2 ){ qs( '#city-ticker' ).innerHTML = 'Right now: ' + cities.map( function( entry ){ return '' + escapeHtml( entry.city ) + ' ' + entry.count; } ).join( ' | ' ); qs( '#city-ticker' ).hidden = false; qs( '#live-proof' ).hidden = false; } } ) .catch( function(){ /* the landing page never depends on the API */ } ); }