This commit is contained in:
Alex Holliday committed 2025-12-12 12:17:18 -08:00
1 parent c9dea5c0ae
commit 901b5a43c8
20 files changed
+393 -137

No files matched your search

+4 -2
View File
@@ -7,9 +7,11 @@ import type { ApiResponse } from "@/hooks/UseApi";
import { useGet, usePatch } from "@/hooks/UseApi";
import { z } from "zod";
import { profileSchema } from "@/validation/zod";
import { useTranslation } from "react-i18next";
type FormValues = z.infer<typeof profileSchema>;
const Profile = () => {
const { t } = useTranslation();
const [user, setUser] = useState<Partial<IUser> | null>(null);
const { response, loading } = useGet<ApiResponse<any>>(`/profile`, {}, {});
useEffect(() => {
@@ -32,8 +34,8 @@ const Profile = () => {
return (
<BasePage>
<InfoBox
title="View and edit your profile"
description="You can set your name and password here"
title={t("profile.infoBox.title")}
description={t("profile.infoBox.description")}
/>
<ProfileForm
user={user}
+9 -9
View File
@@ -71,9 +71,9 @@ export const ProfileForm = ({
<TextInput
value={user?.email || ""}
disabled
fieldLabel={t("auth.common.inputs.email.label")}
fieldLabel={t("auth.common.form.optionEmail")}
fullWidth
placeholder={t("auth.common.inputs.email.placeholder")}
placeholder={t("auth.common.form.optionEmailPlaceholder")}
/>
<Controller
name="firstName"
@@ -82,9 +82,9 @@ export const ProfileForm = ({
render={({ field }) => (
<TextInput
{...field}
fieldLabel={t("auth.common.inputs.firstName.label")}
fieldLabel={t("auth.common.form.optionFirstName")}
fullWidth
placeholder={t("auth.common.inputs.firstName.placeholder")}
placeholder={t("auth.common.form.optionFirstNamePlaceholder")}
error={!!errors.firstName}
helperText={errors.firstName ? errors.firstName.message : ""}
/>
@@ -97,9 +97,9 @@ export const ProfileForm = ({
render={({ field }) => (
<TextInput
{...field}
fieldLabel={t("auth.common.inputs.lastName.label")}
fieldLabel={t("auth.common.form.optionLastName")}
fullWidth
placeholder={t("auth.common.inputs.lastName.placeholder")}
placeholder={t("auth.common.form.optionLastNamePlaceholder")}
error={!!errors.lastName}
helperText={errors.lastName ? errors.lastName.message : ""}
/>
@@ -113,7 +113,7 @@ export const ProfileForm = ({
<TextInput
{...field}
type="password"
fieldLabel={t("auth.common.inputs.password.label")}
fieldLabel={t("auth.common.form.optionPassword")}
fullWidth
error={!!errors.password}
helperText={errors.password ? errors.password.message : ""}
@@ -128,7 +128,7 @@ export const ProfileForm = ({
<TextInput
{...field}
type="password"
fieldLabel={t("auth.common.inputs.passwordConfirm.label")}
fieldLabel={t("auth.common.form.optionConfirmPassword")}
fullWidth
error={!!errors.confirmPassword}
helperText={
@@ -144,7 +144,7 @@ export const ProfileForm = ({
type="submit"
sx={{ width: "100%", alignSelf: "center", fontWeight: 700 }}
>
Update profile
{t("common.buttons.updateProfile")}
</Button>
</Stack>
);