import React, { useState } from 'react'; import { useAuth } from './Auth.jsx'; const APPS = [ { label: 'Tavern', href: 'https://amerc.ai/' }, { label: 'Docs', href: 'https://docs.amerc.ai/' }, { label: 'PM', href: 'https://pm.amerc.ai/' }, { label: 'Git', href: 'https://git.amerc.ai/' }, ]; function ConsoleLogin({ auth }) { const [mode, setMode] = useState('login'); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [handle, setHandle] = useState(''); const [err, setErr] = useState(''); const [busy, setBusy] = useState(false); const submit = async (e) => { e.preventDefault(); setErr(''); setBusy(true); try { const { api } = await import('./api.js'); const d = await api(mode === 'login' ? '/auth/login' : '/auth/signup', { method: 'POST', body: { email, password, handle } }); auth.setUser(d.user); } catch (e2) { setErr(e2.message); } finally { setBusy(false); } }; return (
amerc
setEmail(e.target.value)} required /> {mode === 'signup' && setHandle(e.target.value)} />} setPassword(e.target.value)} required minLength={6} /> {err &&

{err}

}

One amerc account across tavern, docs, PM and git.

); } export default function ConsoleShell({ title, accent = '#27d8ff', current, requireRole, publicView, children }) { const auth = useAuth(); if (!auth.ready) return
Loading…
; if (!auth.user && !publicView) return
; if (requireRole && auth.user && auth.user.role !== requireRole) return (
amerc

This space is for {requireRole}s only.

Signed in as {auth.user.handle} ({auth.user.role}). Ask an admin for access.

← Back to tavern
); return (
amerc{title}
{auth.user ? <>{auth.user.handle}{auth.user.role === 'admin' ? ' · admin' : ''} : Log in to edit}
{typeof children === 'function' ? children(auth) : children}
); }