-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Claim funds" button for OP bridge (#1335)
* "Claim funds" button for OP bridge + minor adjustments Fixes #1293 * review env * fix layout * rollback preview envs
- Loading branch information
Showing
6 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Button } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import type { L2WithdrawalStatus } from 'types/api/l2Withdrawals'; | ||
import { WITHDRAWAL_STATUSES } from 'types/api/l2Withdrawals'; | ||
|
||
import config from 'configs/app'; | ||
import DetailsInfoItem from 'ui/shared/DetailsInfoItem'; | ||
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1'; | ||
import VerificationSteps from 'ui/shared/verificationSteps/VerificationSteps'; | ||
|
||
interface Props { | ||
status: L2WithdrawalStatus | undefined; | ||
l1TxHash: string | undefined; | ||
} | ||
|
||
const TxDetailsWithdrawalStatus = ({ status, l1TxHash }: Props) => { | ||
if (!config.features.optimisticRollup.isEnabled) { | ||
return null; | ||
} | ||
|
||
if (!status || !WITHDRAWAL_STATUSES.includes(status)) { | ||
return null; | ||
} | ||
|
||
const rightSlot = (() => { | ||
if (status === 'Relayed' && l1TxHash) { | ||
return <TxEntityL1 hash={ l1TxHash } truncation="constant"/>; | ||
} | ||
|
||
if (status === 'Ready for relay') { | ||
return ( | ||
<Button | ||
variant="outline" | ||
size="sm" | ||
as="a" | ||
href="https://app.optimism.io/bridge/withdraw" | ||
target="_blank" | ||
> | ||
Claim funds | ||
</Button> | ||
); | ||
} | ||
|
||
return null; | ||
})(); | ||
|
||
return ( | ||
<DetailsInfoItem | ||
title="Withdrawal status" | ||
hint="Detailed status progress of the transaction" | ||
> | ||
<VerificationSteps | ||
steps={ WITHDRAWAL_STATUSES as unknown as Array<L2WithdrawalStatus> } | ||
step={ status } | ||
rightSlot={ rightSlot } | ||
my={ status === 'Ready for relay' ? '-6px' : 0 } | ||
lineHeight={ status === 'Ready for relay' ? 8 : undefined } | ||
/> | ||
</DetailsInfoItem> | ||
); | ||
}; | ||
|
||
export default React.memo(TxDetailsWithdrawalStatus); |