Skip to content

Commit

Permalink
refactor: Update auto-complete buttons and handle removal of weight
Browse files Browse the repository at this point in the history
  • Loading branch information
EdSDR committed Oct 15, 2024
1 parent a196b75 commit ac6ec22
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions apps/commune-validator/src/app/components/delegated-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,24 +555,27 @@ export function DelegatedList() {
<div className="flex flex-row gap-3 pt-4">
<Button
onClick={handleAutoCompletePercentage}
disabled={totalPercentage === 100}
disabled={
totalPercentage === 100 || activeTab === "modules"
? delegatedModules.length === 0
: delegatedSubnets.length === 0
}
variant="default-purple"
className="w-full rounded-full"
>
Auto-Complete to 100%
</Button>
{hasItemsToClear && (
<Button
onClick={handleRemoveAllWeight}
disabled={isSubmitting}
variant="default-red"
className="w-full rounded-full"
>
{isSubmitting
? "Removing..."
: `Remove ${activeTab === "modules" ? "Modules" : "Subnets"}`}
</Button>
)}

<Button
onClick={handleRemoveAllWeight}
disabled={isSubmitting || !hasItemsToClear}
variant="default-red"
className="w-full rounded-full"
>
{isSubmitting
? "Removing..."
: `Remove ${activeTab === "modules" ? "Modules" : "Subnets"}`}
</Button>
</div>
<Separator className="my-4" />
<Button
Expand Down

0 comments on commit ac6ec22

Please sign in to comment.