fixes admin autofill in fields

This commit is contained in:
k
2026-09-24 15:55:23 +02:00
parent 2dab720e55
commit b010762a0b
3 changed files with 24 additions and 16 deletions
+18 -12
View File
@@ -207,33 +207,39 @@ export function AdminCenter({ initialTab }: { initialTab?: string | null }) {
</div> </div>
<div className="mx-auto w-full max-w-4xl px-4 pb-3"> <div className="mx-auto w-full max-w-4xl px-4 pb-3">
<div className="flex gap-1 overflow-x-auto rounded-full border border-stone-200/70 bg-stone-100/70 p-1 dark:border-zinc-800 dark:bg-zinc-900"> <div className="flex gap-1 overflow-x-auto rounded-full border border-stone-200/70 bg-stone-100/70 p-1 dark:border-zinc-800 dark:bg-zinc-900">
{TABS.map((t) => ( {TABS.map((tb) => (
<button <button
key={t.id} key={tb.id}
onClick={() => selectTab(t.id)} onClick={() => selectTab(tb.id)}
className={cn( className={cn(
"relative flex flex-1 items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium transition", "relative flex flex-1 items-center justify-center gap-2 whitespace-nowrap rounded-full px-4 py-2 text-sm font-medium transition",
tab === t.id tab === tb.id
? "bg-white text-stone-900 shadow dark:bg-zinc-800 dark:text-zinc-100" ? "bg-white text-stone-900 shadow dark:bg-zinc-800 dark:text-zinc-100"
: "opacity-60 hover:opacity-100", : "opacity-60 hover:opacity-100",
)} )}
> >
<t.icon size={15} /> <tb.icon size={15} />
{t.label} {tb.label}
{t.id === "access" && openAccessCount > 0 && ( {tb.id === "access" && (
<span <span
role="status" role="status"
aria-label={`${t.label}: ${openAccessCount}`} aria-label={`${tb.label}: ${openAccessCount}`}
className="absolute -right-0.5 -top-0.5 z-10 grid min-h-4 min-w-4 place-items-center rounded-full bg-red-500 px-1 text-[10px] font-bold leading-4 text-white shadow" className={cn(
"absolute -right-0.5 -top-0.5 z-10 grid min-h-4 min-w-4 place-items-center rounded-full px-1 text-[10px] font-bold leading-4 text-white shadow",
openAccessCount > 0 ? "bg-red-500" : "bg-stone-400 dark:bg-zinc-600",
)}
> >
{openAccessCount > 99 ? "99+" : openAccessCount} {openAccessCount > 99 ? "99+" : openAccessCount}
</span> </span>
)} )}
{t.id === "reports" && openReportCount > 0 && ( {tb.id === "reports" && (
<span <span
role="status" role="status"
aria-label={`${t.label}: ${openReportCount}`} aria-label={`${tb.label}: ${openReportCount}`}
className="absolute -right-0.5 -top-0.5 z-10 grid min-h-4 min-w-4 place-items-center rounded-full bg-red-500 px-1 text-[10px] font-bold leading-4 text-white shadow" className={cn(
"absolute -right-0.5 -top-0.5 z-10 grid min-h-4 min-w-4 place-items-center rounded-full px-1 text-[10px] font-bold leading-4 text-white shadow",
openReportCount > 0 ? "bg-red-500" : "bg-stone-400 dark:bg-zinc-600",
)}
> >
{openReportCount > 99 ? "99+" : openReportCount} {openReportCount > 99 ? "99+" : openReportCount}
</span> </span>
+1 -1
View File
@@ -10,7 +10,7 @@ import { AccessRequestModal } from "./ReviewPage.tsx";
export function Login({ onLogin }: { onLogin: (user: UserType) => void }) { export function Login({ onLogin }: { onLogin: (user: UserType) => void }) {
const { t } = useT(); const { t } = useT();
const [username, setUsername] = useState("admin"); const [username, setUsername] = useState("");
const [key, setKey] = useState(""); const [key, setKey] = useState("");
const [error, setError] = useState(""); const [error, setError] = useState("");
const [busy, setBusy] = useState(false); const [busy, setBusy] = useState(false);
+5 -3
View File
@@ -76,27 +76,29 @@ export function RegisterPage() {
</Button> </Button>
</div> </div>
) : ( ) : (
<form onSubmit={submit} className="mt-4 space-y-2.5"> <form onSubmit={submit} autoComplete="off" className="mt-4 space-y-2.5">
<div className="grid grid-cols-2 gap-2.5"> <div className="grid grid-cols-2 gap-2.5">
<Field label={t("common.username")}> <Field label={t("common.username")}>
<Input <Input
variant="soft" variant="soft"
name="ka-register-username"
value={username} value={username}
onChange={(e) => setUsername(e.target.value)} onChange={(e) => setUsername(e.target.value)}
placeholder="alice" placeholder="alice"
maxLength={32} maxLength={32}
autoComplete="username" autoComplete="off"
required required
/> />
</Field> </Field>
<Field label={t("common.displayName")}> <Field label={t("common.displayName")}>
<Input <Input
variant="soft" variant="soft"
name="ka-register-displayname"
value={displayName} value={displayName}
onChange={(e) => setDisplayName(e.target.value)} onChange={(e) => setDisplayName(e.target.value)}
placeholder="Alice" placeholder="Alice"
maxLength={60} maxLength={60}
autoComplete="nickname" autoComplete="off"
/> />
</Field> </Field>
</div> </div>