mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
✨ Add back button to create account step
This commit is contained in:
@@ -24,7 +24,7 @@ export const OnboardingSteps = ({ isUpdate }: { isUpdate: boolean }) => {
|
|||||||
</Stepper.Step>
|
</Stepper.Step>
|
||||||
)}
|
)}
|
||||||
<Stepper.Step label="Your account" description="Create an account">
|
<Stepper.Step label="Your account" description="Create an account">
|
||||||
<StepCreateAccount next={nextStep} />
|
<StepCreateAccount next={nextStep} previous={prevStep} />
|
||||||
</Stepper.Step>
|
</Stepper.Step>
|
||||||
<Stepper.Step label="Docker import" description="Import applications from Docker">
|
<Stepper.Step label="Docker import" description="Import applications from Docker">
|
||||||
<StepDockerImport next={nextStep} />
|
<StepDockerImport next={nextStep} />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Button, PasswordInput, Stack, TextInput, Title } from '@mantine/core';
|
import { Button, Group, PasswordInput, Stack, TextInput, Title } from '@mantine/core';
|
||||||
import { useForm } from '@mantine/form';
|
import { useForm } from '@mantine/form';
|
||||||
|
import { IconArrowLeft, IconArrowRight } from '@tabler/icons-react';
|
||||||
import { signIn } from 'next-auth/react';
|
import { signIn } from 'next-auth/react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
@@ -9,7 +10,13 @@ import { signUpFormSchema } from '~/validations/user';
|
|||||||
|
|
||||||
import { OnboardingStepWrapper } from './common-wrapper';
|
import { OnboardingStepWrapper } from './common-wrapper';
|
||||||
|
|
||||||
export const StepCreateAccount = ({ next }: { next: () => void }) => {
|
export const StepCreateAccount = ({
|
||||||
|
previous,
|
||||||
|
next,
|
||||||
|
}: {
|
||||||
|
previous: () => void;
|
||||||
|
next: () => void;
|
||||||
|
}) => {
|
||||||
const [isSigninIn, setIsSigninIn] = useState(false);
|
const [isSigninIn, setIsSigninIn] = useState(false);
|
||||||
const { mutateAsync } = api.user.createOwnerAccount.useMutation();
|
const { mutateAsync } = api.user.createOwnerAccount.useMutation();
|
||||||
const { i18nZodResolver } = useI18nZodResolver();
|
const { i18nZodResolver } = useI18nZodResolver();
|
||||||
@@ -43,14 +50,13 @@ export const StepCreateAccount = ({ next }: { next: () => void }) => {
|
|||||||
<Title order={2} align="center" mb="md">
|
<Title order={2} align="center" mb="md">
|
||||||
Create your administrator account
|
Create your administrator account
|
||||||
</Title>
|
</Title>
|
||||||
<form
|
<form onSubmit={form.onSubmit(handleSubmit)}>
|
||||||
onSubmit={form.onSubmit(handleSubmit)}
|
|
||||||
>
|
|
||||||
<Stack>
|
<Stack>
|
||||||
<TextInput
|
<TextInput
|
||||||
size="md"
|
size="md"
|
||||||
w="100%"
|
w="100%"
|
||||||
label="Username"
|
label="Username"
|
||||||
|
variant="filled"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
{...form.getInputProps('username')}
|
{...form.getInputProps('username')}
|
||||||
/>
|
/>
|
||||||
@@ -59,6 +65,7 @@ export const StepCreateAccount = ({ next }: { next: () => void }) => {
|
|||||||
size="md"
|
size="md"
|
||||||
w="100%"
|
w="100%"
|
||||||
label="Password"
|
label="Password"
|
||||||
|
variant="filled"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
{...form.getInputProps('password')}
|
{...form.getInputProps('password')}
|
||||||
/>
|
/>
|
||||||
@@ -67,12 +74,23 @@ export const StepCreateAccount = ({ next }: { next: () => void }) => {
|
|||||||
size="md"
|
size="md"
|
||||||
w="100%"
|
w="100%"
|
||||||
label="Confirm password"
|
label="Confirm password"
|
||||||
|
variant="filled"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
{...form.getInputProps('passwordConfirmation')}
|
{...form.getInputProps('passwordConfirmation')}
|
||||||
/>
|
/>
|
||||||
<Button disabled={!form.isValid()} mt="sm" fullWidth type="submit" loading={isSigninIn}>
|
<Group grow>
|
||||||
|
<Button onClick={previous} leftIcon={<IconArrowLeft size="0.9rem" />} variant="default">
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
rightIcon={<IconArrowRight size="0.9rem" />}
|
||||||
|
disabled={!form.isValid()}
|
||||||
|
type="submit"
|
||||||
|
loading={isSigninIn}
|
||||||
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</form>
|
</form>
|
||||||
</OnboardingStepWrapper>
|
</OnboardingStepWrapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user