Skip to content

Redesign the Live Study Map - #111

Merged
kewonit merged 3 commits into
mainfrom
feat/live-study-map
Nov 29, 2026
Merged

kewonit merged 3 commits into
mainfrom
feat/live-study-map

Conversation

@kewonit

@kewonit kewonit commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

What changes

The map itself does more, with no extra panels.

  • Avatar groups: avatars closer than about 38 px merge into a stack with a +N chip. Clicking (or Enter/Space) zooms in. Students who share an approximate location are listed in a card instead of zooming to street level.
  • Study dock: Exam (grouped by category), Session, Subject, and "N days left" in one bar, then Start studying. While studying, it shows your avatar, subject, a live timer (also in the tab title) and End. A "You" marker sits on the map, and a reload returns to a session the server still shows. On a wide page the dock floats over the bottom of the map; on narrow screens and in the exam-page embed it sits below the map.
  • State borders and names: the borders between states come from DataMeet's States/Admin2. That is the same pinned revision as the outline, with Survey of India's 2021 Ladakh and J&K boundaries, and is credited on the map under CC BY 2.5 IN. Only the lines two states share are drawn, so the coast and the national boundary stay those of the existing outline. Large states are named at the country view on big maps, and smaller ones once zoomed in. A name that would touch a city label is hidden at that zoom. The file is 179 KB (61 KB gzipped), rebuilt by scripts/build-india-states.mjs, and documented in public/exam-countdown/maps/README.md.
  • Map: India is centred in the area the dock leaves visible. City and study-hub labels appear once zoomed in. One vertical control group. Wheel zoom works in fullscreen. The student whose card is open stays raised.
  • Page: the lede box and three emoji feature cards are gone; a single line remains: "Only your approximate city is shown." plus "About this map".

Patterns were borrowed from Mobbin, not cloned: Shopify Live View, Mindtrip, Tiimo.

What stays the same

  • Same Supabase RPC contract (get_active_study_sessions, upsert_study_session, heartbeat_session, end_study_session), realtime channel and 30 s poll. No backend changes.
  • Same approximate-city jitter. Original coordinates are never stored. Local GeoJSON only, with no tile requests.
  • Illustrative sessions stay disclosed in "About this map". Groups show avatars, not a count claim.
  • SEO, local build against production with a Googlebot user agent, all 101 sitemap URLs:
    • 100 are identical in title, description, canonical, robots meta, H1, JSON-LD and visible server text.
    • /exam-countdown/study-map differs only in body text (the removed lede and cards). Its title, description, canonical, H1 and JSON-LD are unchanged.
    • Exam pages render the same server HTML; the map is client-only, as before.

Code

  • lib/timekeeper/use-study-sessions.ts: connection, realtime, polling and heartbeat, moved out of the component unchanged.
  • lib/timekeeper/study-map-engine.ts: Leaflet layers, persistent markers, clustering, focus and dock-aware fitting.
  • components/timekeeper/StudyMapDock.tsx: new component.
  • public/exam-countdown/maps/india-states.geojson, scripts/build-india-states.mjs: state borders and label points, plus the script that builds them. The file is added to the map cache-header rule and to verify-timekeeper.mjs.
  • components/timekeeper/StudyMap.tsx: wires the pieces together.
  • public/ejam/*.css: drops my-6 and sm:grid-cols-3, which only the removed cards used.

Testing

  • npx playwright test e2e/timekeeper.spec.ts against next build && next start: 75 of 75 pass across the 320, 390, 768, 1024 and 1440 projects.
    • This includes the three study-map tests that fail on main.
    • New coverage: state borders and their attribution, avatar groups, start/restore/end, the "You" marker, no injection, no horizontal overflow, and axe on the study-map page and the exam embed in all five themes.
  • tsc --noEmit and ESLint are clean.
  • Checked by hand in Chrome on desktop and phone widths and in several themes.

Merging

Not merged. This is a single change for its own deploy, ready to annotate in Search Console under the one-change-per-deploy plan.

…dy timer

- The study-map page lays a "Studying now" list with exam filters and a
  study dock over a taller map; narrow screens and the exam-page embed
  stack them below the map. India is fitted into the area left visible.
- List rows and markers highlight each other; a row flies to its student
  and opens their card. Nearby avatars merge into stacks that zoom in, or
  list everyone sharing an approximate location.
- Starting a session shows a "You" marker and a live timer, also in the
  tab title, and a reload returns to a session the server still shows.
- City labels appear once zoomed in; controls are one vertical group.
- The page drops its lede and feature cards. Title, description,
  canonical, H1 and JSON-LD are unchanged, and exam pages render the same
  server HTML.
- Same Supabase RPC contract, approximate-location jitter and no tiles.
- Fix the three study-map e2e tests that failed on main and cover the
  list, filters, groups, restore and accessibility of the full page.
The list, exam chips and phone card strip are gone. On a wide page the
dock floats over the bottom of the map and India is centred above it;
the status pill sits on the map. The marker whose card is open stays
raised.
State borders are the lines two states share in DataMeet's States/Admin2
(pinned revision, Survey of India's 2021 Ladakh and J&K boundaries,
CC BY 2.5 IN, credited on the map), so the coast and national boundary
stay those of the country outline. Large states are named at the country
view on big maps, smaller ones once zoomed in; a name that would touch a
city label is hidden at that zoom. scripts/build-india-states.mjs
rebuilds the 179 KB file from the shapefile without dependencies.
@kewonit
kewonit merged commit c7db6e6 into main Nov 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant