Unify MAP_POPUP_MAX_WIDTH_PX via codegen from defaults.py#266
Merged
Conversation
…lts.py Extend generate_basemap_assets.py to emit TS, CSS, and export JS constants from MAP_POPUP_MAX_WIDTH_PX; HTML export concatenates the generated snippet; CI --check covers all generated map assets. Refs: #265 Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
MAP_POPUP_MAX_WIDTH_PXwas hardcoded in three stacks (Python defaults, React popup sizing, HTML export viewer JS) with manual sync comments. This change generates TS, CSS, and export JS from the single Python constant indefaults.py.Changes
scripts/generate_basemap_assets.pynow also emits:map_popup_constants.generated.ts(React import)map_popup_constants.generated.css(--pebird-map-popup-max-width)leaflet_map_export_constants.generated.js(export viewer)AllLocationsMapPopupSizing.tsimports generated TS; CSS imports generated variable fileleaflet_map_html_export.pyconcatenates generated JS constants withleaflet_map_export.js--checkvalidates all four generated outputs (basemaps + popup constants)Testing
python3 -m ruff check explorer/python3 scripts/generate_basemap_assets.py --checkpython3 -m pytest tests/ -q— 636 passed, 7 skippedNotes
To change popup width, edit
MAP_POPUP_MAX_WIDTH_PXinexplorer/app/streamlit/defaults.py, then run:(
build_all_locations_map_frontend.pyruns this automatically before npm build.)Issues
Fixes #265
Made with Cursor