From 274d0d380980c663f6026a434d5c510a02a441d1 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Fri, 8 Apr 2022 15:05:06 +0300 Subject: [PATCH] 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 --- src/components/Publish/Actions/index.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/Publish/Actions/index.tsx b/src/components/Publish/Actions/index.tsx index 85f739579..a400cc190 100644 --- a/src/components/Publish/Actions/index.tsx +++ b/src/components/Publish/Actions/index.tsx @@ -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, @@ -20,6 +21,14 @@ export default function Actions({ isSubmitting, setFieldValue }: FormikContextType = useFormikContext() + const { connect, accountId } = useWeb3() + + async function handleActivation(e: FormEvent) { + // prevent accidentially submitting a form the button might be in + e.preventDefault() + + await connect() + } function handleNext(e: FormEvent) { e.preventDefault() @@ -65,13 +74,15 @@ export default function Actions({ > Continue + ) : !accountId ? ( + ) : (