mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 11:15:41 +02:00
- LoginPage/SetupPage: centered card layout with display font, styled fields and submit button - Topbar: fix duplicate Settings nav item; add styled user-menu with username + logout button - RunsView: format ISO timestamps to readable dates, add colored status badges (completed/failed/running) - AdminView: view-tabs system, styled admin-table, admin-input, status-badge (active/disabled), btn-primary - SettingsView: replace all inline styles with form-section/form-field/field-input/btn-primary/btn-danger - CollectionsView: restructure create form with proper field labels and btn-primary - TagsView: add Tags section heading with separator - ContextRail: show visibility as human-readable label not raw number; fix assign-error class - styles.css: add auth-loading, view-tabs, form utilities, btn variants, status badges, run-status pills, token-banner/row, checkbox-row, coll-create-form, tag-tree-header CSS
84 lines
2.6 KiB
JavaScript
84 lines
2.6 KiB
JavaScript
import { useState } from 'react';
|
|
import { doSetup } from '../api.js';
|
|
|
|
export default function SetupPage({ onComplete }) {
|
|
const [username, setUsername] = useState('');
|
|
const [password, setPassword] = useState('');
|
|
const [confirm, setConfirm] = useState('');
|
|
const [error, setError] = useState(null);
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
async function handleSubmit(e) {
|
|
e.preventDefault();
|
|
if (password !== confirm) {
|
|
setError('Passwords do not match');
|
|
return;
|
|
}
|
|
if (password.length < 8) {
|
|
setError('Password must be at least 8 characters');
|
|
return;
|
|
}
|
|
setError(null);
|
|
setLoading(true);
|
|
try {
|
|
await doSetup(username, password);
|
|
onComplete();
|
|
} catch (err) {
|
|
setError(err.message);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="setup-page">
|
|
<div className="setup-card">
|
|
<h1 className="setup-brand">Archivr</h1>
|
|
<p className="setup-tagline">Create your owner account to get started.</p>
|
|
<form onSubmit={handleSubmit}>
|
|
<div className="setup-field">
|
|
<label className="setup-label" htmlFor="setup-username">Username</label>
|
|
<input
|
|
className="setup-input"
|
|
id="setup-username"
|
|
type="text"
|
|
value={username}
|
|
onChange={e => setUsername(e.target.value)}
|
|
autoFocus
|
|
required
|
|
autoComplete="username"
|
|
/>
|
|
</div>
|
|
<div className="setup-field">
|
|
<label className="setup-label" htmlFor="setup-password">Password</label>
|
|
<input
|
|
className="setup-input"
|
|
id="setup-password"
|
|
type="password"
|
|
value={password}
|
|
onChange={e => setPassword(e.target.value)}
|
|
required
|
|
autoComplete="new-password"
|
|
/>
|
|
</div>
|
|
<div className="setup-field">
|
|
<label className="setup-label" htmlFor="setup-confirm">Confirm password</label>
|
|
<input
|
|
className="setup-input"
|
|
id="setup-confirm"
|
|
type="password"
|
|
value={confirm}
|
|
onChange={e => setConfirm(e.target.value)}
|
|
required
|
|
autoComplete="new-password"
|
|
/>
|
|
</div>
|
|
{error && <p className="setup-error">{error}</p>}
|
|
<button className="setup-submit" type="submit" disabled={loading}>
|
|
{loading ? 'Creating account\u2026' : 'Create account'}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|