Skip to content

Refactor: Centralize dashboard financial constants#30

Open
prem22k wants to merge 1 commit intomainfrom
code-health-refactor-unseal-dashboard-6385151426959019696
Open

Refactor: Centralize dashboard financial constants#30
prem22k wants to merge 1 commit intomainfrom
code-health-refactor-unseal-dashboard-6385151426959019696

Conversation

@prem22k
Copy link
Copy Markdown
Owner

@prem22k prem22k commented Feb 13, 2026

This change addresses a code health issue by centralizing the hardcoded financial constant 15000 (monthly burn rate) used in the dashboard. This improves maintainability and allows for easier configuration changes in the future. Additionally, it includes a fix for the SBI parser date logic to ensure the test suite passes reliably.


PR created automatically by Jules for task 6385151426959019696 started by @prem22k

- Extracted `DEFAULT_MONTHLY_BURN` (15000) to `src/lib/constants.ts`.
- Updated `src/components/dashboard/UnsealDashboard.tsx` to import and use the constant.
- Cleaned up unused imports and improved accessibility in `UnsealDashboard.tsx` (e.g., button types, SVG titles).
- Fixed a date parsing issue in `src/lib/parsers/sbi.ts` to support 2-digit years, ensuring tests pass.
- Verified changes with `biome check` and unit tests.
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 13, 2026 13:32
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wealth-folio Error Error Feb 13, 2026 1:47pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 13, 2026

Warning

Rate limit exceeded

@prem22k has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch code-health-refactor-unseal-dashboard-6385151426959019696

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Centralizes the dashboard’s default monthly burn rate into a shared constant to reduce hardcoded “magic numbers”, and updates the SBI parser’s date parsing logic to handle 2- vs 4-digit year inputs more explicitly.

Changes:

  • Added DEFAULT_MONTHLY_BURN to a new shared constants module.
  • Updated UnsealDashboard runway calculation to use the shared burn-rate constant.
  • Refactored SBI parseDate logic to select parsing format based on year length.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/parsers/sbi.ts Updates date parsing logic for SBI statement lines (2- vs 4-digit years).
src/lib/constants.ts Introduces shared financial constant(s), including default monthly burn rate.
src/components/dashboard/UnsealDashboard.tsx Uses shared burn-rate constant for runway calculation; large formatting/markup refactor in the component.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/parsers/sbi.ts
Comment on lines +147 to +154
if (yearPart.length === 4) {
date = parse(normalized, 'd-M-yyyy', new Date());
} else {
// Assume 2 digits
date = parse(normalized, 'd-M-yy', new Date());
}
return null;

return isNaN(date.getTime()) ? null : date;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

parseDate() builds a Date via date-fns parse(..., new Date()), which produces a local-time midnight date. parseWithRegex() later calls toISOString().split("T")[0], which will shift the calendar day in non-UTC timezones (e.g., IST), making tests/environment behavior timezone-dependent. Prefer constructing the parsed date in UTC (e.g., parse parts then new Date(Date.UTC(year, monthIndex, day))), or normalize the parsed result to a UTC date before returning.

Copilot uses AI. Check for mistakes.
</div>
<div className="bg-white/5 rounded-xl px-4 py-2 border border-white/5">
<p className="text-slate-300 text-xs font-medium">
Based on ₹15k fixed monthly costs
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The runway calculation now uses DEFAULT_MONTHLY_BURN, but the UI copy still hardcodes "₹15k". This will become misleading if the constant changes; consider deriving the displayed value from DEFAULT_MONTHLY_BURN (formatted as ₹15k/₹15,000 as desired) so the text stays in sync with the calculation.

Suggested change
Based on 15k fixed monthly costs
Based on {DEFAULT_MONTHLY_BURN.toLocaleString("en-IN")} fixed monthly costs

Copilot uses AI. Check for mistakes.
Comment on lines +331 to +333
recentTx.map((tx) => (
<div
key={tx.id || Math.random()}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Using Math.random() as a React key makes keys unstable across renders, which can cause unnecessary remounts and lost component state. Use a deterministic fallback (e.g., tx.id when present, otherwise the array index or another stable field combination).

Suggested change
recentTx.map((tx) => (
<div
key={tx.id || Math.random()}
recentTx.map((tx, index) => (
<div
key={tx.id ?? index}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants