-
Notifications
You must be signed in to change notification settings - Fork 94
Add support for Brazilian Real currency #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3942,7 +3942,7 @@ | |
| addToast(t('powerNoData') || 'No data', 'warning'); | ||
| return; | ||
| } | ||
| const symX = ({ EUR: 'EUR', USD: 'USD', GBP: 'GBP', CHF: 'CHF', JPY: 'JPY' }[cur] || cur); | ||
| const symX = ({ EUR: 'EUR', USD: 'USD', GBP: 'GBP', CHF: 'CHF', JPY: 'JPY', BRL: 'BRL' }[cur] || cur); | ||
| const pf = (n) => `${symX} ${(n || 0).toFixed(2)}`; | ||
| const kwh = (n) => `${(n || 0).toFixed(1)} kWh`; | ||
| const co2 = (n) => `${(n || 0).toFixed(1)} kg`; | ||
|
|
@@ -4267,7 +4267,7 @@ | |
|
|
||
| const fmt = (n) => { | ||
| const cur = summary?.rates?.currency || 'EUR'; | ||
| const sym = ({ EUR: '€', USD: '$', GBP: '£', CHF: 'CHF', JPY: '¥' }[cur] || cur); | ||
| const sym = ({ EUR: '€', USD: '$', GBP: '£', CHF: 'CHF', JPY: '¥', BRL: 'R$' }[cur] || cur); | ||
| return `${sym} ${(n || 0).toFixed(2)}`; | ||
| }; | ||
|
|
||
|
|
@@ -4337,7 +4337,7 @@ | |
| return; | ||
| } | ||
| const cur = summary.rates.currency || 'EUR'; | ||
| const sym = ({ EUR: 'EUR', USD: 'USD', GBP: 'GBP', CHF: 'CHF', JPY: 'JPY' }[cur] || cur); | ||
| const sym = ({ EUR: 'EUR', USD: 'USD', GBP: 'GBP', CHF: 'CHF', JPY: 'JPY', BRL: 'BRL' }[cur] || cur); | ||
| const pf = (n) => `${sym} ${(n || 0).toFixed(2)}`; | ||
|
|
||
| const blocks = []; | ||
|
|
@@ -4591,6 +4591,7 @@ | |
| <option value="GBP">GBP (£)</option> | ||
| <option value="CHF">CHF</option> | ||
| <option value="JPY">JPY (¥)</option> | ||
| <option value="BRL">BRL (R$)</option> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Drive currency dropdown options from the same shared currency configuration used by formatters so all selectors stay in sync automatically. [custom_rule] Severity Level: Major Why it matters? ⭐The dropdown option is hardcoded alongside formatter mappings, so adding or changing currencies requires editing multiple separate spots. That duplication is a genuine maintainability concern and is directly visible in the updated file. Rule source 📖CodeAnt dashboard (rule "agent-persona-maintainability") (Use Cmd/Ctrl + Click for best experience) Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** web/src/dashboard.js
**Line:** 4594:4594
**Comment:**
*Custom Rule: Drive currency dropdown options from the same shared currency configuration used by formatters so all selectors stay in sync automatically.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Deployed build not updated This PR adds BRL support in web/src/dashboard.js, but the deployed artifact web/index.html is not rebuilt, so the running UI will still not show BRL symbol/formatting or the BRL currency dropdown option. As a result, users won’t actually get BRL support after deployment. Agent Prompt
|
||
| </select> | ||
| </div> | ||
| <div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Extract the currency-to-symbol mapping into a single shared constant/helper and reuse it here instead of embedding another inline map literal. [custom_rule]
Severity Level: Major⚠️
Why it matters? ⭐
The file already contains repeated inline currency maps in multiple places, which makes updates error-prone and harder to maintain. This is a real maintainability issue because the same mapping is duplicated rather than sourced from one shared helper or constant.
Rule source 📖
CodeAnt dashboard (rule "agent-persona-maintainability")
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖