From 1e7160922b14b2fad8b8eaec91dc8208b0fca333 Mon Sep 17 00:00:00 2001 From: Flook Date: Mon, 10 Nov 2025 05:07:03 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=A5=E0=B9=87=E0=B8=AD?= =?UTF-8?q?=E0=B8=81=E0=B8=AD=E0=B8=B4=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/LoginForm.jsx | 138 +++++++++++++++++-------------- web/src/layouts/AuthLayout.jsx | 4 +- 2 files changed, 80 insertions(+), 62 deletions(-) diff --git a/web/src/components/LoginForm.jsx b/web/src/components/LoginForm.jsx index 6b843bd..6e0b93e 100644 --- a/web/src/components/LoginForm.jsx +++ b/web/src/components/LoginForm.jsx @@ -8,16 +8,15 @@ import { yupResolver } from '@hookform/resolvers/yup'; // นำเข้า Hook API และ Components import { useLoginMutation } from '../services/authApi'; import LandingIntro from './LandingIntro'; -import InputText from './InputText'; +import InputText from './InputText'; // ตรวจสอบ Path ให้ถูกต้อง + +import { loginSchema } from '../schemas/authSchema'; // ตรวจสอบ Path ให้ถูกต้อง -import { loginSchema } from '../schemas/authSchema'; export default function LoginForm() { - // 1. Hook สำหรับเรียก API ล็อกอิน const loginMutation = useLoginMutation(); const [apiErrorMessage, setApiErrorMessage] = useState(""); - // 2. Hook Form Setup const { register, handleSubmit, @@ -30,13 +29,11 @@ export default function LoginForm() { } }); - // 3. Form Submission Logic const onSubmit = (data) => { setApiErrorMessage(""); // เรียกใช้ Mutation (Token + Fetch User) loginMutation.mutate({ - // ส่ง 'username' และ 'password' ตรงตาม API username: data.username, password: data.password }, { @@ -49,73 +46,94 @@ export default function LoginForm() { const loading = loginMutation.isPending; return ( -
+ // Card หลัก: ปรับ bg-white, shadow, border-radius ตามสไตล์ Contabo +
+ {/* คอลัมน์ซ้าย: Intro/Features */}
-
-

เข้าสู่ระบบ DDO Console

+ {/* คอลัมน์ขวา: Form Wrapper (จัดกึ่งกลางเนื้อหา) */} +
-
+ {/* Div จำกัดความกว้างของฟอร์มจริง ๆ */} +
- {/* API Error Alert */} - {apiErrorMessage && ( -
- - {apiErrorMessage} + {/* Text: ปรับเป็นภาษาไทย */} +

ยินดีต้อนรับกลับมา

+

+ ที่นี่คุณสามารถเข้าสู่ระบบ DDO Console ได้ โปรดทราบว่าข้อมูลประจำตัวนี้อาจแตกต่างจากข้อมูลประจำตัวสำหรับระบบอื่น ๆ +

+ + + + {/* API Error Alert */} + {apiErrorMessage && ( +
+ + {apiErrorMessage} +
+ )} + +
+ {/* Username Input: เปลี่ยนเป็น 'ชื่อผู้ใช้' */} + + + {/* Password Input: เปลี่ยนเป็น 'รหัสผ่าน' */} +
- )} -
- {/* Username Input (เชื่อม RHF) */} - + {/* Checkbox และ Link ลืมรหัสผ่าน */} +
+ + + + ลืมรหัสผ่าน? + + +
- {/* Password Input (เชื่อม RHF) */} - -
+ {/* ปุ่ม Submit: ปรับสี, corner, shadow ตามสไตล์ Contabo */} + -
- - - ลืมรหัสผ่าน? - - -
+ {/* "ยังไม่มีบัญชีใช่ไหม?" */} +
+ ยังไม่มีบัญชีใช่ไหม? + + + ลงทะเบียน + + +
+ +
{/* สิ้นสุด Div จำกัดความกว้าง */} - {/* ปุ่ม Submit */} - - -
- ยังไม่มีบัญชีใช่ไหม? - - - ลงทะเบียน - - -
- -
+
{/* สิ้นสุดคอลัมน์ขวา */}
) diff --git a/web/src/layouts/AuthLayout.jsx b/web/src/layouts/AuthLayout.jsx index 8d7faac..4b8ae83 100644 --- a/web/src/layouts/AuthLayout.jsx +++ b/web/src/layouts/AuthLayout.jsx @@ -4,10 +4,10 @@ export default function AuthLayout(){ return( <> {/* 1. Div หลัก: จัดให้อยู่ตรงกลางจอ (ใช้ flex h-screen) */} -
+
{/* 2. Div ภาชนะสำหรับเนื้อหา: กำหนดขนาดสูงสุด */} -
+