/** * LoginButton — auth entry point for admin controls. * * Shows a LOGIN pill when unauthenticated (opens LoginModal) and a user * dropdown with logout when a session is active. * * Architecture: rendered by App.jsx; uses the useAuth context shared with * InfoBar and RosterManager. * * Design: anonymous users can watch; only admins get controls. */ import { useState } from "react"; import { useAuth } from "../hooks/useAuth"; import LoginModal from "./LoginModal"; export default function LoginButton() { const { user, isAuthenticated, loading, login, logout } = useAuth(); const [showModal, setShowModal] = useState(false); const [showDropdown, setShowDropdown] = useState(false); if (loading) return null; const basePill = { position: "fixed", bottom: 16, right: 16, zIndex: 1500, fontFamily: "'Space Mono', monospace", fontSize: 11, fontWeight: 600, letterSpacing: "0.08em", borderRadius: 6, padding: "7px 16px", cursor: "pointer", display: "flex", alignItems: "center", gap: 7, textTransform: "uppercase", transition: "all 0.15s", }; if (!isAuthenticated) { return ( <> {showModal && setShowModal(false)} onLogin={login} />} ); } return (
{showDropdown && (
setShowDropdown(false)} >
{user?.email}
)}
); }