new sign-in form and presentation

This commit is contained in:
Rob Colbert 2026-05-08 11:44:27 -04:00
parent 11bdd5e3b0
commit 49ef6de30c

View File

@ -1,6 +1,7 @@
import { useState } from 'react'; import { useState } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { api, AuthResponse, User } from '../lib/api'; import { api, AuthResponse, User } from '../lib/api';
import GadgetGrid from '../components/GadgetGrid';
interface SignInProps { interface SignInProps {
onSuccess: (user: User, token: string) => void; onSuccess: (user: User, token: string) => void;
@ -27,58 +28,79 @@ export default function SignIn({ onSuccess }: SignInProps) {
}; };
return ( return (
<div className="min-h-screen flex items-center justify-center bg-bg-primary"> <div className="relative flex-1 flex bg-bg-primary overflow-hidden">
<div className="w-full max-w-md p-8"> <div className="absolute inset-0">
<h1 className="text-2xl font-bold text-center mb-6">Sign In</h1> <GadgetGrid />
</div>
<div className="relative z-10 flex items-center justify-center p-8">
<div className="w-full max-w-md">
<div className="border-2 border-border-default p-6 rounded bg-bg-secondary">
<div className="font-mono text-text-secondary text-sm">
<div className="mb-1 text-text-muted">// AUTHENTICATION REQUIRED</div>
<div className="mb-6 text-text-primary">SYSTEM ACCESS</div>
<div className="text-text-muted mb-6">
Accounts are administered. Contact your administrator for access.
</div>
{error && ( {error && (
<div className="mb-4 p-3 bg-red-900/30 border border-red-700 rounded-lg text-red-200"> <div className="mb-4 p-3 border border-red-800 rounded bg-red-950/50">
<div className="text-red-400 font-mono text-sm">
<span className="text-text-muted">// ERROR: </span>
{error} {error}
</div> </div>
</div>
)} )}
<form onSubmit={handleSubmit} className="space-y-4"> <form onSubmit={handleSubmit} className="space-y-4">
<div> <div>
<label htmlFor="email" className="block text-sm text-text-muted mb-1"> <label htmlFor="email" className="block text-sm text-text-muted mb-1 font-mono">
Email Address email_address
</label> </label>
<input <input
id="email" id="email"
type="email" type="email"
value={email} value={email}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
className="w-full px-4 py-2 bg-bg-tertiary border border-border-default rounded-lg text-text-primary focus:outline-none focus:border-brand" className="w-full px-4 py-2 bg-bg-tertiary border border-border-default rounded text-text-primary font-mono focus:outline-none focus:border-border-highlight"
required required
autoComplete="email"
/> />
</div> </div>
<div> <div>
<label htmlFor="password" className="block text-sm text-text-muted mb-1"> <label htmlFor="password" className="block text-sm text-text-muted mb-1 font-mono">
Password password_hash
</label> </label>
<input <input
id="password" id="password"
type="password" type="password"
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
className="w-full px-4 py-2 bg-bg-tertiary border border-border-default rounded-lg text-text-primary focus:outline-none focus:border-brand" className="w-full px-4 py-2 bg-bg-tertiary border border-border-default rounded text-text-primary font-mono focus:outline-none focus:border-border-highlight"
required required
autoComplete="current-password"
/> />
</div> </div>
<div className="flex gap-4 pt-2"> <div className="flex gap-4 pt-4">
<Link <Link
to="/" to="/"
className="flex-1 px-4 py-2 text-center border border-border-default rounded-lg hover:bg-bg-tertiary transition-colors" className="flex-1 px-4 py-2 text-center border border-border-highlight text-text-primary hover:bg-bg-tertiary rounded transition-colors font-mono text-sm"
> >
Cancel CANCEL
</Link> </Link>
<button <button
type="submit" type="submit"
disabled={loading} disabled={loading}
className="flex-1 px-4 py-2 bg-brand hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50" className="flex-1 px-4 py-2 bg-brand hover:bg-red-700 text-white rounded transition-colors disabled:opacity-50 font-mono text-sm"
> >
{loading ? 'Signing in...' : 'Sign In'} {loading ? 'VERIFYING...' : 'AUTHENTICATE'}
</button> </button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div>
</div>
</div>
); );
} }