Commit 810ec6e
committed
[TOOL-4651] Dashboard: Show error on invalid token distribution in ERC20 asset creation form (#7260)
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on enhancing the `TokenDistributionFieldset` component by adding error handling for token distribution and improving the UI by displaying error messages. It also updates the `StepCard` and `DistributionBarChart` components to accommodate new features.
### Detailed summary
- Added `disabled` prop to `StepCard`.
- Integrated error handling in `TokenDistributionFieldset` for distribution validation.
- Displayed error messages when distribution exceeds supply.
- Improved `DistributionBarChart` to conditionally style text based on segment percentages.
- Introduced `getDistributionError` and `SafeNumber` utility functions for validation logic.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Added validation to ensure token distribution does not exceed total supply, with error messages displayed when limits are surpassed.
- The "Next" submit button in the token creation flow can now be disabled based on validation errors.
- **Bug Fixes**
- Owner percentage in the distribution chart is now prevented from displaying negative values.
- **Style**
- Segment labels in the distribution chart legend are visually highlighted if their percentage is outside the 0–100% range.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 1c6ed9b commit 810ec6e
File tree
3 files changed
+55
-5
lines changed- apps/dashboard/src
- @/components/blocks
- app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create
- distribution
3 files changed
+55
-5
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
Lines changed: 45 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| |||
74 | 84 | | |
75 | 85 | | |
76 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
77 | 117 | | |
78 | 118 | | |
79 | 119 | | |
| |||
87 | 127 | | |
88 | 128 | | |
89 | 129 | | |
90 | | - | |
| 130 | + | |
| 131 | + | |
91 | 132 | | |
92 | 133 | | |
93 | 134 | | |
| |||
0 commit comments