'use client'; import { Spinner } from '@/internal/components/Spinner'; import { ErrorSvg } from '@/internal/svg/fullWidthErrorSvg'; import { SuccessSvg } from '@/internal/svg/fullWidthSuccessSvg'; import { cn, pressable, text } from '@/styles/theme'; import { useEffect } from 'react'; import { useWithdrawButton } from '../hooks/useWithdrawButton'; import { useAppchainBridgeContext } from './AppchainBridgeProvider'; const buttonStyles = cn( pressable.primary, 'rounded-ock-default', 'w-full rounded-xl', 'px-4 py-3 font-medium text-base text-white leading-6', text.headline, ); export const AppchainBridgeWithdraw = () => { const { withdrawStatus, waitForWithdrawal, resumeWithdrawalTxHash, handleResetState, } = useAppchainBridgeContext(); const { shouldShowClaim, label, isError, isPending } = useWithdrawButton({ withdrawStatus, }); useEffect(() => { (async () => { if (withdrawStatus === 'withdrawSuccess') { // If appchain withdrawal is successful, wait for claim to be ready waitForWithdrawal(); } if (resumeWithdrawalTxHash) { // If the user has resumed a withdrawal transaction, wait for claim to be ready waitForWithdrawal(resumeWithdrawalTxHash); } })(); }, [withdrawStatus, waitForWithdrawal, resumeWithdrawalTxHash]); return (