Skip to content

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

Merged
AnayDhawan merged 5 commits into
mainfrom
feat/saved-places
Nov 26, 2026
Merged

AnayDhawan merged 5 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

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 26, 2026 9:07am UTC

@shauryagangrade

Copy link
Copy Markdown
Member

Hello @propcgamer20-png

Thanks for opening up a PR. We value and appreciate your contribution to StudentSuite.

We will be reviewing your PR shortly. While we do that, could you please take out the time to star this repo and follow our organisation? This helps us push your tool to more students and helps us get more amazing contributors just like you.

Thanks again!

@AnayDhawan
AnayDhawan merged commit 7de023d into main Nov 26, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 17b4a135 Deployed Nov 26, 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

3 participants