unmount profile modal after update

This commit is contained in:
Kalle (Sendou) 2020-10-25 22:37:43 +02:00
parent 199eae33d9
commit ba761becfd
2 changed files with 8 additions and 17 deletions

View File

@ -68,7 +68,6 @@ const sensToString = (sens: number | undefined | null) => {
};
interface Props {
isOpen: boolean;
onClose: () => void;
existingProfile?: NonNullable<
GetUserByIdentifierQuery["getUserByIdentifier"]
@ -77,11 +76,7 @@ interface Props {
type FormData = z.infer<typeof profileSchemaFrontend>;
const ProfileModal: React.FC<Props> = ({
isOpen,
onClose,
existingProfile,
}) => {
const ProfileModal: React.FC<Props> = ({ onClose, existingProfile }) => {
const { t } = useTranslation();
const { handleSubmit, errors, register, watch, control } = useForm<FormData>({
@ -154,12 +149,7 @@ const ProfileModal: React.FC<Props> = ({
};
return (
<Modal
isOpen={isOpen}
onClose={onClose}
size="xl"
closeOnOverlayClick={false}
>
<Modal isOpen onClose={onClose} size="xl" closeOnOverlayClick={false}>
<ModalOverlay>
<ModalContent>
<ModalHeader>{t("users;Editing profile")}</ModalHeader>

View File

@ -25,11 +25,12 @@ const Profile: React.FC<Props> = ({ user }) => {
{t("users;Edit profile")}
</Button>
)}
<ProfileModal
isOpen={showModal}
onClose={() => setShowModal(false)}
existingProfile={user.profile}
/>
{showModal && (
<ProfileModal
onClose={() => setShowModal(false)}
existingProfile={user.profile}
/>
)}
{user.profile?.bio && (
<Box my="2em">
<Markdown value={user.profile.bio} />