Skip to content

Commit

Permalink
disable cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovisser committed Sep 18, 2023
1 parent f82315c commit 8a02615
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
22 changes: 12 additions & 10 deletions centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -830,16 +830,18 @@ const PendingOrder: React.FC<{
<AnchorTextLink href="https://docs.centrifuge.io/learn/epoch/">Learn more</AnchorTextLink>
</Text>
</Stack>
<Grid gap="1px" columns={state.canChangeOrder ? 2 : 1} equalColumns>
<LightButton type="button" onClick={onCancelOrder} disabled={isCancelling || calculatingOrders}>
{isCancelling ? (
<Spinner size="iconSmall" />
) : (
<Text variant="body2" color="inherit">
Cancel
</Text>
)}
</LightButton>
<Grid gap="1px" columns={state.canChangeOrder && state.canCancelOrder ? 2 : 1} equalColumns>
{state.canCancelOrder && (
<LightButton type="button" onClick={onCancelOrder} disabled={isCancelling || calculatingOrders}>
{isCancelling ? (
<Spinner size="iconSmall" />
) : (
<Text variant="body2" color="inherit">
Cancel
</Text>
)}
</LightButton>
)}
{state.canChangeOrder && (
<LightButton type="button" onClick={onChangeOrder} disabled={isCancelling || calculatingOrders}>
<Text variant="body2" color="inherit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export function InvestRedeemCentrifugeProvider({ poolId, trancheId, children }:
needsPoolCurrencyApproval: () => false,
needsTrancheTokenApproval: () => false,
canChangeOrder: true,
canCancelOrder: true,
pendingAction,
pendingTransaction,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export function InvestRedeemLiquidityPoolsProvider({ poolId, trancheId, children
? lpInvest.managerTrancheTokenAllowance.toFloat() < amount && !lpInvest.trancheTokenSupportsPermit
: false,
canChangeOrder: false,
canCancelOrder: false,
pendingAction,
pendingTransaction,
statusMessage: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export function InvestRedeemTinlakeProvider({ poolId, trancheId, children }: Pro
needsPoolCurrencyApproval: () => !!trancheInvestment?.poolCurrencyAllowance.isZero(),
needsTrancheTokenApproval: () => !!trancheInvestment?.tokenAllowance.isZero(),
canChangeOrder: true,
canCancelOrder: true,
pendingAction,
pendingTransaction,
}
Expand Down
1 change: 1 addition & 0 deletions centrifuge-app/src/components/InvestRedeem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export type InvestRedeemState = {
needsPoolCurrencyApproval: (amount: number) => boolean
needsTrancheTokenApproval: (amount: number) => boolean
canChangeOrder: boolean
canCancelOrder: boolean
pendingAction?: InvestRedeemAction | null
pendingTransaction?: Transaction | null
statusMessage?: string
Expand Down

0 comments on commit 8a02615

Please sign in to comment.