import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { useZap } from '@/providers/ZapProvider' import { useState } from 'react' import { useTranslation } from 'react-i18next' export default function DefaultZapAmountInput() { const { t } = useTranslation() const { defaultZapSats, updateDefaultSats } = useZap() const [defaultZapAmountInput, setDefaultZapAmountInput] = useState(defaultZapSats) return (
{ setDefaultZapAmountInput((pre) => { if (e.target.value === '') { return 0 } let num = parseInt(e.target.value, 10) if (isNaN(num) || num < 0) { num = pre } return num }) }} onBlur={() => { updateDefaultSats(defaultZapAmountInput) }} />
) }