Spaces:
Sleeping
Sleeping
NET-DNA Researcher commited on
Commit ·
3f4aaa1
1
Parent(s): da8b900
Deploy ProFlo admin dashboard (Docker Space)
Browse filesFiles changed (3)
123456789101112131415161718192016 unmodified lines373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327"use client";import Link from "next/link";import { useRouter } from "next/navigation";import { useState } from "react";import { setAdminSession } from "../../lib/adminAuth";import { ProFloLogo } from "../components/ProFloLogo";import { apiBase } from "../../lib/api";import { ArrowRight, Lock, User, Eye, EyeOff, ShieldCheck, Sparkles, AlertCircle } from "lucide-react";export default function AdminLoginPage() {const router = useRouter();const [username, setUsername] = useState("");const [password, setPassword] = useState("");const [showPassword, setShowPassword] = useState(false);const [error, setError] = useState("");const [busy, setBusy] = useState(false);async function onSubmit(e: React.FormEvent) {e.preventDefault();16 unmodified linessetAdminSession(token, role);router.push("/admin/dashboard");} catch {setError(`Cannot reach API at ${apiBase}. Ensure backend is running.`);}setBusy(false);}function handleQuickFill(u: string, p: string) {setUsername(u);setPassword(p);setError("");}return (<mainstyle={{minHeight: "100dvh",width: "100%",display: "flex",flexDirection: "column",alignItems: "center",justifyContent: "center",padding: "16px",background: "#ffffff",color: "#0f172a",position: "relative",overflow: "hidden",fontFamily: "sans-serif",}}>{/* Main Login Card */}<divstyle={{width: "100%",maxWidth: "420px",background: "#ffffff",border: "1px solid #e2e8f0",borderRadius: "24px",padding: "28px",boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01)",position: "relative",zIndex: 10,margin: "auto",}}>{/* Brand Header */}<div style={{ display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", marginBottom: "28px" }}><divstyle={{width: "64px",height: "64px",borderRadius: "16px",background: "linear-gradient(to top right, #2563eb, #6366f1)",padding: "2px",boxShadow: "0 10px 15px -3px rgba(59, 130, 246, 0.25)",marginBottom: "16px",display: "flex",alignItems: "center",justifyContent: "center",}}><divstyle={{width: "100%",height: "100%",background: "#ffffff",borderRadius: "14px",display: "flex",alignItems: "center",justifyContent: "center",}}><ProFloLogo size={42} showText={false} /></div></div><divstyle={{display: "inline-flex",alignItems: "center",gap: "6px",padding: "4px 12px",borderRadius: "9999px",background: "rgba(59, 130, 246, 0.1)",border: "1px solid rgba(59, 130, 246, 0.2)",color: "#3b82f6",fontSize: "12px",fontWeight: 600,letterSpacing: "0.05em",textTransform: "uppercase",marginBottom: "8px",}}><ShieldCheck style={{ width: "14px", height: "14px" }} />Operations HQ</div><h1 style={{ fontSize: "24px", fontWeight: 800, color: "#0f172a", letterSpacing: "-0.02em", margin: "0" }}>Admin Sign In</h1><p style={{ fontSize: "14px", color: "#64748b", marginTop: "6px", lineHeight: 1.6, margin: "6px 0 0 0" }}>Manage catalogue, tokens & store analytics</p></div>{/* Login Form */}<form onSubmit={(e) => void onSubmit(e)} style={{ display: "flex", flexDirection: "column", gap: "16px" }}>{/* Username Field */}<div><labelhtmlFor="admin-username-input"style={{ display: "block", fontSize: "12px", fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", color: "#64748b", marginBottom: "6px" }}>Username</label><div style={{ position: "relative" }}><User style={{ position: "absolute", left: "14px", top: "50%", transform: "translateY(-50%)", width: "16px", height: "16px", color: "#94a3b8" }} /><inputid="admin-username-input"type="text"autoComplete="username"value={username}onChange={(e) => setUsername(e.target.value)}placeholder="Enter username"style={{width: "100%",height: "48px",paddingLeft: "40px",paddingRight: "16px",background: "#f8fafc",border: "1px solid #cbd5e1",borderRadius: "12px",fontSize: "14px",color: "#0f172a",outline: "none",boxSizing: "border-box",}}/></div></div>{/* Password Field */}<div><labelhtmlFor="admin-password-input"style={{ display: "block", fontSize: "12px", fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", color: "#64748b", marginBottom: "6px" }}>Password</label><div style={{ position: "relative" }}><Lock style={{ position: "absolute", left: "14px", top: "50%", transform: "translateY(-50%)", width: "16px", height: "16px", color: "#94a3b8" }} /><inputid="admin-password-input"type={showPassword ? "text" : "password"}autoComplete="current-password"value={password}onChange={(e) => setPassword(e.target.value)}placeholder="Enter password"style={{width: "100%",height: "48px",paddingLeft: "40px",paddingRight: "44px",background: "#f8fafc",border: "1px solid #cbd5e1",borderRadius: "12px",fontSize: "14px",color: "#0f172a",outline: "none",boxSizing: "border-box",}}/><buttontype="button"onClick={() => setShowPassword(!showPassword)}style={{ position: "absolute", right: "12px", top: "50%", transform: "translateY(-50%)", padding: "4px", color: "#64748b", background: "none", border: "none", cursor: "pointer" }}aria-label={showPassword ? "Hide password" : "Show password"}>{showPassword ? <EyeOff style={{ width: "16px", height: "16px" }} /> : <Eye style={{ width: "16px", height: "16px" }} />}</button></div></div>{/* Error Message */}{error ? (<div style={{ display: "flex", alignItems: "flex-start", gap: "8px", padding: "12px", borderRadius: "12px", background: "rgba(239, 68, 68, 0.1)", border: "1px solid rgba(239, 68, 68, 0.2)", color: "#ef4444", fontSize: "12px", fontWeight: 500 }}><AlertCircle style={{ width: "16px", height: "16px", flexShrink: 0, marginTop: "2px" }} /><span>{error}</span></div>) : null}{/* Submit Button */}<buttontype="submit"disabled={busy}style={{width: "100%",height: "48px",marginTop: "8px",background: "linear-gradient(to right, #2563eb, #4f46e5)",color: "#ffffff",fontWeight: 700,fontSize: "14px",borderRadius: "12px",border: "none",boxShadow: "0 10px 15px -3px rgba(37, 99, 235, 0.3)",cursor: busy ? "not-allowed" : "pointer",opacity: busy ? 0.7 : 1,display: "flex",alignItems: "center",justifyContent: "center",gap: "8px",}}>{busy ? (<span style={{ display: "inline-flex", alignItems: "center", gap: "8px" }}><svg style={{ animation: "spin 1s linear infinite", height: "16px", width: "16px", color: "#ffffff" }} viewBox="0 0 24 24" fill="none"><circle style={{ opacity: 0.25 }} cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" /><path style={{ opacity: 0.75 }} fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" /></svg>Authenticating...</span>) : (<>Sign In to Operations HQ <ArrowRight style={{ width: "16px", height: "16px" }} /></>)}</button></form>{/* Quick Fill Pills */}<div style={{ marginTop: "24px", paddingTop: "20px", borderTop: "1px solid #e2e8f0" }}><div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "12px", color: "#64748b", marginBottom: "10px" }}><span style={{ fontWeight: 500 }}>Quick Demo Sign In:</span><Sparkles style={{ width: "14px", height: "14px", color: "#f59e0b" }} /></div><div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" }}><buttontype="button"onClick={() => handleQuickFill("admin", "admin123")}style={{padding: "8px 12px",background: "#f8fafc",border: "1px solid #e2e8f0",borderRadius: "8px",fontSize: "12px",fontWeight: 600,color: "#475569",cursor: "pointer",textAlign: "center",}}>👑 Super Admin</button><buttontype="button"onClick={() => handleQuickFill("staff", "staff123")}style={{padding: "8px 12px",background: "#f8fafc",border: "1px solid #e2e8f0",borderRadius: "8px",fontSize: "12px",fontWeight: 600,color: "#475569",cursor: "pointer",textAlign: "center",}}>🏷️ Store Staff</button></div></div></div>{/* Footer */}<footer style={{ marginTop: "24px", textAlign: "center", fontSize: "12px", color: "#94a3b8", fontWeight: 500 }}>ProFlo Checkout System • Operations HQ Console</footer><style>{`@keyframes spin {from { transform: rotate(0deg); }to { transform: rotate(360deg); }}`}</style></main>);}1234567891011121314151617181920212223242516 unmodified lines42434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140"use client";import { useRouter } from "next/navigation";import { useEffect, useRef, useState } from "react";import { getAdminToken, setAdminSession } from "../../lib/adminAuth";import { ProFloLogo } from "../components/ProFloLogo";import { apiBase } from "../../lib/api";import { Lock, ArrowRight, ShieldCheck, BarChart3, Receipt, Package, Store } from "lucide-react";export default function AdminLoginPage() {const router = useRouter();const [username, setUsername] = useState("");const [password, setPassword] = useState("");const [error, setError] = useState("");const [busy, setBusy] = useState(false);const passwordRef = useRef<HTMLInputElement>(null);useEffect(() => {if (getAdminToken()) {router.replace("/admin/dashboard");}}, [router]);async function onSubmit(e: React.FormEvent) {e.preventDefault();16 unmodified linessetAdminSession(token, role);router.push("/admin/dashboard");} catch {setError(`Cannot reach API at ${apiBase}. Run npm run dev from the project root.`);}setBusy(false);}return (<main className="opsHqPage">{/* Left Pane: Decorative Brand & Illustration Area */}<div className="opsHqPage__brandPane">{/* Background Hexagon Pattern */}<div className="opsHqPage__hexBg"><svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="hexGrid" width="60" height="103.923" patternUnits="userSpaceOnUse"><path d="M30 0 L60 17.32 L60 51.96 L30 69.28 L0 51.96 L0 17.32 Z" fill="none" stroke="#0052FF" strokeWidth="0.75" strokeOpacity="0.06" /><path d="M30 51.96 L60 69.28 L60 103.92 L30 121.24 L0 103.92 L0 69.28 Z" fill="none" stroke="#0052FF" strokeWidth="0.75" strokeOpacity="0.06" /></pattern></defs><rect width="100%" height="100%" fill="url(#hexGrid)" /></svg></div><div className="opsHqPage__brandContent"><ProFloLogo size={80} showText /><span className="opsHqPage__brandTagline">SMART CHECKOUT. SMOOTH FLOW.</span><h2 className="opsHqPage__brandTitle">Operations HQ</h2><p className="opsHqPage__brandSub">Catalogue, inventory, counter tokens, receipts, and store KPIs—one console for your ProFlo deployment.</p><div className="opsHqPage__artWrapper">{/* Elegant light vector graphic representing checkout flow */}<svg viewBox="0 0 400 200" className="w-full max-w-[340px] opacity-90 mx-auto" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="20" y="40" width="100" height="120" rx="12" fill="white" stroke="#E2E8F0" strokeWidth="2" /><rect x="280" y="40" width="100" height="120" rx="12" fill="white" stroke="#E2E8F0" strokeWidth="2" /><path d="M130 100 H270" stroke="#0052FF" strokeWidth="2.5" strokeLinecap="round" strokeDasharray="6 6" /><circle cx="120" cy="100" r="10" fill="#0052FF" /><circle cx="280" cy="100" r="10" fill="#10B981" /><rect x="40" y="65" width="60" height="6" rx="3" fill="#F1F5F9" /><rect x="40" y="80" width="40" height="6" rx="3" fill="#F1F5F9" /><rect x="300" y="65" width="60" height="6" rx="3" fill="#F1F5F9" /><rect x="300" y="80" width="40" height="6" rx="3" fill="#F1F5F9" /></svg></div></div></div>{/* Right Pane: Login Form Area */}<div className="opsHqPage__formPane"><div className="opsHqPage__formWrapper"><div className="opsHqPage__formHeader"><h3 className="opsHqPage__formTitle">Welcome Back</h3><p className="opsHqPage__formSub">Please sign in to your administrator account.</p></div><form onSubmit={(e) => void onSubmit(e)} className="opsHqForm"><div className="opsHqForm__grid"><div className="opsHqField"><label htmlFor="username-input">Username</label><inputid="username-input"className="opsHqInput"autoComplete="username"value={username}onChange={(e) => setUsername(e.target.value)}placeholder="Enter username"/></div><div className="opsHqField"><label htmlFor="password-input">Password</label><inputid="password-input"ref={passwordRef}className="opsHqInput"type="password"autoComplete="current-password"value={password}onChange={(e) => setPassword(e.target.value)}placeholder="Enter password"/></div></div>{error ? <p className="opsHqError">{error}</p> : null}<button type="submit" className="opsHqSubmitBtn" disabled={busy}>{busy ? "Authenticating…" : "Sign in to admin"} <ArrowRight className="w-4 h-4 inline ml-1.5" /></button></form></div></div></main>);}
2331 unmodified lines23322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623776 unmodified lines238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062331 unmodified linesmin-height: 100dvh;height: auto;overflow-y: auto;background: #FFFFFF;}.opsHqPage__brandPane {flex: none;width: 100%;padding: 32px 20px 24px;border-right: none;border-bottom: 1px solid rgba(0, 82, 255, 0.08);text-align: center;}.opsHqPage__brandContent {max-width: 100%;margin: 0 auto;text-align: center;display: flex;flex-direction: column;align-items: center;}.opsHqPage__brandTitle {font-size: 2rem;margin: 10px 0 6px;}.opsHqPage__brandSub {font-size: 13.5px;margin-bottom: 0;}.opsHqPage__artWrapper {display: none;}.opsHqPage__formPane {flex: 1;width: 100%;padding: 28px 20px 48px;align-items: flex-start;}.opsHqPage__formWrapper {6 unmodified linesmargin-bottom: 24px;}.opsHqForm__grid {width: 100%;}.opsHqInput {height: 48px;font-size: 15px;}.opsHqSubmitBtn {height: 48px;font-size: 15px;width: 100%;}}.adminStorePick {display: flex;align-items: center;2331 unmodified lines23322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823596 unmodified lines236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152331 unmodified linesmin-height: 100dvh;height: auto;overflow-y: auto;background: linear-gradient(180deg, #0a0f1e 0%, #111827 50%, #0a0f1e 100%);justify-content: center;align-items: center;padding: 24px 16px;}.opsHqPage__hexBg { display: none; }.opsHqPage__brandPane {display: none;}.opsHqPage__formPane {flex: none;width: 100%;max-width: 420px;background: rgba(15, 23, 42, 0.85);backdrop-filter: blur(20px);border: 1px solid rgba(100, 116, 139, 0.3);border-radius: 24px;padding: 32px 24px;box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.5);}.opsHqPage__formWrapper {6 unmodified linesmargin-bottom: 24px;}.opsHqPage__formTitle {font-size: 1.75rem;color: #FFFFFF;}.opsHqPage__formSub {color: #94A3B8;}.opsHqForm__grid {width: 100%;}.opsHqField label {color: #CBD5E1;}.opsHqInput {height: 48px;font-size: 15px;background: rgba(15, 23, 42, 0.6);border-color: rgba(100, 116, 139, 0.4);color: #FFFFFF;}.opsHqInput::placeholder {color: #64748B;}.opsHqInput:focus {background: rgba(15, 23, 42, 0.9);border-color: #3B82F6;box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);}.opsHqSubmitBtn {height: 48px;font-size: 15px;width: 100%;background: linear-gradient(to right, #2563EB, #1D4ED8);border: none;}}.adminStorePick {display: flex;align-items: center;
1 unmodified line23456789101112131415161718192016 unmodified lines3738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253261 unmodified lineimport Link from "next/link";import { useRouter } from "next/navigation";import { useState } from "react";import { setAdminSession } from "../lib/adminAuth";import { ProFloLogo } from "./components/ProFloLogo";import { apiBase } from "../lib/api";import { ArrowRight, Lock, User, Eye, EyeOff, ShieldCheck, Sparkles, AlertCircle } from "lucide-react";export default function Home() {const router = useRouter();const [username, setUsername] = useState("");const [password, setPassword] = useState("");const [showPassword, setShowPassword] = useState(false);const [error, setError] = useState("");const [busy, setBusy] = useState(false);async function onSubmit(e: React.FormEvent) {e.preventDefault();16 unmodified linessetAdminSession(token, role);router.push("/admin/dashboard");} catch {setError(`Cannot reach API at ${apiBase}. Ensure backend is running.`);}setBusy(false);}function handleQuickFill(u: string, p: string) {setUsername(u);setPassword(p);setError("");}return (<mainstyle={{minHeight: "100dvh",width: "100%",display: "flex",flexDirection: "column",alignItems: "center",justifyContent: "center",padding: "16px",background: "#ffffff",color: "#0f172a",position: "relative",overflow: "hidden",fontFamily: "sans-serif",}}>{/* Main Login Card */}<divstyle={{width: "100%",maxWidth: "420px",background: "#ffffff",border: "1px solid #e2e8f0",borderRadius: "24px",padding: "28px",boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01)",position: "relative",zIndex: 10,margin: "auto",}}>{/* Brand Header */}<div style={{ display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", marginBottom: "28px" }}><divstyle={{width: "64px",height: "64px",borderRadius: "16px",background: "linear-gradient(to top right, #2563eb, #6366f1)",padding: "2px",boxShadow: "0 10px 15px -3px rgba(59, 130, 246, 0.25)",marginBottom: "16px",display: "flex",alignItems: "center",justifyContent: "center",}}><divstyle={{width: "100%",height: "100%",background: "#ffffff",borderRadius: "14px",display: "flex",alignItems: "center",justifyContent: "center",}}><ProFloLogo size={42} showText={false} /></div></div><divstyle={{display: "inline-flex",alignItems: "center",gap: "6px",padding: "4px 12px",borderRadius: "9999px",background: "rgba(59, 130, 246, 0.1)",border: "1px solid rgba(59, 130, 246, 0.2)",color: "#3b82f6",fontSize: "12px",fontWeight: 600,letterSpacing: "0.05em",textTransform: "uppercase",marginBottom: "8px",}}><ShieldCheck style={{ width: "14px", height: "14px" }} />Operations HQ</div><h1 style={{ fontSize: "24px", fontWeight: 800, color: "#0f172a", letterSpacing: "-0.02em", margin: "0" }}>Admin Sign In</h1><p style={{ fontSize: "14px", color: "#64748b", marginTop: "6px", lineHeight: 1.6, margin: "6px 0 0 0" }}>Manage catalogue, tokens & store analytics</p></div>{/* Login Form */}<form onSubmit={(e) => void onSubmit(e)} style={{ display: "flex", flexDirection: "column", gap: "16px" }}>{/* Username Field */}<div><labelhtmlFor="admin-username-input"style={{ display: "block", fontSize: "12px", fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", color: "#64748b", marginBottom: "6px" }}>Username</label><div style={{ position: "relative" }}><User style={{ position: "absolute", left: "14px", top: "50%", transform: "translateY(-50%)", width: "16px", height: "16px", color: "#94a3b8" }} /><inputid="admin-username-input"type="text"autoComplete="username"value={username}onChange={(e) => setUsername(e.target.value)}placeholder="Enter username"style={{width: "100%",height: "48px",paddingLeft: "40px",paddingRight: "16px",background: "#f8fafc",border: "1px solid #cbd5e1",borderRadius: "12px",fontSize: "14px",color: "#0f172a",outline: "none",boxSizing: "border-box",}}/></div></div>{/* Password Field */}<div><labelhtmlFor="admin-password-input"style={{ display: "block", fontSize: "12px", fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", color: "#64748b", marginBottom: "6px" }}>Password</label><div style={{ position: "relative" }}><Lock style={{ position: "absolute", left: "14px", top: "50%", transform: "translateY(-50%)", width: "16px", height: "16px", color: "#94a3b8" }} /><inputid="admin-password-input"type={showPassword ? "text" : "password"}autoComplete="current-password"value={password}onChange={(e) => setPassword(e.target.value)}placeholder="Enter password"style={{width: "100%",height: "48px",paddingLeft: "40px",paddingRight: "44px",background: "#f8fafc",border: "1px solid #cbd5e1",borderRadius: "12px",fontSize: "14px",color: "#0f172a",outline: "none",boxSizing: "border-box",}}/><buttontype="button"onClick={() => setShowPassword(!showPassword)}style={{ position: "absolute", right: "12px", top: "50%", transform: "translateY(-50%)", padding: "4px", color: "#64748b", background: "none", border: "none", cursor: "pointer" }}aria-label={showPassword ? "Hide password" : "Show password"}>{showPassword ? <EyeOff style={{ width: "16px", height: "16px" }} /> : <Eye style={{ width: "16px", height: "16px" }} />}</button></div></div>{/* Error Message */}{error ? (<div style={{ display: "flex", alignItems: "flex-start", gap: "8px", padding: "12px", borderRadius: "12px", background: "rgba(239, 68, 68, 0.1)", border: "1px solid rgba(239, 68, 68, 0.2)", color: "#ef4444", fontSize: "12px", fontWeight: 500 }}><AlertCircle style={{ width: "16px", height: "16px", flexShrink: 0, marginTop: "2px" }} /><span>{error}</span></div>) : null}{/* Submit Button */}<buttontype="submit"disabled={busy}style={{width: "100%",height: "48px",marginTop: "8px",background: "linear-gradient(to right, #2563eb, #4f46e5)",color: "#ffffff",fontWeight: 700,fontSize: "14px",borderRadius: "12px",border: "none",boxShadow: "0 10px 15px -3px rgba(37, 99, 235, 0.3)",cursor: busy ? "not-allowed" : "pointer",opacity: busy ? 0.7 : 1,display: "flex",alignItems: "center",justifyContent: "center",gap: "8px",}}>{busy ? (<span style={{ display: "inline-flex", alignItems: "center", gap: "8px" }}><svg style={{ animation: "spin 1s linear infinite", height: "16px", width: "16px", color: "#ffffff" }} viewBox="0 0 24 24" fill="none"><circle style={{ opacity: 0.25 }} cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" /><path style={{ opacity: 0.75 }} fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" /></svg>Authenticating...</span>) : (<>Sign In to Operations HQ <ArrowRight style={{ width: "16px", height: "16px" }} /></>)}</button></form>{/* Quick Fill Pills */}<div style={{ marginTop: "24px", paddingTop: "20px", borderTop: "1px solid #e2e8f0" }}><div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: "12px", color: "#64748b", marginBottom: "10px" }}><span style={{ fontWeight: 500 }}>Quick Demo Sign In:</span><Sparkles style={{ width: "14px", height: "14px", color: "#f59e0b" }} /></div><div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "8px" }}><buttontype="button"onClick={() => handleQuickFill("admin", "admin123")}style={{padding: "8px 12px",background: "#f8fafc",border: "1px solid #e2e8f0",borderRadius: "8px",fontSize: "12px",fontWeight: 600,color: "#475569",cursor: "pointer",textAlign: "center",}}>👑 Super Admin</button><buttontype="button"onClick={() => handleQuickFill("staff", "staff123")}style={{padding: "8px 12px",background: "#f8fafc",border: "1px solid #e2e8f0",borderRadius: "8px",fontSize: "12px",fontWeight: 600,color: "#475569",cursor: "pointer",textAlign: "center",}}>🏷️ Store Staff</button></div></div></div>{/* Footer */}<footer style={{ marginTop: "24px", textAlign: "center", fontSize: "12px", color: "#94a3b8", fontWeight: 500 }}>ProFlo Checkout System • Operations HQ Console</footer><style>{`@keyframes spin {from { transform: rotate(0deg); }to { transform: rotate(360deg); }}`}</style></main>);}1 unmodified line23456789101112131415161718192021222324252616 unmodified lines4344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401 unmodified lineimport Link from "next/link";import { useRouter } from "next/navigation";import { useEffect, useRef, useState } from "react";import { getAdminToken, setAdminSession } from "../lib/adminAuth";import { ProFloLogo } from "./components/ProFloLogo";import { apiBase } from "../lib/api";import { ArrowRight, BarChart3, Receipt, Package, Store, ShieldCheck, Zap, Layers, Activity } from "lucide-react";export default function Home() {const router = useRouter();const [username, setUsername] = useState("");const [password, setPassword] = useState("");const [error, setError] = useState("");const [busy, setBusy] = useState(false);const passwordRef = useRef<HTMLInputElement>(null);useEffect(() => {if (getAdminToken()) {router.replace("/admin/dashboard");}}, [router]);async function onSubmit(e: React.FormEvent) {e.preventDefault();16 unmodified linessetAdminSession(token, role);router.push("/admin/dashboard");} catch {setError(`Cannot reach API at ${apiBase}. Run npm run dev from the project root.`);}setBusy(false);}return (<main className="opsHqPage">{/* Left Pane: Decorative Brand & Illustration Area */}<div className="opsHqPage__brandPane">{/* Background Hexagon Pattern */}<div className="opsHqPage__hexBg"><svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="hexGridRoot" width="60" height="103.923" patternUnits="userSpaceOnUse"><path d="M30 0 L60 17.32 L60 51.96 L30 69.28 L0 51.96 L0 17.32 Z" fill="none" stroke="#0052FF" strokeWidth="0.8" strokeOpacity="0.08" /><path d="M30 51.96 L60 69.28 L60 103.92 L30 121.24 L0 103.92 L0 69.28 Z" fill="none" stroke="#0052FF" strokeWidth="0.8" strokeOpacity="0.08" /></pattern></defs><rect width="100%" height="100%" fill="url(#hexGridRoot)" /></svg></div><div className="opsHqPage__brandContent"><ProFloLogo size={80} showText /><span className="opsHqPage__brandTagline">SMART CHECKOUT. SMOOTH FLOW.</span><h2 className="opsHqPage__brandTitle">Operations HQ</h2><p className="opsHqPage__brandSub">Catalogue, inventory, counter tokens, receipts, and store KPIs—one unified command console for your retail deployment.</p><div className="opsHqPage__artWrapper">{/* Elegant light vector graphic representing checkout flow */}<svg viewBox="0 0 400 200" className="w-full max-w-[340px] opacity-90 mx-auto" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="20" y="40" width="100" height="120" rx="12" fill="white" stroke="#E2E8F0" strokeWidth="2" /><rect x="280" y="40" width="100" height="120" rx="12" fill="white" stroke="#E2E8F0" strokeWidth="2" /><path d="M130 100 H270" stroke="#0052FF" strokeWidth="2.5" strokeLinecap="round" strokeDasharray="6 6" /><circle cx="120" cy="100" r="10" fill="#0052FF" /><circle cx="280" cy="100" r="10" fill="#10B981" /><rect x="40" y="65" width="60" height="6" rx="3" fill="#F1F5F9" /><rect x="40" y="80" width="40" height="6" rx="3" fill="#F1F5F9" /><rect x="300" y="65" width="60" height="6" rx="3" fill="#F1F5F9" /><rect x="300" y="80" width="40" height="6" rx="3" fill="#F1F5F9" /></svg></div></div></div>{/* Right Pane: Login Form Area */}<div className="opsHqPage__formPane"><div className="opsHqPage__formWrapper"><div className="opsHqPage__formHeader"><h3 className="opsHqPage__formTitle">Welcome Back</h3><p className="opsHqPage__formSub">Please sign in to your administrator account.</p></div><form onSubmit={(e) => void onSubmit(e)} className="opsHqForm"><div className="opsHqForm__grid"><div className="opsHqField"><label htmlFor="user-in">Username</label><inputid="user-in"className="opsHqInput"autoComplete="username"value={username}onChange={(e) => setUsername(e.target.value)}placeholder="Enter username"/></div><div className="opsHqField"><label htmlFor="pass-in">Password</label><inputid="pass-in"ref={passwordRef}className="opsHqInput"type="password"autoComplete="current-password"value={password}onChange={(e) => setPassword(e.target.value)}placeholder="Enter password"/></div></div>{error ? <p className="opsHqError">{error}</p> : null}<button type="submit" className="opsHqSubmitBtn" disabled={busy}>{busy ? "Authenticating…" : "Sign in to admin"} <ArrowRight className="w-4 h-4 inline ml-1.5" /></button></form></div></div></main>);}
apps/admin-web/app/admin/page.tsx+84-271
apps/admin-web/app/globals.css+42-33
apps/admin-web/app/page.tsx+84-270