From 66ff0f08ae8a6afa17f647c7c554f29279454f1d Mon Sep 17 00:00:00 2001 From: Ryan Salazar Date: Fri, 8 May 2026 18:28:41 +0000 Subject: [PATCH] add client login page for PR Firms --- src/app/client-login/page.tsx | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/app/client-login/page.tsx diff --git a/src/app/client-login/page.tsx b/src/app/client-login/page.tsx new file mode 100644 index 0000000..76acfa1 --- /dev/null +++ b/src/app/client-login/page.tsx @@ -0,0 +1,105 @@ +'use client'; + +import { useState } from 'react'; +import { useRouter } from 'next/navigation'; + +export default function ClientLoginPage() { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [error, setError] = useState(''); + const [loading, setLoading] = useState(false); + const router = useRouter(); + + const handleLogin = async (e: React.FormEvent) => { + e.preventDefault(); + setError(''); + setLoading(true); + + try { + // Call WP auth endpoint + const res = await fetch('/api/auth/wp-login', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ email, password }), + }); + + const data = await res.json(); + + if (!res.ok) { + setError(data.error || 'Login failed'); + return; + } + + // Redirect to contributor dashboard + router.push('/contributor'); + } catch (err: any) { + setError(err.message || 'An error occurred'); + } finally { + setLoading(false); + } + }; + + return ( +
+
+
+

Broadcast Beat

+

Contributor Portal

+
+ +
+ {error && ( +
+ {error} +
+ )} + +
+ + setEmail(e.target.value)} + required + className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent" + placeholder="you@example.com" + /> +
+ +
+ + setPassword(e.target.value)} + required + className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent" + placeholder="••••••••" + /> +
+ + +
+ +
+

+ New contributor?{' '} + + Register here + +

+
+
+
+ ); +}