MCPcopy Index your code
hub / github.com/coder/coder / EditUserForm

Function EditUserForm

site/src/pages/EditUserPage/EditUserForm.tsx:32–98  ·  view source on GitHub ↗
({
	error,
	isLoading,
	initialValues,
	onSubmit,
	onCancel,
})

Source from the content-addressed store, hash-verified

30}
31
32export const EditUserForm: FC<EditUserFormProps> = ({
33 error,
34 isLoading,
35 initialValues,
36 onSubmit,
37 onCancel,
38}) => {
39 const form = useFormik<UpdateUserProfileRequest>({
40 initialValues,
41 validationSchema,
42 onSubmit,
43 enableReinitialize: true,
44 });
45
46 const getFieldHelpers = getFormHelpers(form, error);
47
48 return (
49 <FullPageForm title="Edit user">
50 {isApiError(error) && !hasApiFieldErrors(error) && (
51 <ErrorAlert error={error} className="mb-8" />
52 )}
53 <form onSubmit={form.handleSubmit} autoComplete="off">
54 <div className="flex flex-col gap-6">
55 <FormField
56 field={getFieldHelpers("username")}
57 label="Username"
58 id="username"
59 name="username"
60 value={form.values.username}
61 onChange={onChangeTrimmed(form)}
62 onBlur={form.handleBlur}
63 autoComplete="username"
64 autoFocus
65 />
66
67 <FormField
68 field={getFieldHelpers("name")}
69 label={
70 <>
71 Full name{" "}
72 <span className="font-normal text-content-secondary">
73 (optional)
74 </span>
75 </>
76 }
77 id="name"
78 name="name"
79 value={form.values.name}
80 onChange={form.handleChange}
81 onBlur={form.handleBlur}
82 autoComplete="name"
83 />
84 </div>
85
86 <FormFooter className="mt-8">
87 <Button onClick={onCancel} variant="outline">
88 Cancel
89 </Button>

Callers

nothing calls this directly

Calls 4

getFormHelpersFunction · 0.90
isApiErrorFunction · 0.90
hasApiFieldErrorsFunction · 0.90
onChangeTrimmedFunction · 0.90

Tested by

no test coverage detected