import { observer } from "mobx-react"; import { ProfileIcon } from "outline-icons"; import * as React from "react"; import { Trans, useTranslation } from "react-i18next"; import { toast } from "sonner"; import Button from "~/components/Button"; import Heading from "~/components/Heading"; import Input from "~/components/Input"; import Scene from "~/components/Scene"; import Text from "~/components/Text"; import useCurrentUser from "~/hooks/useCurrentUser"; import ImageInput from "./components/ImageInput"; import SettingRow from "./components/SettingRow"; const Profile = () => { const user = useCurrentUser(); const form = React.useRef(null); const [name, setName] = React.useState(user.name || ""); const { t } = useTranslation(); const handleSubmit = async (ev: React.SyntheticEvent) => { ev.preventDefault(); try { await user.save({ name }); toast.success(t("Profile saved")); } catch (err) { toast.error(err.message); } }; const handleNameChange = (ev: React.ChangeEvent) => { setName(ev.target.value); }; const handleAvatarUpload = async (avatarUrl: string) => { await user.save({ avatarUrl }); toast.success(t("Profile picture updated")); }; const handleAvatarError = (error: string | null | undefined) => { toast.error(error || t("Unable to upload new profile picture")); }; const isValid = form.current?.checkValidity(); const { isSaving } = user; return ( }> {t("Profile")} Manage how you appear to other members of the workspace.
); }; export default observer(Profile);