converted account and organisation pages to dialogs

This commit is contained in:
Oliver Bryan
2026-01-03 12:42:39 +00:00
parent 33da8bde85
commit 5160a6a554
11 changed files with 441 additions and 431 deletions

View File

@@ -11,6 +11,7 @@ export function Field({
submitAttempted,
placeholder,
error,
tabIndex,
}: {
label: string;
value?: string;
@@ -20,12 +21,13 @@ export function Field({
submitAttempted?: boolean;
placeholder?: string;
error?: string;
tabIndex?: number;
}) {
const [internalTouched, setInternalTouched] = useState(false);
const isTouched = submitAttempted || internalTouched;
const invalidMessage = useMemo(() => {
if (!isTouched) {
if (!isTouched && value === "") {
return "";
}
return validate?.(value) ?? "";
@@ -42,11 +44,15 @@ export function Field({
id={label}
placeholder={placeholder ?? label}
value={value}
onChange={onChange}
onChange={(e) => {
onChange(e);
setInternalTouched(true);
}}
onBlur={() => setInternalTouched(true)}
name={label}
aria-invalid={error !== undefined || invalidMessage !== ""}
type={hidden ? "password" : "text"}
tabIndex={tabIndex}
/>
<div className="flex items-end justify-end w-full text-xs mb-0 -mt-1">
{error || invalidMessage !== "" ? (