2021-11-23 18:46:33 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
|
|
import { useTransactionModalContext } from '../../../contexts/transaction-modal';
|
|
|
|
import Box from '../../ui/box';
|
|
|
|
import Popover from '../../ui/popover';
|
|
|
|
|
2021-12-06 19:47:26 +01:00
|
|
|
import { AdvancedGasFeePopoverContextProvider } from './context';
|
2021-11-29 18:40:48 +01:00
|
|
|
import AdvancedGasFeeInputs from './advanced-gas-fee-inputs';
|
2021-12-03 16:59:48 +01:00
|
|
|
import AdvancedGasFeeGasLimit from './advanced-gas-fee-gas-limit';
|
2021-12-01 01:31:21 +01:00
|
|
|
import AdvancedGasFeeSaveButton from './advanced-gas-fee-save';
|
2021-12-21 20:45:28 +01:00
|
|
|
import AdvancedGasFeeDefaults from './advanced-gas-fee-defaults';
|
2021-11-29 18:40:48 +01:00
|
|
|
|
2021-11-23 18:46:33 +01:00
|
|
|
const AdvancedGasFeePopover = () => {
|
|
|
|
const t = useI18nContext();
|
2021-11-29 18:40:48 +01:00
|
|
|
const {
|
|
|
|
closeAllModals,
|
2022-01-06 03:47:26 +01:00
|
|
|
closeModal,
|
2021-11-29 18:40:48 +01:00
|
|
|
currentModal,
|
|
|
|
} = useTransactionModalContext();
|
2021-11-23 18:46:33 +01:00
|
|
|
|
2022-01-06 23:56:51 +01:00
|
|
|
if (currentModal !== 'advancedGasFee') {
|
|
|
|
return null;
|
|
|
|
}
|
2021-11-23 18:46:33 +01:00
|
|
|
|
|
|
|
return (
|
2021-12-06 19:47:26 +01:00
|
|
|
<AdvancedGasFeePopoverContextProvider>
|
2021-12-01 01:31:21 +01:00
|
|
|
<Popover
|
|
|
|
className="advanced-gas-fee-popover"
|
|
|
|
title={t('advancedGasFeeModalTitle')}
|
|
|
|
onBack={() => closeModal('advancedGasFee')}
|
|
|
|
onClose={closeAllModals}
|
|
|
|
footer={<AdvancedGasFeeSaveButton />}
|
|
|
|
>
|
2021-12-21 20:45:28 +01:00
|
|
|
<Box margin={4}>
|
2021-12-01 01:31:21 +01:00
|
|
|
<AdvancedGasFeeInputs />
|
2021-12-03 16:59:48 +01:00
|
|
|
<div className="advanced-gas-fee-popover__separator" />
|
2021-12-21 20:45:28 +01:00
|
|
|
<AdvancedGasFeeDefaults />
|
|
|
|
<div className="advanced-gas-fee-popover__separator" />
|
2021-12-03 16:59:48 +01:00
|
|
|
<AdvancedGasFeeGasLimit />
|
2021-12-01 01:31:21 +01:00
|
|
|
</Box>
|
|
|
|
</Popover>
|
2021-12-06 19:47:26 +01:00
|
|
|
</AdvancedGasFeePopoverContextProvider>
|
2021-11-23 18:46:33 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default AdvancedGasFeePopover;
|