Skip to content

Commit

Permalink
add last step
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos-koukis committed Oct 13, 2023
1 parent 510adab commit c76e453
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/views/Home/components/NewUserForm/NewUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {

useEffect(() => {
if (!isLoadingUserInfo && userInfo?.address !== "") {
setActiveStep(3);
setActiveStep(2);
}
}, [isLoadingUserInfo, userInfo]);

Expand All @@ -62,15 +62,11 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
};

const handleNextStep = () => {
if (activeStep < steps.length - 1) {
setActiveStep(activeStep + 1);
}
setActiveStep(activeStep + 1);
};

const handlePreviousStep = () => {
if (activeStep < steps.length - 1) {
setActiveStep(activeStep - 1);
}
setActiveStep(activeStep - 1);
};

const [clickedSubmit, setClickSubmit] = useState(false);
Expand All @@ -95,7 +91,7 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
? "Create a wallet"
: index === 2
? "View the wallet"
: undefined
: 'Connect to wallet'
}
>
<Box sx={{ p: 8, bg, my: 8, rounded: "md" }}>
Expand All @@ -114,9 +110,14 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
{index === 1 && isPinFilled && (
<CreateWallet pin={pin} email={email} handleReset={handleReset} userGid={userGid} setClickSubmit={handleCreateWalletSubmit }/>
)}
{index > 1 && userInfo && !isLoadingUserInfo &&
{index === 2 && userInfo && !isLoadingUserInfo &&
<ViewWallet userInfo={userInfo} isLoadingUserInfo={isLoadingUserInfo} />
}
{index === 3 && !isLoadingUserInfo &&
<Text>
Connect
</Text>
}
</Heading>
</Box>
</Step>
Expand All @@ -128,6 +129,16 @@ function NewUserForm({ email, userGid, setClickedSubmit }: NewUserFormProps) {
Back
</Button>
)}
{activeStep > 0 && !isLastStep && (!isLoadingUserInfo) && (
<Button size="sm" onClick={() => handleNextStep()}>
Connect Wallet
</Button>
)}
{activeStep > 0 && isLastStep && (
<Button size="sm" onClick={() => handlePreviousStep()}>
Back
</Button>
)}
</Flex>
</Flex>
</Box>
Expand Down

0 comments on commit c76e453

Please sign in to comment.