Repository navigation
feat(render_map_tool): live traffic and Satellite/Traffic buttons on the map - #278
Merged
Merged
Conversation
…the map Adds Satellite and Traffic buttons under the zoom control, and a showTraffic input so the model can open the map with traffic on. Traffic is the Mapbox Traffic v1 tileset colored by congestion in the middle slot. The page keeps a copy of what it drew so a style switch puts it back, and the top-left controls move below the summary chip. Fixes #277 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The text buttons didn't fit GL JS's 29px control column, so they're now icon buttons (globe, traffic light) like zoom and compass. Light traffic on every side street turned the map green, so it shows only on main roads; each direction is offset to its side of the road, and lines are thinner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The legend sat on the logo and an open results panel on the attribution. Move the legend above the logo, stop the panel above the attribution, and fit data above the legend's new spot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic-toggles # Conflicts: # CHANGELOG.md # src/tools/render-map-tool/assembleMapPayload.ts
This was referenced Oct 16, 2026
render_map_tool: smaller map ideas (isochrone slider, 3D tilt, night lighting, traffic refresh)
#288
Open
mattpodwysocki
added a commit
that referenced
this pull request
Oct 20, 2026
The "6 results for ..." chip sat on top of the zoom-in button. Same placeTopLeftControls fix as #278, copied as-is so the two merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic-toggles # Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic-toggles # Conflicts: # CHANGELOG.md
zmofei
approved these changes
Nov 5, 2026
| 'To show live traffic congestion on the roads in view, pass ' + | ||
| '`showTraffic: true`. The map also has Satellite and Traffic buttons ' + | ||
| 'users can toggle themselves. ' + | ||
| 'Every call is a fresh render — it does not accumulate state — so to ' + |
Member
There was a problem hiding this comment.
Nit: can you add showTraffic to this sentence too? Otherwise the model might send just showTraffic: true and the route disappears. Also, "does not accumulate state" isn't quite true anymore, since traffic now stays on.
|
|
||
| function applyBaseMapConfig(baseMapConfig) { | ||
| if (!baseMapConfig || typeof baseMapConfig !== 'object') return; | ||
| currentBaseMapConfig = baseMapConfig; |
Member
There was a problem hiding this comment.
Nit: this never gets reset. After a render without baseMapConfig, the Satellite button can bring back an old config, like night mode. Maybe set it on every render, or clear it in teardown()?
mattpodwysocki
added a commit
that referenced
this pull request
Nov 5, 2026
* feat(render_map_tool): results carousel instead of the side list Place results now show as swipeable cards along the bottom of the map, like ChatGPT's place results. The selected card and its pin stay in sync: swiping or clicking a card highlights its pin (white, on top, with the name under it) and pans only when the pin is hidden; clicking a pin scrolls to its card. Pins with a card no longer open popups. Cards show today's hours parsed from simple OSM opening_hours. Closes #283 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: CHANGELOG PR number for the carousel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(render_map_tool): keep the selected pin's label clear of the cards Found in a headless render: a pin just above the carousel kept its name label hidden behind the cards. Pan when the label (not just the pin) would be hidden, do it for pin clicks too, and pan only as far as needed instead of recentering, so nearby pins stay in view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(render_map_tool): move the zoom buttons below the summary chip The "6 results for ..." chip sat on top of the zoom-in button. Same placeTopLeftControls fix as #278, copied as-is so the two merge cleanly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(render_map_tool): follow OpenAI's UI guidelines for the carousel - Every card has a picture: Assembly's marker icon on a muted tile until a photo loads, or when there is none, labeled for screen readers. - Pin numbers pick dark or white text by WCAG contrast; white on the default orange was 2.8:1. - The tool description asks the model not to repeat the places the cards already show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(render_map_tool): white place pins with Maki icons instead of orange numbers Matches ChatGPT's place results and OpenAI's UI guidance: search results and other places in the carousel are white pins with a Maki icon for their category, black when selected, and their cards drop the number badge. The icon comes from Search Box's maki name, else the category, else a plain marker; about 20 common Maki icons (CC0) are inlined. Numbered badges stay where the number means something: a caller's numbered label (visit order), optimized stops, start/end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(render_map_tool): light and dark mode for the map's cards and chips The cards, summary chip, legend and messages follow the host's theme (MCP Apps hostContext.theme, at initialize and on host-context-changed), falling back to prefers-color-scheme. Colors use the host's style variables (--color-background-primary etc.) when sent, with light/dark fallbacks otherwise. The map and its pins are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: carousel cards and pin labels per design feedback (PDES-471) - Capitalize the category on cards. - Show the Places price level ($ to $$$$) instead of "% popularity"; Places has no star rating. - Hours say "Open until 8:30 PM" / "Closed · opens 7:30 AM" when Places gives the place's time zone, otherwise "Open 7:30–15:00" for today. - Drop the phone number from the card until there's a place detail card. - Label every carousel pin with a white halo instead of a box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: drop duplicate sandbox keys left by the main merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mattpodwysocki
added a commit
that referenced
this pull request
Nov 5, 2026
* fix: review follow-ups for #278, #309 and #311 - render_map_tool: clear the base map config on teardown so the Satellite button can't bring back an earlier render's config; the description says traffic and satellite carry over and to re-pass showTraffic with the content. - resource_reader_tool: return an image blob once (as an image under 700 KB, else a short note) instead of base64 text plus a structured copy; point mapbox://selffetch/ refs to render_map_tool. - Eval: list token_embedded in both hillclimb metrics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: review follow-ups for #312 - Say when the 1x fallback replaced a too-large @2x image. - Test that the large-image ref's decoded data= has no access token. - docs/mcp-ui.md describes the static map viewer and public-token link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #277. Asked to show traffic downtown, ChatGPT told a user "the Mapbox map available here doesn't support a live street-traffic overlay". That was true: the map only draws GeoJSON,
baseMapConfighas no traffic option, and traffic only showed up in route summaries. Users also couldn't switch to satellite without asking the model.Buttons on the map
Two icon buttons sit under the zoom control, the same size as zoom and compass: a filled globe for satellite view and a filled car for live traffic (per the design feedback), with tooltips and
aria-labels.Traffic layer
mapbox://mapbox.mapbox-traffic-v1, source layertraffic), as lines colored bycongestion: light, moderate, heavy, severe.middleslot, so road labels and our own routes/isochrones stay on top.#00c94e,#ff9900,#ff2b3a,#8b0a18).api.mapbox.com, which the CSP already allows, so the CSP is unchanged.showTrafficinputrender_map_toolfield, plus a line in the description, so the model knows traffic is possible and can open the map with it on.falseturns it off.baseStyledoes.showTraffic-only call is renderable, likebaseStyle.Style switches keep what's drawn
setStyle()drops every source and layer the page added. The page now keeps a copy of each GeoJSON layer it draws, and after a switch from the Satellite button it re-adds:It does this without moving the camera. When the model switches
baseStyle, traffic stays on.Summary chip
The chip sat on top of the zoom buttons, since both use the top-left corner. While it shows, the corner's controls now move below it.
Worth a close look
setStyle: the restore guards ongetSource/getLayer, so it's safe whether or not GL JS kept a layer across the switch.Testing
aria-pressed.baseStyleupdates the button.showTraffic:trueturns it on, left out keeps it on,falseturns it off.baseStyleswitch.showTraffic-only call works and round-trips through the inline ref.setStyleclears them) and mounts controls throughonAdd. The 65 existing script tests pass unchanged.trafficsource layer.npm test: 1060 pass.npm run lint: 0 errors.npm run buildOK.new Function).congestion,classandstructure, which the filter relies on.showTraffic: truefor "show traffic in downtown San Francisco", and both buttons work. Not tried in ChatGPT yet.Plain:

Traffic:

Satellite Traffic:

Checklist
CHANGELOG.mdupdated underUnreleased🤖 Generated with Claude Code