1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-29 00:57:50 +02:00

Adding connect wallet button to submit page

This commit is contained in:
Jamie Hewitt 2022-04-06 15:52:55 +03:00
parent fc2681231b
commit e24de81b65

View File

@ -5,6 +5,7 @@ import { FormikContextType, useFormikContext } from 'formik'
import { FormPublishData } from '../_types'
import { wizardSteps } from '../_constants'
import SuccessConfetti from '@shared/SuccessConfetti'
import { useWeb3 } from '../../../@context/Web3'
export default function Actions({
scrollToRef,
@ -21,6 +22,15 @@ export default function Actions({
setFieldValue
}: FormikContextType<FormPublishData> = useFormikContext()
const { connect } = useWeb3()
async function handleActivation(e: FormEvent<HTMLButtonElement>) {
// prevent accidentially submitting a form the button might be in
e.preventDefault()
await connect()
}
function handleNext(e: FormEvent) {
e.preventDefault()
setFieldValue('user.stepCurrent', values.user.stepCurrent + 1)
@ -65,6 +75,10 @@ export default function Actions({
>
Continue
</Button>
) : values.user.accountId === '' || !isValid ? (
<Button type="submit" style="primary" onClick={handleActivation}>
Connect Wallet
</Button>
) : (
<Button
type="submit"