2021-11-18 18:54:58 +01:00
|
|
|
import React from 'react';
|
2021-06-24 01:39:44 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2021-07-14 15:42:10 +02:00
|
|
|
|
2021-11-12 20:09:59 +01:00
|
|
|
import { useGasFeeContext } from '../../../contexts/gasFee';
|
2021-12-06 17:39:35 +01:00
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
import Box from '../../ui/box';
|
2021-07-14 15:42:10 +02:00
|
|
|
|
2021-12-06 17:39:35 +01:00
|
|
|
import EditGasFeeButton from '../edit-gas-fee-button';
|
2021-06-24 01:39:44 +02:00
|
|
|
import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component';
|
|
|
|
|
2021-11-24 18:02:53 +01:00
|
|
|
export default function TransactionDetail({
|
|
|
|
rows = [],
|
|
|
|
onEdit,
|
2021-12-12 00:26:28 +01:00
|
|
|
userAcknowledgedGasMissing = false,
|
2021-11-24 18:02:53 +01:00
|
|
|
}) {
|
2021-11-18 18:54:58 +01:00
|
|
|
const t = useI18nContext();
|
2021-12-06 17:39:35 +01:00
|
|
|
const { supportsEIP1559V2 } = useGasFeeContext();
|
2021-07-14 15:42:10 +02:00
|
|
|
|
|
|
|
return (
|
2021-07-26 17:24:44 +02:00
|
|
|
<div className="transaction-detail">
|
2021-12-06 17:39:35 +01:00
|
|
|
{supportsEIP1559V2 && (
|
|
|
|
<Box display="flex" justifyContent="flex-end" paddingTop={5}>
|
|
|
|
<EditGasFeeButton
|
|
|
|
userAcknowledgedGasMissing={userAcknowledgedGasMissing}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
)}
|
|
|
|
{!supportsEIP1559V2 && onEdit && (
|
2021-07-14 15:42:10 +02:00
|
|
|
<div className="transaction-detail-edit">
|
2021-08-17 00:45:55 +02:00
|
|
|
<button onClick={onEdit}>{t('edit')}</button>
|
2021-07-14 15:42:10 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<div className="transaction-detail-rows">{rows}</div>
|
|
|
|
</div>
|
|
|
|
);
|
2021-06-24 01:39:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TransactionDetail.propTypes = {
|
2021-12-07 17:39:44 +01:00
|
|
|
/**
|
|
|
|
* Show item content for transaction detail. Array of TransactionDetailItem components
|
|
|
|
*/
|
2021-07-14 15:42:10 +02:00
|
|
|
rows: PropTypes.arrayOf(TransactionDetailItem).isRequired,
|
2021-12-07 17:39:44 +01:00
|
|
|
/**
|
|
|
|
* onClick handler for the Edit link
|
|
|
|
*/
|
2021-07-14 15:42:10 +02:00
|
|
|
onEdit: PropTypes.func,
|
2021-12-12 00:26:28 +01:00
|
|
|
userAcknowledgedGasMissing: PropTypes.bool,
|
2021-06-24 01:39:44 +02:00
|
|
|
};
|