2023-03-21 10:43:07 +00:00
|
|
|
import { zodResolver } from "@hookform/resolvers/zod";
|
2022-08-26 00:11:41 +00:00
|
|
|
import { signOut } from "next-auth/react";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { BaseSyntheticEvent } from "react";
|
|
|
|
import { useRef, useState } from "react";
|
2022-08-30 19:46:52 +00:00
|
|
|
import { Controller, useForm } from "react-hook-form";
|
2023-03-21 10:43:07 +00:00
|
|
|
import { z } from "zod";
|
2022-08-26 00:11:41 +00:00
|
|
|
|
2023-03-10 23:45:24 +00:00
|
|
|
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
|
2023-01-05 17:00:16 +00:00
|
|
|
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";
|
2023-03-21 10:43:07 +00:00
|
|
|
import { FULL_NAME_LENGTH_MAX_LIMIT } from "@calcom/lib/constants";
|
2022-11-30 21:52:56 +00:00
|
|
|
import { APP_NAME } from "@calcom/lib/constants";
|
2022-08-26 00:11:41 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-03-03 23:20:13 +00:00
|
|
|
import { md } from "@calcom/lib/markdownIt";
|
2023-01-27 23:14:58 +00:00
|
|
|
import turndown from "@calcom/lib/turndownService";
|
2023-05-02 11:44:05 +00:00
|
|
|
import { IdentityProvider } from "@calcom/prisma/enums";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { TRPCClientErrorLike } from "@calcom/trpc/client";
|
2022-08-26 00:11:41 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
|
2022-11-23 02:55:25 +00:00
|
|
|
import {
|
|
|
|
Alert,
|
|
|
|
Avatar,
|
|
|
|
Button,
|
|
|
|
Dialog,
|
2022-11-28 19:14:38 +00:00
|
|
|
DialogClose,
|
2022-11-23 02:55:25 +00:00
|
|
|
DialogContent,
|
2022-11-28 19:14:38 +00:00
|
|
|
DialogFooter,
|
2022-11-23 02:55:25 +00:00
|
|
|
DialogTrigger,
|
|
|
|
Form,
|
|
|
|
ImageUploader,
|
|
|
|
Label,
|
|
|
|
Meta,
|
|
|
|
PasswordField,
|
|
|
|
showToast,
|
|
|
|
SkeletonAvatar,
|
|
|
|
SkeletonButton,
|
|
|
|
SkeletonContainer,
|
|
|
|
SkeletonText,
|
|
|
|
TextField,
|
2023-01-25 01:08:10 +00:00
|
|
|
Editor,
|
2022-11-23 02:55:25 +00:00
|
|
|
} from "@calcom/ui";
|
2023-04-12 15:26:31 +00:00
|
|
|
import { AlertTriangle, Trash2 } from "@calcom/ui/components/icon";
|
2022-08-26 00:11:41 +00:00
|
|
|
|
2023-04-18 18:45:32 +00:00
|
|
|
import PageWrapper from "@components/PageWrapper";
|
2022-09-06 18:23:17 +00:00
|
|
|
import TwoFactor from "@components/auth/TwoFactor";
|
2022-12-07 20:15:15 +00:00
|
|
|
import { UsernameAvailabilityField } from "@components/ui/UsernameAvailability";
|
2022-08-26 00:11:41 +00:00
|
|
|
|
2022-12-07 20:53:44 +00:00
|
|
|
const SkeletonLoader = ({ title, description }: { title: string; description: string }) => {
|
2022-09-15 09:05:26 +00:00
|
|
|
return (
|
|
|
|
<SkeletonContainer>
|
2022-12-07 20:53:44 +00:00
|
|
|
<Meta title={title} description={description} />
|
2023-07-04 23:41:29 +00:00
|
|
|
<div className="mb-8 space-y-6">
|
2022-09-15 09:05:26 +00:00
|
|
|
<div className="flex items-center">
|
2023-07-04 23:41:29 +00:00
|
|
|
<SkeletonAvatar className="me-4 mt-0 h-16 w-16 px-4" />
|
2023-01-25 01:08:10 +00:00
|
|
|
<SkeletonButton className="h-6 w-32 rounded-md p-5" />
|
2022-09-15 09:05:26 +00:00
|
|
|
</div>
|
|
|
|
<SkeletonText className="h-8 w-full" />
|
|
|
|
<SkeletonText className="h-8 w-full" />
|
|
|
|
<SkeletonText className="h-8 w-full" />
|
|
|
|
|
|
|
|
<SkeletonButton className="mr-6 h-8 w-20 rounded-md p-5" />
|
|
|
|
</div>
|
|
|
|
</SkeletonContainer>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-09-06 18:23:17 +00:00
|
|
|
interface DeleteAccountValues {
|
|
|
|
totpCode: string;
|
|
|
|
}
|
|
|
|
|
2022-12-08 09:50:03 +00:00
|
|
|
type FormValues = {
|
|
|
|
username: string;
|
|
|
|
avatar: string;
|
|
|
|
name: string;
|
|
|
|
email: string;
|
|
|
|
bio: string;
|
|
|
|
};
|
|
|
|
|
2022-09-15 09:05:26 +00:00
|
|
|
const ProfileView = () => {
|
2022-08-26 00:11:41 +00:00
|
|
|
const { t } = useLocale();
|
2022-09-06 18:23:17 +00:00
|
|
|
const utils = trpc.useContext();
|
2022-11-10 23:40:01 +00:00
|
|
|
const { data: user, isLoading } = trpc.viewer.me.useQuery();
|
2022-12-08 09:50:03 +00:00
|
|
|
const { data: avatar, isLoading: isLoadingAvatar } = trpc.viewer.avatar.useQuery();
|
2022-11-10 23:40:01 +00:00
|
|
|
const mutation = trpc.viewer.updateProfile.useMutation({
|
2022-08-26 00:11:41 +00:00
|
|
|
onSuccess: () => {
|
|
|
|
showToast(t("settings_updated_successfully"), "success");
|
2022-12-08 09:50:03 +00:00
|
|
|
utils.viewer.me.invalidate();
|
|
|
|
utils.viewer.avatar.invalidate();
|
|
|
|
setTempFormValues(null);
|
2022-08-26 00:11:41 +00:00
|
|
|
},
|
|
|
|
onError: () => {
|
|
|
|
showToast(t("error_updating_settings"), "error");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-09-17 22:27:25 +00:00
|
|
|
const [confirmPasswordOpen, setConfirmPasswordOpen] = useState(false);
|
2022-12-08 09:50:03 +00:00
|
|
|
const [tempFormValues, setTempFormValues] = useState<FormValues | null>(null);
|
2022-09-17 22:27:25 +00:00
|
|
|
const [confirmPasswordErrorMessage, setConfirmPasswordDeleteErrorMessage] = useState("");
|
2022-12-08 09:50:03 +00:00
|
|
|
|
2022-08-26 00:11:41 +00:00
|
|
|
const [deleteAccountOpen, setDeleteAccountOpen] = useState(false);
|
2022-09-06 18:23:17 +00:00
|
|
|
const [hasDeleteErrors, setHasDeleteErrors] = useState(false);
|
|
|
|
const [deleteErrorMessage, setDeleteErrorMessage] = useState("");
|
|
|
|
const form = useForm<DeleteAccountValues>();
|
|
|
|
|
|
|
|
const onDeleteMeSuccessMutation = async () => {
|
2022-11-10 23:40:01 +00:00
|
|
|
await utils.viewer.me.invalidate();
|
2022-09-06 18:23:17 +00:00
|
|
|
showToast(t("Your account was deleted"), "success");
|
|
|
|
|
|
|
|
setHasDeleteErrors(false); // dismiss any open errors
|
2022-08-26 00:11:41 +00:00
|
|
|
if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") {
|
|
|
|
signOut({ callbackUrl: "/auth/logout?survey=true" });
|
|
|
|
} else {
|
|
|
|
signOut({ callbackUrl: "/auth/logout" });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const confirmPasswordMutation = trpc.viewer.auth.verifyPassword.useMutation({
|
2022-09-17 22:27:25 +00:00
|
|
|
onSuccess() {
|
2022-12-08 09:50:03 +00:00
|
|
|
if (tempFormValues) mutation.mutate(tempFormValues);
|
2022-09-17 22:27:25 +00:00
|
|
|
setConfirmPasswordOpen(false);
|
|
|
|
},
|
|
|
|
onError() {
|
|
|
|
setConfirmPasswordDeleteErrorMessage(t("incorrect_password"));
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-09-06 18:23:17 +00:00
|
|
|
const onDeleteMeErrorMutation = (error: TRPCClientErrorLike<AppRouter>) => {
|
|
|
|
setHasDeleteErrors(true);
|
|
|
|
setDeleteErrorMessage(errorMessages[error.message]);
|
|
|
|
};
|
2022-11-10 23:40:01 +00:00
|
|
|
const deleteMeMutation = trpc.viewer.deleteMe.useMutation({
|
2022-09-06 18:23:17 +00:00
|
|
|
onSuccess: onDeleteMeSuccessMutation,
|
|
|
|
onError: onDeleteMeErrorMutation,
|
|
|
|
async onSettled() {
|
2022-11-10 23:40:01 +00:00
|
|
|
await utils.viewer.me.invalidate();
|
2022-09-06 18:23:17 +00:00
|
|
|
},
|
|
|
|
});
|
2022-11-10 23:40:01 +00:00
|
|
|
const deleteMeWithoutPasswordMutation = trpc.viewer.deleteMeWithoutPassword.useMutation({
|
2022-10-25 00:32:00 +00:00
|
|
|
onSuccess: onDeleteMeSuccessMutation,
|
|
|
|
onError: onDeleteMeErrorMutation,
|
|
|
|
async onSettled() {
|
2022-11-10 23:40:01 +00:00
|
|
|
await utils.viewer.me.invalidate();
|
2022-10-25 00:32:00 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const isCALIdentityProviver = user?.identityProvider === IdentityProvider.CAL;
|
2022-09-06 18:23:17 +00:00
|
|
|
|
2022-09-17 22:27:25 +00:00
|
|
|
const onConfirmPassword = (e: Event | React.MouseEvent<HTMLElement, MouseEvent>) => {
|
|
|
|
e.preventDefault();
|
2022-10-25 00:32:00 +00:00
|
|
|
|
2022-09-17 22:27:25 +00:00
|
|
|
const password = passwordRef.current.value;
|
|
|
|
confirmPasswordMutation.mutate({ passwordInput: password });
|
|
|
|
};
|
|
|
|
|
2022-09-06 18:23:17 +00:00
|
|
|
const onConfirmButton = (e: Event | React.MouseEvent<HTMLElement, MouseEvent>) => {
|
|
|
|
e.preventDefault();
|
2022-10-25 00:32:00 +00:00
|
|
|
if (isCALIdentityProviver) {
|
|
|
|
const totpCode = form.getValues("totpCode");
|
|
|
|
const password = passwordRef.current.value;
|
|
|
|
deleteMeMutation.mutate({ password, totpCode });
|
|
|
|
} else {
|
|
|
|
deleteMeWithoutPasswordMutation.mutate();
|
|
|
|
}
|
2022-09-06 18:23:17 +00:00
|
|
|
};
|
2022-12-08 09:50:03 +00:00
|
|
|
|
2022-09-06 18:23:17 +00:00
|
|
|
const onConfirm = ({ totpCode }: DeleteAccountValues, e: BaseSyntheticEvent | undefined) => {
|
|
|
|
e?.preventDefault();
|
2022-10-25 00:32:00 +00:00
|
|
|
if (isCALIdentityProviver) {
|
|
|
|
const password = passwordRef.current.value;
|
|
|
|
deleteMeMutation.mutate({ password, totpCode });
|
|
|
|
} else {
|
|
|
|
deleteMeWithoutPasswordMutation.mutate();
|
|
|
|
}
|
2022-09-06 18:23:17 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 12:57:31 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
2022-09-06 18:23:17 +00:00
|
|
|
const passwordRef = useRef<HTMLInputElement>(null!);
|
|
|
|
|
|
|
|
const errorMessages: { [key: string]: string } = {
|
|
|
|
[ErrorCode.SecondFactorRequired]: t("2fa_enabled_instructions"),
|
|
|
|
[ErrorCode.IncorrectPassword]: `${t("incorrect_password")} ${t("please_try_again")}`,
|
|
|
|
[ErrorCode.UserNotFound]: t("no_account_exists"),
|
|
|
|
[ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t("please_try_again")}`,
|
|
|
|
[ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t("please_try_again_and_contact_us")}`,
|
|
|
|
[ErrorCode.ThirdPartyIdentityProviderEnabled]: t("account_created_with_identity_provider"),
|
|
|
|
};
|
2022-08-26 00:11:41 +00:00
|
|
|
|
2022-12-08 09:50:03 +00:00
|
|
|
if (isLoading || !user || isLoadingAvatar || !avatar)
|
2023-01-06 17:35:32 +00:00
|
|
|
return (
|
|
|
|
<SkeletonLoader title={t("profile")} description={t("profile_description", { appName: APP_NAME })} />
|
|
|
|
);
|
2022-12-07 20:53:44 +00:00
|
|
|
|
2022-12-08 09:50:03 +00:00
|
|
|
const defaultValues = {
|
|
|
|
username: user.username || "",
|
|
|
|
avatar: avatar.avatar || "",
|
|
|
|
name: user.name || "",
|
|
|
|
email: user.email || "",
|
|
|
|
bio: user.bio || "",
|
|
|
|
};
|
2022-09-15 09:05:26 +00:00
|
|
|
|
2022-08-26 00:11:41 +00:00
|
|
|
return (
|
|
|
|
<>
|
2022-12-07 20:53:44 +00:00
|
|
|
<Meta title={t("profile")} description={t("profile_description", { appName: APP_NAME })} />
|
2022-12-08 09:50:03 +00:00
|
|
|
<ProfileForm
|
|
|
|
key={JSON.stringify(defaultValues)}
|
|
|
|
defaultValues={defaultValues}
|
2023-05-30 14:18:49 +00:00
|
|
|
isLoading={mutation.isLoading}
|
2022-12-08 09:50:03 +00:00
|
|
|
onSubmit={(values) => {
|
|
|
|
if (values.email !== user.email && isCALIdentityProviver) {
|
|
|
|
setTempFormValues(values);
|
2022-09-17 22:27:25 +00:00
|
|
|
setConfirmPasswordOpen(true);
|
|
|
|
} else {
|
|
|
|
mutation.mutate(values);
|
|
|
|
}
|
2022-12-08 09:50:03 +00:00
|
|
|
}}
|
|
|
|
extraField={
|
|
|
|
<div className="mt-8">
|
|
|
|
<UsernameAvailabilityField
|
|
|
|
onSuccessMutation={async () => {
|
|
|
|
showToast(t("settings_updated_successfully"), "success");
|
|
|
|
await utils.viewer.me.invalidate();
|
|
|
|
}}
|
|
|
|
onErrorMutation={() => {
|
|
|
|
showToast(t("error_updating_settings"), "error");
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
|
2023-04-05 18:14:46 +00:00
|
|
|
<hr className="border-subtle my-6" />
|
2022-12-08 09:50:03 +00:00
|
|
|
|
|
|
|
<Label>{t("danger_zone")}</Label>
|
|
|
|
{/* Delete account Dialog */}
|
|
|
|
<Dialog open={deleteAccountOpen} onOpenChange={setDeleteAccountOpen}>
|
|
|
|
<DialogTrigger asChild>
|
2023-04-12 15:26:31 +00:00
|
|
|
<Button data-testid="delete-account" color="destructive" className="mt-1" StartIcon={Trash2}>
|
2022-12-08 09:50:03 +00:00
|
|
|
{t("delete_account")}
|
|
|
|
</Button>
|
|
|
|
</DialogTrigger>
|
|
|
|
<DialogContent
|
|
|
|
title={t("delete_account_modal_title")}
|
|
|
|
description={t("confirm_delete_account_modal", { appName: APP_NAME })}
|
|
|
|
type="creation"
|
2023-04-12 15:26:31 +00:00
|
|
|
Icon={AlertTriangle}>
|
2022-12-08 09:50:03 +00:00
|
|
|
<>
|
2023-06-29 07:47:16 +00:00
|
|
|
<div className="mb-10">
|
|
|
|
<p className="text-default mb-4">
|
|
|
|
{t("delete_account_confirmation_message", { appName: APP_NAME })}
|
|
|
|
</p>
|
|
|
|
{isCALIdentityProviver && (
|
|
|
|
<PasswordField
|
|
|
|
data-testid="password"
|
|
|
|
name="password"
|
|
|
|
id="password"
|
|
|
|
autoComplete="current-password"
|
|
|
|
required
|
|
|
|
label="Password"
|
|
|
|
ref={passwordRef}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{user?.twoFactorEnabled && isCALIdentityProviver && (
|
|
|
|
<Form handleSubmit={onConfirm} className="pb-4" form={form}>
|
|
|
|
<TwoFactor center={false} />
|
|
|
|
</Form>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{hasDeleteErrors && <Alert severity="error" title={deleteErrorMessage} />}
|
|
|
|
</div>
|
|
|
|
<DialogFooter showDivider>
|
|
|
|
<DialogClose />
|
2022-12-08 09:50:03 +00:00
|
|
|
<Button
|
|
|
|
color="primary"
|
|
|
|
data-testid="delete-account-confirm"
|
|
|
|
onClick={(e) => onConfirmButton(e)}>
|
|
|
|
{t("delete_my_account")}
|
|
|
|
</Button>
|
|
|
|
</DialogFooter>
|
|
|
|
</>
|
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
2022-09-17 22:27:25 +00:00
|
|
|
|
|
|
|
{/* If changing email, confirm password */}
|
|
|
|
<Dialog open={confirmPasswordOpen} onOpenChange={setConfirmPasswordOpen}>
|
|
|
|
<DialogContent
|
|
|
|
title={t("confirm_password")}
|
|
|
|
description={t("confirm_password_change_email")}
|
|
|
|
type="creation"
|
2023-04-12 15:26:31 +00:00
|
|
|
Icon={AlertTriangle}>
|
2023-06-29 07:47:16 +00:00
|
|
|
<div className="mb-10">
|
2022-09-17 22:27:25 +00:00
|
|
|
<PasswordField
|
|
|
|
data-testid="password"
|
|
|
|
name="password"
|
|
|
|
id="password"
|
|
|
|
autoComplete="current-password"
|
|
|
|
required
|
|
|
|
label="Password"
|
|
|
|
ref={passwordRef}
|
|
|
|
/>
|
|
|
|
|
|
|
|
{confirmPasswordErrorMessage && <Alert severity="error" title={confirmPasswordErrorMessage} />}
|
2023-06-29 07:47:16 +00:00
|
|
|
</div>
|
|
|
|
<DialogFooter showDivider>
|
|
|
|
<Button color="primary" onClick={(e) => onConfirmPassword(e)}>
|
|
|
|
{t("confirm")}
|
|
|
|
</Button>
|
|
|
|
<DialogClose />
|
|
|
|
</DialogFooter>
|
2022-09-17 22:27:25 +00:00
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
2022-08-26 00:11:41 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-12-08 09:50:03 +00:00
|
|
|
const ProfileForm = ({
|
|
|
|
defaultValues,
|
|
|
|
onSubmit,
|
|
|
|
extraField,
|
2023-05-30 14:18:49 +00:00
|
|
|
isLoading = false,
|
2022-12-08 09:50:03 +00:00
|
|
|
}: {
|
|
|
|
defaultValues: FormValues;
|
|
|
|
onSubmit: (values: FormValues) => void;
|
|
|
|
extraField?: React.ReactNode;
|
2023-05-30 14:18:49 +00:00
|
|
|
isLoading: boolean;
|
2022-12-08 09:50:03 +00:00
|
|
|
}) => {
|
|
|
|
const { t } = useLocale();
|
2023-04-19 11:40:18 +00:00
|
|
|
const [firstRender, setFirstRender] = useState(true);
|
2023-03-21 10:43:07 +00:00
|
|
|
|
|
|
|
const profileFormSchema = z.object({
|
|
|
|
username: z.string(),
|
|
|
|
avatar: z.string(),
|
|
|
|
name: z
|
|
|
|
.string()
|
2023-06-30 17:25:48 +00:00
|
|
|
.trim()
|
|
|
|
.min(1, t("you_need_to_add_a_name"))
|
2023-03-21 10:43:07 +00:00
|
|
|
.max(FULL_NAME_LENGTH_MAX_LIMIT, {
|
|
|
|
message: t("max_limit_allowed_hint", { limit: FULL_NAME_LENGTH_MAX_LIMIT }),
|
|
|
|
}),
|
|
|
|
email: z.string().email(),
|
|
|
|
bio: z.string(),
|
|
|
|
});
|
|
|
|
|
2022-12-08 09:50:03 +00:00
|
|
|
const formMethods = useForm<FormValues>({
|
|
|
|
defaultValues,
|
2023-03-21 10:43:07 +00:00
|
|
|
resolver: zodResolver(profileFormSchema),
|
2022-12-08 09:50:03 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const {
|
|
|
|
formState: { isSubmitting, isDirty },
|
|
|
|
} = formMethods;
|
|
|
|
|
|
|
|
const isDisabled = isSubmitting || !isDirty;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Form form={formMethods} handleSubmit={onSubmit}>
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Controller
|
|
|
|
control={formMethods.control}
|
|
|
|
name="avatar"
|
|
|
|
render={({ field: { value } }) => (
|
|
|
|
<>
|
2023-03-23 18:49:28 +00:00
|
|
|
<Avatar alt="" imageSrc={value} gravatarFallbackMd5="fallback" size="lg" />
|
2023-04-09 09:13:57 +00:00
|
|
|
<div className="ms-4">
|
2022-12-08 09:50:03 +00:00
|
|
|
<ImageUploader
|
|
|
|
target="avatar"
|
|
|
|
id="avatar-upload"
|
|
|
|
buttonMsg={t("change_avatar")}
|
|
|
|
handleAvatarChange={(newAvatar) => {
|
|
|
|
formMethods.setValue("avatar", newAvatar, { shouldDirty: true });
|
|
|
|
}}
|
|
|
|
imageSrc={value || undefined}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{extraField}
|
|
|
|
<div className="mt-8">
|
|
|
|
<TextField label={t("full_name")} {...formMethods.register("name")} />
|
|
|
|
</div>
|
|
|
|
<div className="mt-8">
|
|
|
|
<TextField label={t("email")} hint={t("change_email_hint")} {...formMethods.register("email")} />
|
|
|
|
</div>
|
|
|
|
<div className="mt-8">
|
2023-01-25 01:08:10 +00:00
|
|
|
<Label>{t("about")}</Label>
|
|
|
|
<Editor
|
|
|
|
getText={() => md.render(formMethods.getValues("bio") || "")}
|
|
|
|
setText={(value: string) => {
|
2023-01-27 23:14:58 +00:00
|
|
|
formMethods.setValue("bio", turndown(value), { shouldDirty: true });
|
2023-01-25 01:08:10 +00:00
|
|
|
}}
|
|
|
|
excludedToolbarItems={["blockType"]}
|
2023-03-03 23:20:13 +00:00
|
|
|
disableLists
|
2023-04-19 11:40:18 +00:00
|
|
|
firstRender={firstRender}
|
|
|
|
setFirstRender={setFirstRender}
|
2023-01-25 01:08:10 +00:00
|
|
|
/>
|
2022-12-08 09:50:03 +00:00
|
|
|
</div>
|
2023-05-30 14:18:49 +00:00
|
|
|
<Button loading={isLoading} disabled={isDisabled} color="primary" className="mt-8" type="submit">
|
2022-12-08 09:50:03 +00:00
|
|
|
{t("update")}
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-08-26 00:11:41 +00:00
|
|
|
ProfileView.getLayout = getLayout;
|
2023-04-18 18:45:32 +00:00
|
|
|
ProfileView.PageWrapper = PageWrapper;
|
2022-08-26 00:11:41 +00:00
|
|
|
|
|
|
|
export default ProfileView;
|