diff --git a/package-lock.json b/package-lock.json index 03357af..5564781 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "file-saver": "^2.0.5", "jspdf": "^3.0.3", "jspdf-autotable": "^5.0.2", + "lucide-react": "^0.545.0", "react": "^19.1.0", "react-chartjs-2": "^5.3.0", "react-dom": "^19.1.0", @@ -3571,6 +3572,15 @@ "dev": true, "license": "ISC" }, + "node_modules/lucide-react": { + "version": "0.545.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.545.0.tgz", + "integrity": "sha512-7r1/yUuflQDSt4f1bpn5ZAocyIxcTyVyBBChSVtBKn5M+392cPmI5YJMWOJKk/HUWGm5wg83chlAZtCcGbEZtw==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/magic-string": { "version": "0.30.17", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", diff --git a/package.json b/package.json index 302a8f6..a646710 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "file-saver": "^2.0.5", "jspdf": "^3.0.3", "jspdf-autotable": "^5.0.2", + "lucide-react": "^0.545.0", "react": "^19.1.0", "react-chartjs-2": "^5.3.0", "react-dom": "^19.1.0", diff --git a/src/assets/img/TaskSphereLogo.png b/src/assets/img/TaskSphereLogo.png new file mode 100644 index 0000000..a0d3be8 Binary files /dev/null and b/src/assets/img/TaskSphereLogo.png differ diff --git a/src/components/Signin.jsx b/src/components/Signin.jsx index 5888f72..8a150fd 100644 --- a/src/components/Signin.jsx +++ b/src/components/Signin.jsx @@ -1,10 +1,8 @@ -// src/components/Signin.jsx import React, { useState, useEffect } from "react"; import { useNavigate, useLocation, useOutletContext } from "react-router-dom"; import Swal from "sweetalert2"; -import "../components/Style/Style.css"; -import Logo1 from "../assets/img/Dct-Logo.png"; -import Logo2 from "../assets/img/Costum.png"; +import Logo1 from "../assets/img/TaskSphereLogo.png"; +import Logo2 from "../assets/img/Dct-Logo.png"; import { supabase } from "../supabaseClient"; import { UserAuth } from "../Contex/AuthContext"; import SigninHead from "./heade-foot/SigninHead"; @@ -20,13 +18,21 @@ const Signin = () => { const { setIsLoggedIn } = useOutletContext(); const { login } = UserAuth(); - // ===================================================== - // 🚫 Route Guard (Trap user inside /Signin) - // ===================================================== + // Hard lock page scroll (belt-and-suspenders) useEffect(() => { - const storedUser = localStorage.getItem("customUser"); + const prevDoc = document.documentElement.style.overflow; + const prevBody = document.body.style.overflow; + document.documentElement.style.overflow = "hidden"; + document.body.style.overflow = "hidden"; + return () => { + document.documentElement.style.overflow = prevDoc; + document.body.style.overflow = prevBody; + }; + }, []); - // 🔹 If user is logged in, redirect to their dashboard + // Route guard + useEffect(() => { + const storedUser = localStorage.getItem("customUser"); if (storedUser) { const user = JSON.parse(storedUser); const roleRoutes = { @@ -37,27 +43,16 @@ const Signin = () => { }; navigate(roleRoutes[user.user_roles] || "/Signin", { replace: true }); } else { - // 🔹 If user is not logged in, trap them inside /Signin - const allowedPaths = ["/", "/Signin", "/signin"]; - if (!allowedPaths.includes(location.pathname)) { - navigate("/Signin", { replace: true }); - } - - // Disable back/forward navigation + const allowed = ["/", "/Signin", "/signin"]; + if (!allowed.includes(location.pathname)) navigate("/Signin", { replace: true }); window.history.pushState(null, "", window.location.href); - window.onpopstate = () => { - window.history.pushState(null, "", window.location.href); - }; + window.onpopstate = () => window.history.pushState(null, "", window.location.href); } }, [location, navigate]); - // ===================================================== - // 🔹 Handle Sign In - // ===================================================== const handleSignIn = async (e) => { e.preventDefault(); setLoading(true); - try { const { data: user, error } = await supabase .from("user_credentials") @@ -67,27 +62,15 @@ const Signin = () => { .single(); if (error || !user) { - Swal.fire({ - icon: "error", - title: "Login failed", - text: "Invalid credentials. Please try again.", - }); + Swal.fire({ icon: "error", title: "Login failed", text: "Invalid credentials. Please try again." }); return; } - // ✅ Save to context + localStorage login(user); localStorage.setItem("customUser", JSON.stringify(user)); localStorage.setItem("user_id", user.user_id); setIsLoggedIn(true); - console.log("✅ User signed in:", { - user_id: user.user_id, - uuid: user.id, - role: user.user_roles, - }); - - // 🔹 Role-based navigation const roleRoutes = { 1: { path: "/Manager", label: "Manager" }, 2: { path: "/Member", label: "Member" }, @@ -106,107 +89,115 @@ const Signin = () => { }); navigate(target.path); } else { - Swal.fire({ - icon: "warning", - title: "Unknown role", - text: "Please contact the administrator.", - }); + Swal.fire({ icon: "warning", title: "Unknown role", text: "Please contact the administrator." }); } } catch (err) { - Swal.fire({ - icon: "error", - title: "Server Error", - text: "Something went wrong. Please try again later.", - }); + Swal.fire({ icon: "error", title: "Server Error", text: "Something went wrong. Please try again later." }); console.error("❌ SignIn Error:", err.message); } finally { setLoading(false); } }; + useEffect(() => { - const storedUser = localStorage.getItem("customUser"); - if (storedUser) { - const user = JSON.parse(storedUser); - const roleRoutes = { - 1: "/Manager/Dashboard", - 2: "/Member/Dashboard", - 3: "/Adviser/Dashboard", - 4: "/Instructor/Dashboard", - }; - navigate(roleRoutes[user.user_roles] || "/Signin", { replace: true }); - } -}, []); + const storedUser = localStorage.getItem("customUser"); + if (storedUser) { + const user = JSON.parse(storedUser); + const roleRoutes = { + 1: "/Manager/Dashboard", + 2: "/Member/Dashboard", + 3: "/Adviser/Dashboard", + 4: "/Instructor/Dashboard", + }; + navigate(roleRoutes[user.user_roles] || "/Signin", { replace: true }); + } + }, [navigate]); - // ===================================================== - // 🔹 UI - // ===================================================== return ( -
+ // Lock the page height; no scroll +
-
-
-
-

Welcome to TaskSphere IT

- Logo -
- - setUserID(e.target.value)} - value={userID} - className="w-full p-3 border rounded" - type="text" - id="userID" - placeholder="Enter your ID number" - required - /> -
- -
- - setPassword(e.target.value)} - value={password} - className="w-full p-3 border rounded" - type="password" - id="password" - placeholder="Enter your password" - required - /> -
- + {/* Main fills remaining height; internal overflow hidden */} +
+
+
+ {/* Left: taller login card */} +
+
+

+ Welcome to +
+ TaskSphere IT +

+ + TaskSphere icon + + +
+ + setUserID(e.target.value)} + className="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-black outline-none focus:border-[#611A11] focus:ring-1 focus:ring-[#611A11]" + required + /> +
+ +
+ + setPassword(e.target.value)} + className="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-black outline-none focus:border-[#611A11] focus:ring-1 focus:ring-[#611A11]" + required + /> +
+ +
+
+ + +
- - -
- -
-

- Empowering Collaboration, -
- Streamlining IT Capstone Success. -

- Team + {/* Right: seal + headline */} +
+ CCS Seal +

+ A Task Management System for +
+ Capstone Project Development +

+
+
-
+
diff --git a/src/components/Style/Style.css b/src/components/Style/Style.css index 9480bf4..95deeb5 100644 --- a/src/components/Style/Style.css +++ b/src/components/Style/Style.css @@ -10,4 +10,5 @@ } .b-rd { border-radius: 8px; -} \ No newline at end of file +} + diff --git a/src/components/heade-foot/SigninFoot.jsx b/src/components/heade-foot/SigninFoot.jsx index 5c849b9..6470ae3 100644 --- a/src/components/heade-foot/SigninFoot.jsx +++ b/src/components/heade-foot/SigninFoot.jsx @@ -1,42 +1,22 @@ -import React from 'react'; - -const Footer = () => { - return ( - <> -
- - - ); +import React from "react"; + +const SigninFoot = () => { + return ( + // Fixed footer so it doesn't add to page height +
+ {/* Full-width gradient directly above the red divider */} +
+ + {/* Red divider line (inset like your mock) */} +
+ + {/* Footer content */} +
+

©2025 TaskSphere IT - All Rights Reserved

+ Terms of Service +
+
+ ); }; - -export default Footer; \ No newline at end of file + +export default SigninFoot; diff --git a/src/components/heade-foot/SigninHead.jsx b/src/components/heade-foot/SigninHead.jsx index 75f1167..80264de 100644 --- a/src/components/heade-foot/SigninHead.jsx +++ b/src/components/heade-foot/SigninHead.jsx @@ -1,27 +1,14 @@ -// SigninHeader.jsx import React from "react"; import Logo from "../../assets/img/Logo.png"; -const SigninHeader = () => { +const SigninHead = () => { return ( -
- - Logo - -
+
+
+ TaskSphere IT +
+
); }; -export default SigninHeader; +export default SigninHead;