Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-babylonlabs committed Nov 28, 2024
1 parent e8f72a3 commit 5793196
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
3 changes: 0 additions & 3 deletions src/app/api/getDelegations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const getDelegations = async (

const params = {
pagination_key: encode(key),
// "pagination_reverse": reverse,
// "pagination_limit": limit,
staker_btc_pk: encode(publicKeyNoCoord),
state: ["active", "unbonded"],
};
Expand Down Expand Up @@ -90,7 +88,6 @@ export const getDelegations = async (
outputIndex: apiDelegation.unbonding_tx.output_index,
}
: undefined,
transitioned: apiDelegation.transitioned,
isEligibleForTransition: apiDelegation.is_eligible_for_transition,
}),
);
Expand Down
36 changes: 19 additions & 17 deletions src/app/components/Delegations/Delegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,34 @@ export const Delegation: React.FC<DelegationProps> = ({
};

const generateActionButton = () => {
if (delegation.isEligibleForTransition) {
if (
state === DelegationState.ACTIVE ||
delegation.isEligibleForTransition
) {
return (
<div className="flex justify-end lg:justify-start">
<button
className="btn btn-outline btn-xs inline-flex text-sm font-normal text-primary-dark"
onClick={onTransition}
disabled={
intermediateState === DelegationState.INTERMEDIATE_TRANSITIONING
}
>
Transition
</button>
</div>
);
} else if (state === DelegationState.ACTIVE) {
return (
<div className="flex justify-end lg:justify-start">
<div
className="flex justify-end lg:justify-start"
data-tooltip-id="tooltip-transition"
data-tooltip-content={
state === DelegationState.ACTIVE &&
!delegation.isEligibleForTransition
? "Staking transition is not available yet, come back later"
: ""
}
>
<button
className="btn btn-outline btn-xs inline-flex text-sm font-normal text-primary-dark"
onClick={onTransition}
disabled={
intermediateState === DelegationState.INTERMEDIATE_TRANSITIONING
intermediateState ===
DelegationState.INTERMEDIATE_TRANSITIONING ||
(state === DelegationState.ACTIVE &&
!delegation.isEligibleForTransition)
}
>
Transition
</button>
<Tooltip id="tooltip-transition" className="tooltip-wrap" />
</div>
);
} else if (state === DelegationState.UNBONDED) {
Expand Down
1 change: 0 additions & 1 deletion src/app/types/delegations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface Delegation {
stakingTx: StakingTx;
unbondingTx: UnbondingTx | undefined;
isOverflow: boolean;
transitioned: boolean;
isEligibleForTransition: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/getState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getState = (state: string) => {
// Create state tooltips for the additional information
export const getStateTooltip = (state: string) => {
switch (state) {
case DelegationState.ACTIVE:
case DelegationState.ACTIVE: // active state is shwon
return "Stake is active";
case DelegationState.UNBONDED:
return "Stake has been unbonded";
Expand Down

0 comments on commit 5793196

Please sign in to comment.