feat(finance): add year filter to Budget Analysis issue#3653
solved issue#3653
Description
- Added years filter in components/FinancialSummary/BarChartComponent.tsx
Summary by CodeRabbit
- Documentation
- Added in-code guidance and commented scaffolding for a future year selector and alternate data sources (previous years, current year, "All Years"), plus ambient type references for the build environment.
- Chores
- Included commented examples showing how category/month derivation and link resolution would switch to year-specific datasets; no active UI elements or runtime behavior were changed.
Deploy Preview for asyncapi-website ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 90255608401dbad5a1dfe5151e5f71a76ef54fc7 |
| Latest deploy log | https://app.netlify.com/projects/asyncapi-website/deploys/69296365027b540008115985 |
| Deploy Preview | https://deploy-preview-4451--asyncapi-website.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Walkthrough
Adds commented scaffolding to the FinancialSummary bar chart and guidance in getUniqueCategories to enable future year-based data selection/merging (2023, 2024, "All Years"). Also adds a Next.js ambient types declaration file. No active runtime behavior or exported APIs were changed; existing ExpensesData path remains in use.
Changes
| Cohort / File(s) | Summary |
|---|---|
Financial Summary: year-scaffolding commentscomponents/FinancialSummary/BarChartComponent.tsx |
Extensive commented scaffolding added for prior-year datasets and an "All Years" option: placeholder imports, selectedYear state, availableYears, helper getters (getExpensesData, getExpensesLinkData), and commented UI year-selector placement. Active code continues to use ExpensesData / ExpensesLinkData. |
Utilities: optional parameter guidanceutils/getUniqueCategories.ts |
Added commented alternative signature and guidance to accept external expensesData; active implementation remains unchanged and uses the module-level Expenses import. |
Type declarations: Next.js ambient typesnext-env.d.ts |
New file adding triple-slash references for Next.js and Next image types (ambient type directives). File is auto-generated-style and contains a "do not edit" note; no runtime or exported API changes. |
Sequence Diagram(s)
sequenceDiagram
autonumber
actor User
participant BarChart as BarChartComponent
participant ActiveData as ExpensesData (active)
participant CommentedScaffold as YearScaffold (commented)
User->>BarChart: view chart
BarChart->>ActiveData: read ExpensesData / ExpensesLinkData
BarChart->>BarChart: derive months/categories, render bars
Note right of CommentedScaffold #f9f7e8: Commented helpers:\ngetExpensesData / getExpensesLinkData\nand year selector UI (not active)
User->>BarChart: click bar
BarChart->>ActiveData: lookup link in ExpensesLinkData
alt Link found
BarChart->>User: open link
else No link
BarChart-->>User: no action
end
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested reviewers
- anshgoyalevil
- devilkiller-ag
- akshatnema
- sambhavgupta0705
- vishvamsinh28
- Mayaleeeee
Poem
A rabbit nudged a chart with care,
Left tiny notes for years to share.
Future toggles tucked in rows,
Waiting till the season grows.
🥕✨
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The title precisely reflects the primary change by describing the addition of a year filter to the Budget Analysis component and follows a clear conventional commit format. It is concise, specific, and directly aligned with the pull request’s objectives without unnecessary detail. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
📜 Recent review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 2fc7a447ce60e00e690edab6ee7d118eedb20a9e and b787b69487e96952aab0c2c94f9b5d812d82b102.
📒 Files selected for processing (3)
components/FinancialSummary/BarChartComponent.tsx(5 hunks)next-env.d.ts(1 hunks)utils/getUniqueCategories.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- next-env.d.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- utils/getUniqueCategories.ts
- components/FinancialSummary/BarChartComponent.tsx
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test NodeJS PR - windows-latest
- GitHub Check: Test NodeJS PR - macos-13
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 100.00%. Comparing base (4094d22) to head (9025560).
Additional details and impacted files
@@ Coverage Diff @@
## master #4451 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 799 799
Branches 146 146
=========================================
Hits 799 799
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@anshgoyalevil I ran tests, lint, and build locally and all passed, but the Netlify build behaves differently. Each PR shows new build errors. How can I replicate the Netlify build locally so I can fix everything before submitting the final PR? Or is it okay if I keep submitting PRs, checking the Netlify build, and fixing errors one by one?
The CI logs shows some errors
Are they related to your PR?
@anshgoyalevil yes, but those are false error. The path is correct I have checked it multiple times. Here is the video
https://github.com/user-attachments/assets/e79df67f-39b9-4913-86b4-c167b6c20bee
@anshgoyalevil @derberg @sambhavgupta0705 @akshatnema got the bug.
Netlify build is failing because .gitignore has /config/finance/json-data/*, so the JSON files present at this path (Expenses2023.json, ExpensesLink2023.json, etc.) aren’t in the repo. They exist locally after cloning the project but not on GitHub, so Netlify can’t find them. Should I commit these files or handle them another way. Please tell me know what to do.
And those files import is already present on latest commit of master branch in line 6 and 7.
Actually the whole Budget Analysis should be hidden for now. Updating the section is cumbersome at the moment, and getting changes merged also takes lots of time. I suggest to just hide it for now, not remove, just hide. All data is transparently visible in open collective
@derberg could you please clarify what you mean by “hide it”? Should I comment out the imports and the code that uses that module?
yes, hide from viewer, so just comment out relevant code
with some TODO to remember about it in future
⚡️ Lighthouse report for the changes in this PR:
| Category | Score |
|---|---|
| 🔴 Performance | 38 |
| 🟢 Accessibility | 98 |
| 🟢 Best practices | 92 |
| 🟢 SEO | 100 |
| 🔴 PWA | 33 |
Lighthouse ran on https://deploy-preview-4451--asyncapi-website.netlify.app/
@derberg @anshgoyalevil @sambhavgupta0705 conflicts Fixed. Please review it, let me know in case of further changes.