diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx
new file mode 100644
index 00000000..5ebb9f5e
--- /dev/null
+++ b/src/app/login/page.tsx
@@ -0,0 +1,17 @@
+import { Icon } from '@/components/icon';
+import { LoginForm } from '@/components/pages/login';
+import { AuthSwitch } from '@/components/shared';
+
+const LoginPage = () => {
+ return (
+
+ );
+};
+
+export default LoginPage;
diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx
new file mode 100644
index 00000000..20aca9bb
--- /dev/null
+++ b/src/app/signup/page.tsx
@@ -0,0 +1,17 @@
+import { Icon } from '@/components/icon';
+import { SignupForm } from '@/components/pages/signup';
+import { AuthSwitch } from '@/components/shared';
+
+const SignupPage = () => {
+ return (
+
+ );
+};
+
+export default SignupPage;
diff --git a/src/components/pages/login/login-form/index.tsx b/src/components/pages/login/login-form/index.tsx
index 774326fa..22689bdd 100644
--- a/src/components/pages/login/login-form/index.tsx
+++ b/src/components/pages/login/login-form/index.tsx
@@ -1,12 +1,17 @@
'use client';
-import { useForm } from '@tanstack/react-form';
+import { type AnyFieldApi, useForm } from '@tanstack/react-form';
import { FormInput } from '@/components/shared';
import { Button } from '@/components/ui';
import { loginSchema } from '@/lib/schema/auth';
-const getHintMessage = (errors: unknown[], isTouched: boolean, submissionAttempts: number) => {
+const getHintMessage = (field: AnyFieldApi) => {
+ const {
+ meta: { errors, isTouched },
+ } = field.state;
+ const { submissionAttempts } = field.form.state;
+
const firstError = errors[0] as { message?: string } | undefined;
const showError = isTouched || submissionAttempts > 0;
@@ -40,10 +45,7 @@ export const LoginForm = () => {
{(field) => {
- const {
- meta: { errors, isTouched },
- } = field.state;
- const hintMessage = getHintMessage(errors, isTouched, form.state.submissionAttempts);
+ const hintMessage = getHintMessage(field);
return (
{
{(field) => {
- const {
- meta: { errors, isTouched },
- } = field.state;
- const hintMessage = getHintMessage(errors, isTouched, form.state.submissionAttempts);
+ const hintMessage = getHintMessage(field);
return (
{
selector={(state) => ({
canSubmit: state.canSubmit,
isSubmitting: state.isSubmitting,
+ isPristine: state.isPristine,
})}
>
- {({ canSubmit, isSubmitting }) => {
- const disabled = !canSubmit || isSubmitting;
+ {({ canSubmit, isSubmitting, isPristine }) => {
+ const disabled = !canSubmit || isSubmitting || isPristine;
return (
-