Skip to content

Commit

Permalink
fix: invalid check on validators table
Browse files Browse the repository at this point in the history
  • Loading branch information
icfor committed Mar 16, 2024
1 parent 3aeb0cf commit 45d8a4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
17 changes: 12 additions & 5 deletions src/features/staking/components/delegation-details.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import BigNumber from "bignumber.js";
import type { Validator } from "cosmjs-types/cosmos/staking/v1beta1/staking";
import {
BondStatus,
type Validator,
} from "cosmjs-types/cosmos/staking/v1beta1/staking";
import { memo, useEffect, useState } from "react";

import {
Expand Down Expand Up @@ -98,7 +101,7 @@ type DelegationRowProps = {

const DelegationRowBase = ({
delegation,
disabled,
disabled: disabledProp,
index,
staking,
validator,
Expand Down Expand Up @@ -137,7 +140,9 @@ const DelegationRowBase = ({
</div>
<div className="flex flex-row items-center justify-end gap-[8px]">
<ButtonPill
disabled={disabled}
disabled={
disabledProp || validator?.status !== BondStatus.BOND_STATUS_BONDED
}
onClick={() => {
if (!validator) return;

Expand All @@ -154,7 +159,9 @@ const DelegationRowBase = ({
<FloatingDropdown Trigger={Menu} id={`delegation-${index}`}>
<div className="flex flex-col gap-[12px] rounded-[8px] bg-bg-600 py-[4px]">
<ButtonLink
disabled={!getCanClaimRewards(delegation?.rewards) || disabled}
disabled={
!getCanClaimRewards(delegation?.rewards) || disabledProp
}
onClick={() => {
if (!validator) return;

Expand All @@ -171,7 +178,7 @@ const DelegationRowBase = ({
Claim rewards
</ButtonLink>
<ButtonLink
disabled={disabled}
disabled={disabledProp}
onClick={() => {
if (!validator) return;

Expand Down
5 changes: 2 additions & 3 deletions src/features/staking/components/validators-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ const ValidatorsTable = () => {
currentTab === "active"
? (v) => v.status === BondStatus.BOND_STATUS_BONDED
: (v) =>
v.status ===
(BondStatus.BOND_STATUS_UNBONDED ||
BondStatus.BOND_STATUS_UNBONDING),
v.status === BondStatus.BOND_STATUS_UNBONDED ||
v.status === BondStatus.BOND_STATUS_UNBONDING,
)
.slice()
.sort((a, b) => {
Expand Down

0 comments on commit 45d8a4f

Please sign in to comment.