You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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 -->
Copy file name to clipboardExpand all lines: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/create-token-card.tsx
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ export function StepCard(props: {
15
15
|undefined
16
16
|{
17
17
type: "submit";
18
+
disabled?: boolean;
18
19
}
19
20
|{
20
21
type: "custom";
@@ -56,6 +57,7 @@ export function StepCard(props: {
Copy file name to clipboardExpand all lines: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/distribution/token-distribution.tsx
+45-4Lines changed: 45 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ export function TokenDistributionFieldset(props: {
0 commit comments