diff --git a/backend/package.json b/backend/package.json index 084b4118d..62c259d96 100644 --- a/backend/package.json +++ b/backend/package.json @@ -8,7 +8,9 @@ "scripts": { "lint:type": "npx tsc --noEmit", "lint:js": "npx eslint \"src/**/*.ts\"", + "lint:js:fix": "npx eslint --fix \"src/**/*.ts\"", "lint": "npm run lint:type && npm run lint:js", + "lint:fix": "npm run lint:type && npm run lint:js:fix", "start:dev": "nodemon --exec tsx src/index.ts", "migrate:dev": "node --loader ts-paths-esm-loader ../node_modules/knex/bin/cli.js migrate:latest", "migrate:dev:make": "node --loader ts-paths-esm-loader ../node_modules/knex/bin/cli.js migrate:make -x ts", diff --git a/frontend/package.json b/frontend/package.json index 25983088a..159e25561 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,8 +9,10 @@ "scripts": { "lint:css": "npx stylelint \"src/**/*.scss\" --aei", "lint:js": "npx eslint \"src/**/*.{ts,tsx}\"", + "lint:js:fix": "npx eslint --fix \"src/**/*.{ts,tsx}\"", "lint:type": "npx tsc --noEmit", "lint": "npm run lint:type && npm run lint:js", + "lint:fix": "npm run lint:type && npm run lint:js:fix", "start:dev": "vite", "build": "tsc -p tsconfig.build.json && vite build", "preview": "vite preview" diff --git a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts index 219f8854a..bee02e2d4 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts +++ b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts @@ -1,8 +1,10 @@ import { type UserSignUpRequestDto } from '~/bundles/users/users.js'; const DEFAULT_SIGN_UP_PAYLOAD: UserSignUpRequestDto = { + name: '', email: '', password: '', + confirmPassword: '', }; export { DEFAULT_SIGN_UP_PAYLOAD }; diff --git a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx index 82d4620d0..d0a791e17 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx +++ b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx @@ -1,17 +1,25 @@ +import { UserValidationMessage } from 'shared/src/bundles/users/users.js'; + import { Box, Button, FormProvider, - Heading, Input, + Link, VStack, } from '~/bundles/common/components/components.js'; -import { useAppForm } from '~/bundles/common/hooks/hooks.js'; +import { AppRoute, DataStatus } from '~/bundles/common/enums/enums.js'; +import { + useAppForm, + useAppSelector, + useMemo, +} from '~/bundles/common/hooks/hooks.js'; import { type UserSignUpRequestDto, userSignUpValidationSchema, } from '~/bundles/users/users.js'; +import { FormError, FormHeader, PasswordInput } from '../common/components.js'; import { DEFAULT_SIGN_UP_PAYLOAD } from './constants/constants.js'; type Properties = { @@ -19,34 +27,73 @@ type Properties = { }; const SignUpForm: React.FC = ({ onSubmit }) => { + const { dataStatus } = useAppSelector(({ auth }) => ({ + dataStatus: auth.dataStatus, + })); const form = useAppForm({ initialValues: DEFAULT_SIGN_UP_PAYLOAD, validationSchema: userSignUpValidationSchema, onSubmit, }); - const { handleSubmit } = form; + const { handleSubmit, errors, values } = form; + + const isEmpty = useMemo( + () => Object.values(values).some((value) => value.trim().length === 0), + [values], + ); return ( - - Sign Up - + + + Already registerd?{' '} + + Log In + + + } + />
+ - + + +