Repository navigation
feat(fuel): label the map with the compared grade's price and its age - #736
Merged
Merged
Conversation
Map labels at close zoom showed every grade a station prices, so neighbouring stations could not be compared at a glance. A fuel result now carries a labelSummary with only the grade the list sorts by (the first selected grade, else diesel): its cheapest self-service car price per litre and how long ago it was reported. A station without that price shows the grade as missing. The map uses labelSummary when a result has one and credits that field. Closes #414
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What changed and why
Fuel labels on the map at close zoom listed every grade a station prices (
D €1.559 · E5 €1.699 · E10 €1.639), so neighbouring stations couldn't be compared at a glance. They now show only the grade the result list sorts by, which is the first selected fuel type or diesel when none is selected, plus how long ago that price was reported:D €1.559 · 25 min,E10 €1.639 · 3 h,D €1.589 · 2 d(German:Min.,Std.,Tg.)E10 –) instead of another grade's price.How it works: fuel results carry a new optional
labelSummaryonDataSourceResult. The search builds it for the comparison grade, and the map label uses it when a result has one, falling back tosummaryotherwise. The summary-label credits name the field actually shown. The result card in the list still shows every grade.The age is computed when the search is answered, so it can be up to the search cache's two minutes behind. Stations near a border are compared in their own currencies, as the list sort already does.
Related work
Fixes #414
Verification
npx vitest run integrations/fuel apps/web/src/components/map/layers/DataSourceLayer.test.tsx: 68 passed. New tests cover:sortValueslabelSummaryand crediting that fieldtsc --noEmitpasses inpackages/core,apps/api(which includes the fuel integration) andapps/web.npx biome checkandpnpm check-translationspass.Release and upgrade impact
No package release:
DataSourceResult.labelSummaryis a type-only addition. I built@openmapx/extension-cliwithpnpm buildfrommainand from this branch, and itsdistoutput (cli.jsplus two chunks) is identical once content-hashed chunk names and absolute module-path comments are normalized.