)}
)
}
function DonationBox(props: { user?: User | null }) {
const { user } = props
const [amount, setAmount] = useState()
const [isSubmitting, setIsSubmitting] = useState(false)
const [error, setError] = useState()
const donateDisabled = isSubmitting || !amount || error
const onSubmit: React.FormEventHandler = async (e) => {
e.preventDefault()
setIsSubmitting(true)
setError(undefined)
await transact({
amount,
// TODO hardcode in Manifold Markets official account.
// Or should we just have it go into a void?
toId: 'igi2zGXsfxYPgB0DJTXVJVmwCOr2', // akrolsmir@gmail in Dev env
category: 'TO_CHARITY',
description: `${user?.name} donated M$ ${amount} to wellgive`,
txnData: {
charityId: 'wellgive', // TODO fill in
},
})
setIsSubmitting(false)
setAmount(undefined)
}
return (