import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Grid, Typography, ToggleButtonGroup, ToggleButton } from '@mui/material'; import currencies from '../../../../static/assets/currencies.json'; import { type Order, type Settings } from '../../../models'; import { pn } from '../../../utils'; import { Bolt, Link } from '@mui/icons-material'; import { LightningPayoutForm, type LightningForm, OnchainPayoutForm, type OnchainForm, } from '../Forms'; interface PayoutPrompProps { order: Order; onClickSubmitInvoice: (invoice: string) => void; lightning: LightningForm; loadingLightning: boolean; setLightning: (state: LightningForm) => void; onClickSubmitAddress: () => void; onchain: OnchainForm; setOnchain: (state: OnchainForm) => void; loadingOnchain: boolean; settings: Settings; } export const PayoutPrompt = ({ order, onClickSubmitInvoice, loadingLightning, lightning, setLightning, onClickSubmitAddress, loadingOnchain, onchain, setOnchain, settings, }: PayoutPrompProps): React.JSX.Element => { const { t } = useTranslation(); const currencyCode: string = currencies[`${order.currency}`]; const [tab, setTab] = useState<'lightning' | 'onchain'>('lightning'); return ( {t( 'Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.', { amountFiat: pn( parseFloat( parseFloat( order.currency === 1000 ? order.amount * 100000000 : order.amount, ).toFixed(4), ), ), currencyCode: order.currency === 1000 ? 'Sats' : currencyCode, }, )} { setTab(value == null ? tab : value); }} >
{t('Lightning')}
{t('Onchain')}
{/* ONCHAIN PAYOUT TAB */}
); }; export default PayoutPrompt;