Repository navigation
feat(frontend): add relay type color pickers and keep settings across reloads - #581
Merged
Merged
Conversation
Each relay type in the "Show relay types" panel gets a round swatch that opens the browser's native color picker, so no new dependency is needed. The colors are part of the settings and are used for the map markers and all relay type icons. A "Reset colors" button appears once a color differs from the defaults. Closes #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a
All settings are saved to localStorage under a versioned key whenever they change and are restored on page load. Stored values are validated against the defaults, so missing, outdated or invalid entries fall back to the default values. Unavailable storage (e.g. private mode) is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a
Family IDs differ between dates, so a stored family selection would point to an unrelated or missing family after a reload. The family grouping toggle and the selected country are still persisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a
|
Visit the preview URL for this PR (updated for commit ceb0e17): https://tormap-36f44--pr581-claude-relay-type-co-dusykr8p.web.app (expires Mon, 09 Nov 2026 23:47:25 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc |
Resolves conflicts with the restore default settings feature (#578): the settings context keeps both local storage and resetSettings / isDefaultSettings, and both AppSettings test suites are kept. settingsEqual now compares nested records as unknown values, since relayTypeColors holds strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a
Restoring the default settings now also removes a relay search shown on the map, and the restore button is offered while such a search is active. On small screens the settings dialog closes once search results are shown on the map, so the map is directly visible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a
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.
Closes #71
Summary
<input type="color">), so no new dependency is needed. A "Reset colors" button appears once a color differs from the defaults.relayTypeColorssetting. It replaces the hard-codedColorsinconfig.tsand keeps the same defaults.RelayTypeIconcomponent.changeevent, which fires once a color is picked. Updating on everyinputevent while dragging would redraw all relays and country layers each time.localStorage(tormap.settings.v1) whenever they change and restored on load.settingsEqualcompares nested records asunknown, sincerelayTypeColorsholds strings.Tests
yarn build,yarn lintandtscpass.yarn test:run: 18 files, 214 tests pass. New tests:AppSettings.test.tsx: picking and resetting colors, and restoring the defaults clears the map search.OverlaySmall.test.tsx: the mobile settings close when search results are shown on the map. This test fails without the fix.settings-storage.unit.test.ts: parsing and validating stored settings.settings-context.test.tsx: restoring and saving settings, the selected family isn't saved, and a changed color counts as non-default.layer-construction.test.tsnow use custom colors.TypeError: Cannot read properties of undefined (reading 'includes')while all tests passed. It couldn't be reproduced with a stack trace, and CI was green.🤖 Generated with Claude Code
https://claude.ai/code/session_017g53GDRosq9GXX9AXEsw1a