Skip to content

feat: optional website, phone and hours for places - #364

Merged
yakew7 merged 4 commits into
mainfrom
feat/place-contact-fields
Nov 24, 2026
Merged

yakew7 merged 4 commits into
mainfrom
feat/place-contact-fields

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Member

What this changes

#356: three optional place fields, end to end. One commit per step.

  1. Schema, validator, type, docs. website (an https:// URL), phone (E.164, like +442074127000) and hours (short single-line text, at most 120 characters) are optional in places.schema.json, checked for format in validate-places.mjs, and added to the Place type. No existing record needs them. /api/places has no field whitelist, so it returns them unchanged (a test pins that). data/CONTRIBUTING.md documents them and adds the verification rule: phone and hours must come from the place's own site or listing, with the page and date checked in the PR.
  2. Popup and drawer. A small PlaceContact shows whichever of the three exist. Empty ones are hidden and a place with none renders exactly as before. The website links only when it is a well-formed https URL; the phone becomes a tel: link only in international form.
  3. Suggest-a-place form. Three optional inputs. The form, /api/submit-place, the issue body and the PR record all carry them; a blank field is left out and a malformed one gets a message. A typed phone is normalised to E.164, including the trunk (0) in +44 (0)20 .... The generated PR's review comment tells the maintainer the details came from the submitter and should be checked against the place's own site.
  4. Seed data, see below.

One thing worth a look: the form's hidden anti-spam field is named website, and the route silently drops any request where it is filled. A real website sent under the same key would have been thrown away, so the real value travels as placeWebsite. A route test covers both: a filled honeypot is still dropped, and a real placeWebsite is filed.

Type of change

  • Code or fix
  • Docs

Seed data: 6 of the 10 the issue asks for

I read each value on the library's own page today (2026-11-24) and left a field out where that page did not state it:

Place Fields Read from
The British Library (ldn-library-01) website, hours bl.uk/visit ("Library building opening hours"; no phone on that page)
Library of Congress (wdc-library-01) website, phone, hours loc.gov/visit (Visitor Engagement Office number; visitor hours)
State Library of New South Wales (syd-library-01) website, phone, hours sl.nsw.gov.au/visit-us/opening-hours (reading rooms)
State Library Victoria (mel-library-01) website, phone, hours slv.vic.gov.au/visit
National Library of Ireland (dub-library-02) website, phone nli.ie/contact (hours not on that page)
National Library of Australia (cbr-library-01) website, phone library.gov.au/visit (hours not found)

The other four I tried (NYPL, Toronto, Boston, State Library of Queensland) are script-rendered or returned errors to a plain fetch, and I would not write hours from memory under a rule that says they must come from the place's own page. So the issue's "fill 10" is not fully met; the UI is exercised by the six above. The last commit says Closes #356; please leave the issue open if you want the other four.

Testing

  • npm run typecheck, npm run lint, npm run test:unit (816 tests), prettier --check ., npm run validate and npm run check:freshness pass.
  • New tests: the phone and hours checks and a test that the schema's patterns agree with the validator; submission normalising, rejecting, the issue-body round trip and the record; the route (real website filed, malformed phone rejected, honeypot still dropped); the form (fields, payload keys, inline errors, GitHub fallback body); PlaceContact and the popup (each field, hidden when empty, unsafe URL not linked, unchanged render without them).
  • The seed diff is 15 added lines in library.json and nothing else.

Not covered

  • Checked by tests, not by eye in a browser (no MapTiler key on my machine). The popup, the drawer (it has no test of its own today) and the new form fields are worth a look on the preview.
  • Hours are free text, as the issue says for v1; nothing parses them.
  • No changelog line, to avoid conflicts with the other open PRs.

Closes #356

Three optional fields so a library or government office can say how to
reach it and when it is open. The schema, the validator (format only: an
https URL, E.164 phone, short single-line hours) and the Place type agree,
no existing record needs them, and /api/places returns them unchanged.
data/CONTRIBUTING.md documents them and adds the rule that phone and hours
must come from the place's own site or listing, with the date checked in
the PR.
…rawer

Empty fields are hidden and a place with none renders exactly as before.
The website links only when it is a well-formed https URL, and the phone
becomes a tel: link only when it is in international form.
…e form

The form, the server route, the issue body and the pull-request record all
carry the three optional fields. A blank field is left out; a malformed one
is rejected with a message. A typed phone is normalised to E.164, including
the '(0)' trunk digit in '+44 (0)20 ...'.

The real website travels as placeWebsite because 'website' on the request
is the hidden honeypot, which the route drops when filled. The review
comment on the generated PR asks the maintainer to confirm contact details
against the place's own site.
Read from each library's own site on 2026-11-24: the British Library,
Library of Congress, State Library of New South Wales, State Library
Victoria, National Library of Ireland and National Library of Australia.
A field is left out where the library's own page did not state it.

Closes #356
@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:33am UTC

@yakew7
yakew7 merged commit 745e45a into main Nov 24, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 65886a39 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.

Add optional website, phone and opening hours to the place schema

2 participants