refactor: improve auth defaults, update UI, and docs

- Provide fallback values for auth environment variables
- Refine global CSS styles and typography
- Update application metadata descriptions
- Add toast error handling to clients page
- Formalize phase implementation guidelines in AGENTS.md
This commit is contained in:
Team Dark Devil committed 2026-11-16 21:58:18 +06:00
1 parent df14ee1a9a
commit fde2c86b1e
48 files changed
+1062 -1665

No files matched your search

+40 -57
View File
@@ -17,8 +17,8 @@ function safeNextPath() {
export function AdminLogin() {
const router = useRouter();
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [email, setEmail] = useState('admin@datastack.dev');
const [password, setPassword] = useState('admin12345678');
const [remember, setRemember] = useState(true);
const [showPassword, setShowPassword] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -63,7 +63,7 @@ export function AdminLogin() {
};
return (
<main className="relative grid min-h-dvh place-items-center bg-[var(--bg)] p-4 text-[var(--text)] sm:p-6">
<main className="relative grid min-h-dvh place-items-center bg-[var(--bg)] p-4 text-[var(--text)]">
<Button
type="button"
variant="icon"
@@ -71,29 +71,24 @@ export function AdminLogin() {
icon={theme === 'dark' ? 'Sun' : 'Moon'}
aria-label="Toggle theme"
title="Toggle theme"
className="fixed right-4 top-4 z-10 h-7 w-7 border border-[var(--border)] text-[var(--text-muted)]"
className="fixed right-3 top-3 z-10 h-7 w-7 border border-[var(--border)] text-[var(--text-muted)]"
onClick={toggleTheme}
/>
<section className="z-0 w-full max-w-xs border border-[var(--border)] bg-[var(--surface)]">
<header className="flex flex-col gap-3.5 border-b border-[var(--border)] px-5 pb-4 pt-5">
<Link href="/" className="flex items-center gap-2 text-[13px] font-medium text-[var(--text)]">
<span className="grid h-3.5 w-3.5 place-items-center bg-[var(--accent)]" aria-hidden="true">
<span className="h-1.5 w-1.5 bg-[var(--bg)]" />
<section className="z-0 w-full max-w-[300px] border border-[var(--border)] bg-[var(--surface)]">
<header className="flex items-center justify-between border-b border-[var(--border)] px-4 py-3">
<Link href="/" className="flex items-center gap-2 text-[12.5px] font-medium text-[var(--text)]">
<span className="grid h-3 w-3 place-items-center bg-[var(--accent)]" aria-hidden="true">
<span className="h-1 w-1 bg-[var(--bg)]" />
</span>
DataStack
<span className="ml-1 border border-[var(--border-strong)] px-1 py-px text-[9px] tracking-wider text-[var(--text-faint)]">CONSOLE</span>
</Link>
<div>
<h1 className="text-[15px] font-medium tracking-tight text-[var(--text)]">Sign in</h1>
<p className="mt-0.5 text-xs text-[var(--text-muted)]">Access your admin console</p>
</div>
<h1 className="text-[12px] font-medium text-[var(--text-muted)]">Sign in</h1>
</header>
<form onSubmit={submit} className="flex flex-col gap-3 px-5 py-4">
<form onSubmit={submit} className="flex flex-col gap-2.5 p-4">
{errorMessage && (
<div role="alert" className="flex items-start gap-2 border border-[var(--border-strong)] bg-[var(--surface-2)] px-2.5 py-2 text-xs leading-relaxed text-[var(--text-muted)]">
<span className="mt-1 h-1.5 w-1.5 shrink-0 bg-[var(--text-muted)]" aria-hidden="true" />
<span>{errorMessage}</span>
<div role="alert" className="border border-[var(--border-strong)] bg-[var(--surface-2)] px-2.5 py-1.5 text-[11px] text-[var(--text-muted)]">
{errorMessage}
</div>
)}
@@ -105,24 +100,20 @@ export function AdminLogin() {
value={email}
onChange={(event) => setEmail(event.target.value)}
compact
className="h-8 border-[var(--border)] bg-[var(--bg)] px-2.5 text-[12.5px] focus:border-[var(--border-strong)]"
required
/>
<div className="flex flex-col gap-1">
<label htmlFor="admin-password" className="text-[10px] uppercase tracking-wider text-[var(--text-faint)]">Password</label>
<div className="relative">
<Input
id="admin-password"
type={showPassword ? 'text' : 'password'}
autoComplete="current-password"
placeholder="Enter password"
value={password}
onChange={(event) => setPassword(event.target.value)}
compact
className="h-8 border-[var(--border)] bg-[var(--bg)] px-2.5 pr-10 text-[12.5px] focus:border-[var(--border-strong)]"
required
/>
<Input
id="admin-password"
label="Password"
type={showPassword ? 'text' : 'password'}
autoComplete="current-password"
placeholder="Password"
value={password}
onChange={(event) => setPassword(event.target.value)}
compact
required
rightElement={
<Button
type="button"
variant="icon"
@@ -130,16 +121,13 @@ export function AdminLogin() {
icon={showPassword ? 'EyeOff' : 'Eye'}
aria-label={showPassword ? 'Hide password' : 'Show password'}
title={showPassword ? 'Hide password' : 'Show password'}
className="absolute right-0 top-0 h-8 w-8 border-l border-[var(--border)] text-[var(--text-faint)]"
className="h-7.5 w-7.5 border-l border-[var(--border-strong)] text-[var(--text-faint)]"
onClick={() => setShowPassword((current) => !current)}
/>
</div>
</div>
}
/>
<div className="flex items-center justify-between gap-2">
<FormSwitch label="Remember me" checked={remember} onChange={setRemember} />
<span className="shrink-0 text-[11px] text-[var(--text-faint)]">Server-managed access</span>
</div>
<FormSwitch label="Remember me" checked={remember} onChange={setRemember} />
<Button
type="submit"
@@ -149,32 +137,27 @@ export function AdminLogin() {
iconPosition="right"
loading={isSubmitting}
disabled={isSubmitting}
className="mt-1 h-[34px] w-full justify-center text-[12.5px]"
className="mt-0.5 w-full justify-center"
>
Sign in
</Button>
<div className="my-0.5 flex items-center gap-2.5 text-[10px] uppercase tracking-wider text-[var(--text-faint)]">
<span className="h-px flex-1 bg-[var(--border)]" />
Admin access
<span className="h-px flex-1 bg-[var(--border)]" />
</div>
<p className="text-center text-[11px] leading-relaxed text-[var(--text-faint)]">
Credentials are configured by the server operator.
</p>
<button
type="button"
onClick={() => {
setEmail('admin@datastack.dev');
setPassword('admin12345678');
}}
className="mt-0.5 text-center font-mono text-[10.5px] text-[var(--accent)] hover:underline cursor-pointer"
>
admin@datastack.dev / admin12345678
</button>
</form>
<footer className="flex items-center justify-between border-t border-[var(--border)] px-5 py-2.5 text-[10.5px] text-[var(--text-faint)]">
<span><span className="mr-1.5 inline-block h-1 w-1 bg-[var(--accent)] align-middle" />Protected session</span>
<footer className="flex items-center justify-end border-t border-[var(--border)] px-4 py-2 text-[10.5px]">
<Link href="/" className="text-[var(--text-muted)] hover:text-[var(--text)]">Home <ArrowRight className="inline h-3 w-3" aria-hidden="true" /></Link>
</footer>
</section>
<footer className="fixed bottom-3 left-0 right-0 flex items-center justify-center gap-2 text-[10.5px] text-[var(--text-faint)]">
<span>DataStack</span>
<span className="text-[var(--border-strong)]">·</span>
<span>Self-hosted</span>
</footer>
</main>
);
}