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:
1 parent
df14ee1a9a
commit
fde2c86b1e
48 files changed
+1062
-1665
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { ArrowRight, ShieldCheck } from 'lucide-react';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
@@ -15,13 +15,13 @@ export function AdminSetup({
|
||||
initialEmail?: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [email, setEmail] = useState(initialEmail);
|
||||
const [email, setEmail] = useState(initialEmail || 'admin@datastack.dev');
|
||||
const [password, setPassword] = useState('');
|
||||
const [confirmPassword, setConfirmPassword] = useState('');
|
||||
const [setupKey, setSetupKey] = useState('');
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState(
|
||||
databaseReady ? '' : 'The setup service is unavailable. Check the database connection and try again.',
|
||||
databaseReady ? '' : 'Database connection unavailable.',
|
||||
);
|
||||
|
||||
const submit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
@@ -29,11 +29,11 @@ export function AdminSetup({
|
||||
setErrorMessage('');
|
||||
|
||||
if (password.length < 12) {
|
||||
setErrorMessage('Choose a password with at least 12 characters.');
|
||||
setErrorMessage('Password must be at least 12 characters.');
|
||||
return;
|
||||
}
|
||||
if (password !== confirmPassword) {
|
||||
setErrorMessage('The passwords do not match.');
|
||||
setErrorMessage('Passwords do not match.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,27 +57,21 @@ export function AdminSetup({
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="relative grid min-h-dvh place-items-center bg-[var(--bg)] p-4 text-[var(--text)] sm:p-6">
|
||||
<section className="w-full max-w-sm 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)]" />
|
||||
<main className="relative grid min-h-dvh place-items-center bg-[var(--bg)] p-4 text-[var(--text)]">
|
||||
<section className="w-full max-w-[320px] 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)]">INITIAL SETUP</span>
|
||||
</Link>
|
||||
<div>
|
||||
<h1 className="text-[15px] font-medium text-[var(--text)]">Create the first admin</h1>
|
||||
<p className="mt-1 text-xs leading-relaxed text-[var(--text-muted)]">
|
||||
This one-time setup creates the admin account stored in your database.
|
||||
</p>
|
||||
</div>
|
||||
<h1 className="text-[12px] font-medium text-[var(--text-muted)]">Admin Setup</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="border border-[var(--border-strong)] bg-[var(--surface-2)] px-2.5 py-2 text-xs leading-relaxed text-[var(--text-muted)]">
|
||||
<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>
|
||||
)}
|
||||
@@ -116,6 +110,7 @@ export function AdminSetup({
|
||||
label="Installation key"
|
||||
type="password"
|
||||
autoComplete="off"
|
||||
placeholder="Installation key"
|
||||
value={setupKey}
|
||||
onChange={(event) => setSetupKey(event.target.value)}
|
||||
compact
|
||||
@@ -130,14 +125,13 @@ export function AdminSetup({
|
||||
iconPosition="right"
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting || !databaseReady}
|
||||
className="mt-1 h-[34px] w-full justify-center text-[12.5px]"
|
||||
className="mt-0.5 w-full justify-center"
|
||||
>
|
||||
Create admin account
|
||||
Create admin
|
||||
</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 className="inline-flex items-center gap-1.5"><ShieldCheck className="h-3 w-3" aria-hidden="true" />One-time installation</span>
|
||||
<footer className="flex items-center justify-end border-t border-[var(--border)] px-4 py-2 text-[10.5px]">
|
||||
<Link href="/vcon/login" className="inline-flex items-center gap-1 text-[var(--text-muted)] hover:text-[var(--text)]">
|
||||
Sign in <ArrowRight className="h-3 w-3" aria-hidden="true" />
|
||||
</Link>
|
||||
|
||||
Reference in new issue
Block a user