mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Showing connect wallet button on submit page when no wallet is connected (#1329)
* Showing connect wallet button on submit page when no wallet is connected * Fixing connect button when form hasn't been filled out
This commit is contained in:
parent
4bd9dddf3b
commit
274d0d3809
@ -5,6 +5,7 @@ import { FormikContextType, useFormikContext } from 'formik'
|
|||||||
import { FormPublishData } from '../_types'
|
import { FormPublishData } from '../_types'
|
||||||
import { wizardSteps } from '../_constants'
|
import { wizardSteps } from '../_constants'
|
||||||
import SuccessConfetti from '@shared/SuccessConfetti'
|
import SuccessConfetti from '@shared/SuccessConfetti'
|
||||||
|
import { useWeb3 } from '../../../@context/Web3'
|
||||||
|
|
||||||
export default function Actions({
|
export default function Actions({
|
||||||
scrollToRef,
|
scrollToRef,
|
||||||
@ -20,6 +21,14 @@ export default function Actions({
|
|||||||
isSubmitting,
|
isSubmitting,
|
||||||
setFieldValue
|
setFieldValue
|
||||||
}: FormikContextType<FormPublishData> = useFormikContext()
|
}: FormikContextType<FormPublishData> = useFormikContext()
|
||||||
|
const { connect, accountId } = 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) {
|
function handleNext(e: FormEvent) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -65,13 +74,15 @@ export default function Actions({
|
|||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
|
) : !accountId ? (
|
||||||
|
<Button type="submit" style="primary" onClick={handleActivation}>
|
||||||
|
Connect Wallet
|
||||||
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
style="primary"
|
style="primary"
|
||||||
disabled={
|
disabled={isSubmitting || !isValid}
|
||||||
values.user.accountId === '' || !isValid || isSubmitting
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
Reference in New Issue
Block a user