Hide edit profile button while editing, closes #301.

Block UI when account edit request is sent, closes #303.
This commit is contained in:
Paul 2021-10-10 16:32:30 +01:00
parent 89c0026fa2
commit 4ec598db81
2 changed files with 16 additions and 10 deletions

View file

@ -38,6 +38,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
new_email, new_email,
new_password, new_password,
}) => { }) => {
if (processing) return;
setProcessing(true); setProcessing(true);
try { try {
@ -74,6 +75,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
disabled={processing} disabled={processing}
actions={[ actions={[
{ {
disabled: processing,
confirmation: true, confirmation: true,
onClick: handleSubmit(onSubmit), onClick: handleSubmit(onSubmit),
children: children:
@ -104,6 +106,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
register={register} register={register}
showOverline showOverline
error={errors.new_email?.message} error={errors.new_email?.message}
disabled={processing}
/> />
)} )}
{field === "password" && ( {field === "password" && (
@ -114,6 +117,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
showOverline showOverline
error={errors.new_password?.message} error={errors.new_password?.message}
autoComplete="new-password" autoComplete="new-password"
disabled={processing}
/> />
)} )}
{field === "username" && ( {field === "username" && (
@ -123,6 +127,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
register={register} register={register}
showOverline showOverline
error={errors.new_username?.message} error={errors.new_username?.message}
disabled={processing}
/> />
)} )}
<FormField <FormField
@ -131,6 +136,7 @@ export function ModifyAccountModal({ onClose, field }: Props) {
showOverline showOverline
error={errors.current_password?.message} error={errors.current_password?.message}
autoComplete="current-password" autoComplete="current-password"
disabled={processing}
/> />
{error && ( {error && (
<Overline type="error" error={error}> <Overline type="error" error={error}>

View file

@ -185,11 +185,11 @@ export const UserProfile = observer(
</Tooltip> </Tooltip>
</Localizer> </Localizer>
)} )}
{user.relationship === RelationshipStatus.User && ( {user.relationship === RelationshipStatus.User &&
!dummy && (
<IconButton <IconButton
onClick={() => { onClick={() => {
onClose?.(); onClose?.();
if (dummy) return;
history.push(`/settings/profile`); history.push(`/settings/profile`);
}}> }}>
<Edit size={28} /> <Edit size={28} />