Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions web/src/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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);

Copy link
Copy Markdown

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")

Fix in Cursor Fix in VSCode Claude

(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:** 4270:4270
**Comment:**
	*Custom Rule: Extract the currency-to-symbol mapping into a single shared constant/helper and reuse it here instead of embedding another inline map literal.

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 fix
👍 | 👎

return `${sym} ${(n || 0).toFixed(2)}`;
};

Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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")

Fix in Cursor Fix in VSCode Claude

(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 fix
👍 | 👎

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Deployed build not updated 🐞 Bug ≡ Correctness

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
## Issue description
The repo deploys `web/index.html` as the compiled single-file SPA, but the PR only updates `web/src/dashboard.js`. Without regenerating `web/index.html`, the deployed UI will still contain the old currency mappings/options (no BRL).

## Issue Context
`web/Dev/build.sh` documents that after editing `web/src/*.js`, you must rebuild because the compiled `web/index.html` is what gets deployed.

## Fix
1. Run `web/Dev/build.sh` to regenerate `web/index.html` from `web/src/*.js`.
2. Commit the updated `web/index.html` output in this PR.

## Fix Focus Areas
- web/Dev/build.sh[10-25]
- web/index.html[6568-6575]
- web/src/dashboard.js[4268-4272]
- web/src/dashboard.js[4586-4595]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

</select>
</div>
<div>
Expand Down