• Aryan Noshirvnai's avatar
    Add Soundmarks: location-tied anthems with role-gated admin panels · 4b0e72d7
    Aryan Noshirvnai authored
    Frontend for the new backend feature - a Soundmark is a curated
    "anthem" tied to a real place, either a super-admin-curated landmark
    or a business's location. Three new surfaces:
    
    - Nearby (Soundmarks nav item): uses the browser Geolocation API
      (getCurrentPosition + watchPosition, so it keeps tracking as you
      move) to find and play the anthem at your current spot, through the
      same shared player used everywhere else in the app.
    - Business panel (/business, business_admin+): soundmarks you own,
      each with a "Change anthem" picker spanning your personal library
      and a new cross-user "public library" search.
    - Admin panel (/admin, super_admin only): full CRUD for every
      soundmark regardless of owner, plus user role management
      (promote/demote business_admin).
    
    AuthContext now fetches the caller's role via /auth/me and exposes
    isBusinessAdmin/isSuperAdmin; a super admin passes both. RequireRole
    gates the two new routes and Layout conditionally shows Business/
    Admin links in the header. PlayerContext gained an optional
    `streamUrl` override on PlayableSong so a soundmark's anthem can
    stream via its own cross-user-safe endpoint instead of the
    personal-library one, without touching the player's core logic.
    
    Caught and fixed a real accessibility bug via testing: the header's
    Business/Admin/Log out controls had their icon aria-hidden and their
    label CSS-hidden on mobile, leaving them with no accessible name at
    all - fixed with explicit aria-labels.
    
    Verified with a real end-to-end Playwright run (not just unit tests):
    logged in as super admin, created a soundmark through the actual UI,
    assigned an anthem, then used Chromium's real geolocation mocking to
    walk into it from the Nearby page and play it through the shared
    player - zero console errors throughout. 82 total tests passing
    (11 new: RequireRole, Nearby, BusinessPanel, AdminPanel, plus
    AuthContext role coverage).
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
    4b0e72d7
App.tsx 1.55 KB