const { useEffect, useMemo, useState } = React; function LoginPage() { const [showPassword, setShowPassword] = useState(false); const [activeSlide, setActiveSlide] = useState(0); const [errorMessage, setErrorMessage] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [rememberEmail, setRememberEmail] = useState(false); const [touched, setTouched] = useState({ email: false, password: false }); const [isSubmitting, setIsSubmitting] = useState(false); const slides = [ { title: 'Organize every task clearly.', text: 'Plan, assign, and monitor work in one centralized task management system.' }, { title: 'Track progress with confidence.', text: 'Stay updated on schedules, reports, inspections, and team responsibilities.' }, { title: 'Improve coordination across teams.', text: 'Build a smoother workflow with better visibility, accountability, and communication.' } ]; const isValidEmail = useMemo(() => { return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); }, [email]); const emailError = touched.email && email !== '' && !isValidEmail ? 'Please enter a valid email address.' : ''; const passwordError = touched.password && password === '' ? 'Password is required.' : ''; const canSubmit = isValidEmail && password.length > 0 && !isSubmitting; useEffect(() => { const params = new URLSearchParams(window.location.search); const error = params.get('error'); if (error === 'invalid') { setErrorMessage('Invalid email or password.'); } if (error === 'missing') { setErrorMessage('Please enter both email and password.'); } const savedEmail = localStorage.getItem('prism_saved_email'); if (savedEmail) { setEmail(savedEmail); setRememberEmail(true); } }, []); useEffect(() => { const timer = setInterval(() => { setActiveSlide((current) => (current + 1) % slides.length); }, 4500); return () => clearInterval(timer); }, [slides.length]); function handleSubmit(event) { setTouched({ email: true, password: true }); if (!isValidEmail || password.length === 0) { event.preventDefault(); setErrorMessage('Please check your email and password.'); return; } if (rememberEmail) { localStorage.setItem('prism_saved_email', email); } else { localStorage.removeItem('prism_saved_email'); } setErrorMessage(''); setIsSubmitting(true); } return (
Manage assignments, monitor progress, and keep your team aligned through a smarter workflow.
{slide.text}
Psy Systems and Innovations, OPC