added impact statistics in dashboard #45
Open
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.
🌱 Carbon Footprint Tracker - Pull Request
Description
This Pull Request implements the "Create Impact by Numbers" feature (Issue #21, assuming the issue number from the screenshot). It introduces a new section on the dashboard to display motivational statistics on collective user impact, including a count-up animation effect.
Type of Change
[ ] 🐛 Bug fix (non-breaking change which fixes an issue)
[x] ✨ New feature (non-breaking change which adds functionality)
[ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] 📚 Documentation update
[x] 🎨 Style/UI update
[x] ♻️ Code refactoring (for count-up hook)
[ ] ⚡ Performance improvement
[ ] 🧪 Test addition or update
Related Issue
Fixes #21 (Create 'Impact by Numbers' Section)
Changes Made
Created the ImpactStats.tsx component for displaying impact metrics.
Added mock data and the inspirational tagline to src/constants/impactStats.ts.
Implemented the useCountUp.ts custom hook to animate numbers on render.
Integrated the component into src/components/dashboard/dashboard.tsx, placing it below the "Today's Impact in Context" section.
Applied the requested light theme styling (bg-white container, bg-green-50 cards, and green accents) for a cohesive UI.
Updated the logic to correctly handle counting and formatting of all stats (10,000+, 2.5 tons, 500+).
Screenshots

Testing
[x] I have tested this change locally (verified static numbers and animation)
[ ] I have tested on mobile devices
[ ] I have tested on different browsers
[ ] All existing tests pass
[ ] I have added new tests (if applicable)
Checklist
[x] My code follows the project's style guidelines (Tailwind CSS, TypeScript/TSX)
[x] I have performed a self-review of my code
[ ] I have commented my code, particularly in hard-to-understand areas (All unnecessary comments were removed per request)
[ ] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[ ] New and existing unit tests pass locally with my changes
Additional Notes
The count-up animation is designed to start on mount. If the animation is missed on the initial page load, the intended fix is to ensure the impactStats component is given a unique key in dashboard.tsx to force a re-render when the data finishes loading. This is currently implemented in the parent component logic.
Thank you for contributing to making digital sustainability more accessible! 🌍
This repository participates in Hacktoberfest 2025! 🎃