feat: display CO2 in kg when ≥ 1 000 g for readability#618
Merged
Conversation
Switch CO2 emissions display from always-grams to adaptive kg/g notation: values >= 1 000 g are shown as X.XX kg. - vscode-extension webview environmental panel: add formatCo2Grams() helper that wraps smartFixed(); use it for the 4 period cards - cli environmental command: add formatCo2() helper; use it for the per-period CO2 row and the methodology tree-absorption line; remove unused mt import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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
Switches CO₂ display from always showing grams to an adaptive g/kg notation: values ≥ 1 000 g are shown as
X.XX kg.Heavy users accumulate tens of kilograms of CO₂ equivalent, which was previously displayed as unwieldy 5-digit gram values (e.g.
12345.678 gCO₂e). The new format shows12.35 kgCO₂einstead.Changes
VS Code extension — environmental webview
formatCo2Grams(grams)helper that wrapssmartFixed()and switches unit at 1 000 g.CLI —
environmentalcommandformatCo2(grams)helper with the same threshold.printEnvironmentalStats.21.00 kg).fmtimport.Testing
All 857 unit tests pass (
npm run test:node).