- Home
+ Főoldal
) : (
- Home
+ Főoldal
)}
- Contact
+ Kapcsolat
{!isLoggedIn && (
diff --git a/SerpentRace_Frontend/src/components/Toastify/toastifyServices.jsx b/SerpentRace_Frontend/src/components/Toastify/toastifyServices.jsx
new file mode 100644
index 00000000..518679ed
--- /dev/null
+++ b/SerpentRace_Frontend/src/components/Toastify/toastifyServices.jsx
@@ -0,0 +1,165 @@
+import { toast, ToastContainer, Bounce } from "react-toastify";
+import "react-toastify/dist/ReactToastify.css";
+
+/**
+ * 🔧 Ezt csak egyszer kell betenni az App.jsx-be!
+ *
= az a komponens, ami kirendereli a toastokat
+ */
+export const ToastConfig = () => (
+
+);
+
+/**
+ * 🦄 Alapértelmezett toast üzenet (semleges)
+ * notify("Üzenet szövege")
+ */
+export const notify = (message) => {
+ toast(message, {
+ position: "bottom-right",
+ autoClose: 5000,
+ hideProgressBar: false,
+ closeOnClick: false,
+ pauseOnHover: true,
+ draggable: true,
+ theme: "light",
+ transition: Bounce,
+ });
+};
+
+/**
+ * ✅ Sikeres művelethez
+ * notifySuccess("Sikeres mentés!")
+ */
+export const notifySuccess = (message) => {
+ toast.success(message, {
+ position: "bottom-right",
+ autoClose: 4000,
+ theme: "light",
+ transition: Bounce,
+ });
+};
+
+/**
+ * ❌ Hibás művelethez
+ * notifyError("Hiba történt a mentés során!")
+ */
+export const notifyError = (message) => {
+ toast.error(message, {
+ position: "bottom-right",
+ autoClose: 5000,
+ theme: "light",
+ transition: Bounce,
+ });
+};
+
+/**
+ * ℹ️ Információs üzenethez
+ * notifyInfo("Friss adatok betöltve!")
+ */
+export const notifyInfo = (message) => {
+ toast.info(message, {
+ position: "bottom-right",
+ autoClose: 4000,
+ theme: "light",
+ transition: Bounce,
+ });
+};
+
+/**
+ * ⚠️ Figyelmeztetéshez
+ * notifyWarning("Figyelem! Nem mentett módosítások vannak!")
+ */
+export const notifyWarning = (message) => {
+ toast.warn(message, {
+ position: "bottom-right",
+ autoClose: 4000,
+ theme: "light",
+ transition: Bounce,
+ });
+};
+
+
+
+
+
+// import React, { useState } from "react";
+// import { notifyWarning } from "../../components/Toastify/toastifyServices";
+
+// function AuthLogin() {
+// const [email, setEmail] = useState("");
+// const [password, setPassword] = useState("");
+
+// const handleLogin = async (e) => {
+// e.preventDefault();
+
+// // Példa jelszó ellenőrzés logikára:
+// if (password !== "titkosjelszo123") {
+// notifyWarning("⚠️ Hibás jelszó! Kérlek próbáld újra.");
+// return;
+// }
+
+// // Ha jó a jelszó:
+// notifySuccess("✅ Sikeres bejelentkezés!");
+// };
+
+// return (
+//
+// );
+// }
+
+// export default AuthLogin;
+
+
+
+// meghivas
+// import { toast } from "react-toastify";
+
+// // 🔔 Alap toast
+// export const notify = (msg) => toast(msg);
+
+// // ✅ Sikeres üzenet
+// export const notifySuccess = (msg) => toast.success(msg);
+
+// // ⚠️ Figyelmeztetés
+// export const notifyWarning = (msg) => toast.warning(msg);
+
+// // ❌ Hiba
+// export const notifyError = (msg) => toast.error(msg);
+
+// // ℹ️ Információ
+// export const notifyInfo = (msg) => toast.info(msg);
+
+
+
+// hasznalat
+// import { notifyWarning } from "../../components/Toastify/toastifyServices";
+
+// if (password !== "titkos") {
+// notifyWarning("⚠️ Hibás jelszó!");
+// }
diff --git a/SerpentRace_Frontend/src/pages/Auth/LoginForm.jsx b/SerpentRace_Frontend/src/pages/Auth/LoginForm.jsx
index 6aa74060..308f76a0 100644
--- a/SerpentRace_Frontend/src/pages/Auth/LoginForm.jsx
+++ b/SerpentRace_Frontend/src/pages/Auth/LoginForm.jsx
@@ -1,12 +1,11 @@
// src/pages/Auth/LoginForm.jsx
-// Bejelentkezési űrlap
-
import InputBox from "../../components/Inputs/InputBox"
import Button from "../../components/Buttons/Button"
import { motion } from "framer-motion"
import { useState, useEffect } from "react"
import { useLocation, useNavigate } from "react-router-dom"
import { login } from "../../api/userApi"
+import { FaArrowLeft } from "react-icons/fa"
export default function LoginForm() {
const [email, setEmail] = useState("")
@@ -32,23 +31,23 @@ export default function LoginForm() {
e.preventDefault()
setError("")
setShowErrorPopup(false)
+
if (!email || !password) {
setError("Minden mező kitöltése kötelező.")
setShowErrorPopup(true)
setTimeout(() => setShowErrorPopup(false), 2000)
return
}
+
if (!validateEmail(email)) {
setError("Hibás email formátum.")
setShowErrorPopup(true)
setTimeout(() => setShowErrorPopup(false), 2000)
return
}
- // Backend API
+
login(email, password)
.then((response) => {
- console.log(response)
- // Csak a response.status-t ellenőrizd!
if (response && response.status === 200) {
if (response.data && response.data.user) {
localStorage.setItem("username", response.data.user.username)
@@ -61,7 +60,7 @@ export default function LoginForm() {
setTimeout(() => setShowErrorPopup(false), 2000)
}
})
- .catch((error) => {
+ .catch(() => {
setError("Hibás bejelentkezési adatok.")
setShowErrorPopup(true)
setTimeout(() => setShowErrorPopup(false), 2000)
@@ -75,18 +74,35 @@ export default function LoginForm() {
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.25 }}
+ className="relative flex flex-col items-center"
>
-
Bejelentkezés
+ {/* 🔙 Vissza nyíl gomb — most pontosan a fehér box bal felső sarkában */}
+
navigate("/")}
+ >
+
+
+ Vissza a főoldalra
+
+
+
+
+ Bejelentkezés
+
+
{showSuccess && (
Sikeres regisztráció! Az email ellenőrzése után be tudsz lépni.
)}
+
{showErrorPopup && error && (
{error}
)}
+