Skip to content

feat(map): save public places with a star, with a shareable shortlist - #366

Open
propcgamer20-png wants to merge 10 commits into
mainfrom
feat/saved-places
Open

propcgamer20-png wants to merge 10 commits into
mainfrom
feat/saved-places

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Member

Stacked on four other open PRs. This feature touches the same map files as #360, #362, #363 and #365 (the page re-indents because it is now wrapped in a provider, and map-panel.tsx takes new props). Rather than leave a maintainer to resolve those conflicts, I merged those four branches into this one and resolved them here. So until they merge, this diff also shows their changes. The only commit specific to this PR is feat(map): save public places with a star, with a shareable shortlist; the rest are merge commits. Merge the others first and this shrinks to that one commit with nothing to resolve. #361 and #364 also merge cleanly with it (checked). Review places-map.tsx with git diff -w: the wrap re-indents about 130 lines.

What this changes

#355: save public places with a star, with no account needed.

  • Star on the pin popup, the detail drawer and every results row (44px target on a phone). It is a toggle button: aria-pressed, and its name says which place it acts on ("Save City Library" / "Remove City Library from saved"). Where there is no saved list (the embed, previews) the star simply does not render.
  • Local first. The list lives in localStorage (every read and write in try/catch, a corrupt value reads as empty), so it works signed out, offline and on a self-hosted copy with no Supabase.
  • Account sync. Signed in, it is also kept in a new saved_places table, mirroring competition_saves: one row per user and place, private through row-level security. The migration supabase/migrations/20261124_create_saved_places.sql has to be run once by hand, like the others; until it is, saving still works and only the sync is idle (a failed sync shows a toast and keeps the star).
  • Signing in merges. The browser's list and the account's are unioned: nothing lost, nothing duplicated, and each side is topped up with what it was missing.
  • "Saved" chip with a count narrows the list to the visitor's places. "Share list" copies a ?saved=a,b link.
  • Shared link. Opening one shows that shortlist read only, with a banner offering "Save all to my list" or "Show all places". The visitor's own list is not touched unless they choose to save. Ids that no longer exist in the dataset are dropped silently, and a link whose places are all gone is ignored.
  • Docs: the privacy page lists the new table, and SELF-HOSTING.md and ARCHITECTURE.md mention it.

Type of change

  • Code or fix
  • Docs

Testing

  • npm run typecheck, npm run lint, npm run test:unit (920 tests on this branch) and prettier --check . pass. I also built the combination of every branch I have open (this one plus chore: remove three unused components left over from the #313 pass #361 and feat: optional website, phone and hours for places #364) as a throwaway and ran the same checks: 972 tests, all passing.
  • saved-places.test.ts (31): id cleaning, corrupt and blocked storage, the ?saved= parser, merge (no loss, no duplicates, stable), pruning, and the account calls against a fake client.
  • use-saved-places.test.tsx (13): survives a reload, follows another tab, merge on sign-in sends up only what the account lacked, the account unreadable keeps the local list, a failed write keeps the star and shows a toast.
  • save-star, share and pin-popup tests, and places-map.test.tsx (the full flows through the real page): star, reload, the Saved filter and its empty message, Share list, and a shared link (read only, missing ids dropped, address-bar kept, "Save all" merges without duplicates, "Show all places" saves nothing).

Not covered

  • The migration is not applied anywhere, and I did not exercise the real Supabase path: the sync is tested against a fake client. Worth one real sign-in test after the migration runs.
  • Checked by tests, not by eye in a browser (no MapTiler key on my machine). The stars in the popup and drawer, the banner and the Saved chip are worth a look on the preview.
  • The drawer has no test of its own today, so its star is covered only through the shared SaveStar tests.
  • No changelog line, to avoid conflicts with the other open PRs.

Closes #355

…view

A search that leaves one place fitted a zero-size box and zoomed to level
19, where the basemap is blank. The fit is now capped (16 for one place,
15 for several) and the go-to-place zoom shares one constant.

The map used to open on the whole world with grey bands above and below
the tiles. It now keeps the basemap covering the viewport with a minimum
zoom, reopens where the visitor last left it (localStorage, guarded), and
opens on a signed-in visitor's saved home when nothing else chose a view.
An explicit lat/lng/zoom, place, search or filter in the URL still wins,
and nothing asks for geolocation on load.

Closes #350
Closes #353
Rows showed only the type, so two places sharing a name prefix could not
be told apart. The second line is now 'type · city, country' (distance
last when known), the name may take two lines before truncating, and the
three row actions are 44px touch targets below the lg sidebar breakpoint.
Their aria-labels are unchanged.

Closes #354
…ilter row

Chips and presets both set the same types filter under different labels.
The chip row stays (it carries counts and the pin colours), the one combo
chips cannot express, SAT plus foreign-language exam centres, becomes a
leading 'All exam centres' chip, and the single-type presets go. The row
gains an 'N categories selected' line with Clear, and the scrolling row
fades its right edge instead of clipping a chip. Labels come from
PLACE_TYPE_LABELS only.

Closes #352
…h this area prompt

The results list was driven by filters only, so panning to Lagos still
listed Heathrow first. An 'Only places in this view' switch (on by default
from zoom 8) limits the list to the area the map showed, and the header now
reads 'N places in this view' or 'N places total'.

The list is pinned to one area: moving the map shows a 'Search this area'
button instead of re-sorting rows under the visitor's cursor mid-scroll.
Nearest-first still applies when a location is set. The map now reports its
visible bounds; they are kept out of the URL and storage. Works in the
desktop panel and the mobile sheet, which share one MapPanel.

Closes #351
/country/<code> is generated from the dataset next to the city pages: a
count per category (each linking to the map filtered to that country), the
country's cities linking to their existing city pages, and a short 'start
here' list that puts verified places first. It carries a schema.org Country
with an ItemList of its cities, a generated Open Graph image in the same
style as the city cards, and a meta description built from real counts.

The only URL is the lowercase code, so /country/IN is a 404 and there is one
canonical page per country. Counts are checked against the same tally that
/stats uses.

Part of #358
Country pages join the sitemap (lastmod from the newest verified place, like
the city entries), each city page gets a country breadcrumb, and the map
shows 'View <country> page' next to the country filter once a country is
chosen.

Closes #358
A star on the pin popup, the detail drawer and every results row saves a
public place. The list is kept in the browser first (localStorage, every
access guarded), so it works signed out, offline and on a self-hosted copy
with no Supabase. Signed in, it is also kept in a new saved_places table
(private per user through row-level security, migration included), and
signing in merges the browser's list with the account's with nothing lost
and nothing duplicated.

A 'Saved' chip with a count narrows the list to the visitor's places, and
'Share list' copies a ?saved=a,b link. Opening such a link shows that
shortlist read only, with a banner offering 'Save all to my list' or 'Show
all places'; ids that no longer exist in the dataset are dropped silently.
The table is listed on the privacy page and in SELF-HOSTING.md.

Closes #355
Keeps the saved-places provider around the page and re-applies the
openOnHome prop on the map; both test blocks are kept.
Keeps both the Star import and the Link import in map-panel.
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
study-map Ready Ready Preview Nov 24, 2026 9:54am UTC

This branch was successfully deployed

1 active deployment
Preview — ccf86c65 Deployed Nov 24, 2026 by vercel[bot]
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.

Bookmark public places without signing in

1 participant