import { type ReactElement } from 'react'
import styles from './Alert.module.css'
export function getTransactionMessage(transactionHash?: string): {
[key: string]: string
} {
return {
transaction: `See your transaction on etherscan.io.`,
waitingForUser: 'Waiting for your confirmation',
waitingConfirmation: 'Waiting for network confirmation, hang on',
success: 'Confirmed. You are awesome, thanks!'
}
}
function constructMessage(
transactionHash: string,
message?: { text?: string }
): string | undefined {
return transactionHash
? message?.text +
'
' +
getTransactionMessage(transactionHash).transaction
: message && message.text
}
const classes = (status: string) =>
status === 'success'
? styles.success
: status === 'error'
? styles.error
: styles.alert
export default function Alert({
transactionHash,
message
}: {
transactionHash?: string
message: { text?: string; status?: string }
}): ReactElement {
return (