feat: implement milestone reward auto-distribution calculator - #395
Open
zeroknowledge0x wants to merge 2 commits into
Open
feat: implement milestone reward auto-distribution calculator#395zeroknowledge0x wants to merge 2 commits into
zeroknowledge0x wants to merge 2 commits into
Conversation
added 2 commits
May 29, 2026 08:03
Add RewardCalculator component that provides three distribution modes for splitting grant budgets across milestones. Features: - Equal split: divides budget evenly, last milestone gets rounding remainder - Front-loaded: 50% first, 30% second, remainder split among rest - Custom weight: slider-based (1-10) proportional distribution - Undo button: reverts to previous values within 5 seconds - Edge cases: handles 0 budget, 0 milestones, rounding to 2 decimals Files: - components/grants/CreateGrantForm/RewardCalculator.tsx - tests/components/RewardCalculator.test.tsx Fixes PhasoraLabs#391
The useEffect properly guards against unnecessary updates by checking prev.length === milestoneCount. This pattern is intentional for resizing the weights array when milestone count changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements the RewardCalculator component for automatic budget distribution across milestones in the Create Grant form.
Changes
components/grants/CreateGrantForm/RewardCalculator.tsx— New component with three distribution modes:tests/components/RewardCalculator.test.tsx— Comprehensive test suite covering:Testing
Related Issues
Fixes #391