diff --git a/src/components/Jam.tsx b/src/components/Jam.tsx index db08bc57..0b567fb9 100644 --- a/src/components/Jam.tsx +++ b/src/components/Jam.tsx @@ -14,11 +14,10 @@ import ToggleSwitch from './ToggleSwitch' import Sprite from './Sprite' import Balance from './Balance' import ScheduleProgress from './ScheduleProgress' +import { ConfirmModal, ConfirmModalProps } from './Modal' import FeeConfigModal from './settings/FeeConfigModal' - -import styles from './Jam.module.css' import { useFeeConfigValues } from '../hooks/Fees' -import SchedulerConfirmationModal from './SchedulerConfirmationModal' +import styles from './Jam.module.css' const DEST_ADDRESS_COUNT_PROD = 3 const DEST_ADDRESS_COUNT_TEST = 1 @@ -144,6 +143,17 @@ function SchedulerSuccessMessage({ schedule, onConfirm }: SchedulerSuccessMessag ) } +type ScheduleConfirmModalProps = Omit + +function ScheduleConfirmModal(props: ScheduleConfirmModalProps) { + const { t } = useTranslation() + return ( + + {t('scheduler.confirm_modal.body')} + + ) +} + interface JamProps { wallet: CurrentWallet } @@ -165,6 +175,7 @@ export default function Jam({ wallet }: JamProps) { const [lastKnownSchedule, resetLastKnownSchedule] = useLatestTruthy(currentSchedule ?? undefined) const [isShowSuccessMessage, setIsShowSuccessMessage] = useState(false) const [feeConfigValues, reloadFeeConfigValues] = useFeeConfigValues() + const [showScheduleConfirmModal, setShowScheduleConfirmModal] = useState(false) const maxFeesConfigMissing = useMemo( () => feeConfigValues && (feeConfigValues.max_cj_fee_abs === undefined || feeConfigValues.max_cj_fee_rel === undefined), @@ -283,6 +294,7 @@ export default function Jam({ wallet }: JamProps) { } setAlert(undefined) + setShowScheduleConfirmModal(false) setIsWaitingSchedulerStart(true) const destinations = addressValueKeys(addressCount).map((key) => values[key]) @@ -536,7 +548,21 @@ export default function Jam({ wallet }: JamProps) { })}

{t('scheduler.description_fees')}

- setShowScheduleConfirmModal(true)} + > +
+ {t('scheduler.button_start')} + +
+ + setShowScheduleConfirmModal(false)} onConfirm={handleSubmit} disabled={isOperationDisabled || isSubmitting || !isValid} /> diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 0a1c6062..17e2eb20 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -69,7 +69,7 @@ const InfoModal = ({ ) } -export type ConfirmModalProps = BaseModalProps & { +export type ConfirmModalProps = Omit & { onConfirm: () => void disabled?: boolean } diff --git a/src/components/SchedulerConfirmationModal.module.css b/src/components/SchedulerConfirmationModal.module.css deleted file mode 100644 index 0cedc259..00000000 --- a/src/components/SchedulerConfirmationModal.module.css +++ /dev/null @@ -1,21 +0,0 @@ -.modalHeader { - display: flex !important; - justify-content: flex-start !important; - background-color: transparent !important; - padding: 1.25rem !important; -} - -.modalTitle { - width: 100%; - font-size: 1rem !important; - font-weight: 400 !important; - color: var(--bs-body-color) !important; - display: flex; - justify-content: space-between; - align-items: center; -} - -.modalBody { - color: var(--bs-body-color) !important; - text-align: left !important; -} diff --git a/src/components/SchedulerConfirmationModal.tsx b/src/components/SchedulerConfirmationModal.tsx deleted file mode 100644 index 30682620..00000000 --- a/src/components/SchedulerConfirmationModal.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import * as rb from 'react-bootstrap' -import styles from './SchedulerConfirmationModal.module.css' -import { useState } from 'react' -import Sprite from './Sprite' -import { useTranslation } from 'react-i18next' -import { ConfirmModal } from './Modal' - -interface SchedulerConfirmationModalProps { - onConfirm: () => void - disabled: boolean -} - -export default function SchedulerConfirmationModal({ onConfirm, disabled }: SchedulerConfirmationModalProps) { - const { t } = useTranslation() - const [show, setShow] = useState(false) - - const handleClose = () => setShow(false) - const handleShow = () => setShow(true) - - return ( - <> - -
- {t('scheduler.button_start')} - -
-
- - -
{t('scheduler.confirm_modal.body')}
-
- - ) -} diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 6acf6c31..fbb7a2d7 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -663,7 +663,7 @@ }, "confirm_modal": { "title": "Start Scheduled Sweep", - "body": "Are you sure you want to start the scheduled sweep?" + "body": "Are you sure you want to start a scheduled sweep?" } }, "modal": {