import type { FunctionComponent } from "react"; import { Form, useActionData, useTransition } from "@remix-run/react"; import type { UpdateUserActionData } from "~/features/settings/actions/account"; import useSession from "~/features/core/hooks/use-session"; import Alert from "~/features/core/components/alert"; import Button from "../button"; import SettingsSection from "../settings-section"; const ProfileInformations: FunctionComponent = () => { const user = useSession(); const transition = useTransition(); const actionData = useActionData()?.updateUser; const errors = actionData?.errors; const topErrorMessage = errors?.general; const isError = typeof topErrorMessage !== "undefined"; const isSuccess = actionData?.submitted; const isCurrentFormTransition = transition.submission?.formData.get("_action") === "updateUser"; const isSubmitting = isCurrentFormTransition && transition.state === "submitting"; return (
} > {isError ? (
) : null} {isSuccess && (
)}
); }; export default ProfileInformations;