Changed to camel case
This commit is contained in:
1 parent
73801fa6cc
commit
c5b56dbc2b
6 files changed
+23
-23
No files matched your search
@@ -30,7 +30,7 @@ const Avatar = ({ src, small, sx }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MuiAvatar
|
<MuiAvatar
|
||||||
alt={`${user?.firstname} ${user?.lastname}`}
|
alt={`${user?.firstName} ${user?.lastName}`}
|
||||||
src={
|
src={
|
||||||
src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"
|
src ? src : user?.avatarImage ? image : "/static/images/avatar/2.jpg"
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ const Avatar = ({ src, small, sx }) => {
|
|||||||
...sx,
|
...sx,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{user.firstname?.charAt(0)}{user.lastname?.charAt(0)}
|
{user.firstName?.charAt(0)}{user.lastName?.charAt(0)}
|
||||||
</MuiAvatar>
|
</MuiAvatar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ function NavBar() {
|
|||||||
<div className="icon-button-toggle">
|
<div className="icon-button-toggle">
|
||||||
<Avatar small={true} sx={{ mr: "8px" }} />
|
<Avatar small={true} sx={{ mr: "8px" }} />
|
||||||
<div className="icon-button-toggle-title">
|
<div className="icon-button-toggle-title">
|
||||||
{authState.user.firstname} {authState.user.lastname}
|
{authState.user.firstName} {authState.user.lastName}
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
className="icon-button-toggle-pic"
|
className="icon-button-toggle-pic"
|
||||||
|
|||||||
@@ -36,16 +36,16 @@ const ProfilePanel = () => {
|
|||||||
const { user, authToken, isLoading } = useSelector((state) => state.auth);
|
const { user, authToken, isLoading } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
const idToName = {
|
const idToName = {
|
||||||
"edit-first-name": "firstname",
|
"edit-first-name": "firstName",
|
||||||
"edit-last-name": "lastname",
|
"edit-last-name": "lastName",
|
||||||
// Disabled for now, will revisit in the future
|
// Disabled for now, will revisit in the future
|
||||||
// "edit-email": "email",
|
// "edit-email": "email",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Local state for form data, errors, and file handling
|
// Local state for form data, errors, and file handling
|
||||||
const [localData, setLocalData] = useState({
|
const [localData, setLocalData] = useState({
|
||||||
firstname: user.firstname,
|
firstName: user.firstName,
|
||||||
lastname: user.lastname,
|
lastName: user.lastName,
|
||||||
// email: user.email, // Disabled for now
|
// email: user.email, // Disabled for now
|
||||||
});
|
});
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
@@ -156,8 +156,8 @@ const ProfilePanel = () => {
|
|||||||
const handleSaveProfile = async (event) => {
|
const handleSaveProfile = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (
|
if (
|
||||||
localData.firstname === user.firstname &&
|
localData.firstName === user.firstName &&
|
||||||
localData.lastname === user.lastname &&
|
localData.lastName === user.lastName &&
|
||||||
localData.deleteProfileImage === undefined &&
|
localData.deleteProfileImage === undefined &&
|
||||||
localData.file === undefined
|
localData.file === undefined
|
||||||
) {
|
) {
|
||||||
@@ -223,7 +223,7 @@ const ProfilePanel = () => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
<Field
|
<Field
|
||||||
id="edit-first-name"
|
id="edit-first-name"
|
||||||
value={localData.firstname}
|
value={localData.firstName}
|
||||||
placeholder="Enter your first name"
|
placeholder="Enter your first name"
|
||||||
autoComplete="given-name"
|
autoComplete="given-name"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
@@ -238,7 +238,7 @@ const ProfilePanel = () => {
|
|||||||
id="edit-last-name"
|
id="edit-last-name"
|
||||||
placeholder="Enter your last name"
|
placeholder="Enter your last name"
|
||||||
autoComplete="family-name"
|
autoComplete="family-name"
|
||||||
value={localData.lastname}
|
value={localData.lastName}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors[idToName["edit-last-name"]]}
|
error={errors[idToName["edit-last-name"]]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ export const update = createAsyncThunk(
|
|||||||
await new Promise((resolve) => setTimeout(resolve, 1500));
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
form.firstname && fd.append("firstname", form.firstname);
|
form.firstName && fd.append("firstName", form.firstName);
|
||||||
form.lastname && fd.append("lastname", form.lastname);
|
form.lastName && fd.append("lastName", form.lastName);
|
||||||
form.password && fd.append("password", form.password);
|
form.password && fd.append("password", form.password);
|
||||||
form.newPassword && fd.append("newPassword", form.newPassword);
|
form.newPassword && fd.append("newPassword", form.newPassword);
|
||||||
if (form.file && form.file !== "") {
|
if (form.file && form.file !== "") {
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ const Register = ({ isAdmin }) => {
|
|||||||
|
|
||||||
// TODO If possible, change the IDs of these fields to match the backend
|
// TODO If possible, change the IDs of these fields to match the backend
|
||||||
const idMap = {
|
const idMap = {
|
||||||
"register-firstname-input": "firstname",
|
"register-firstname-input": "firstName",
|
||||||
"register-lastname-input": "lastname",
|
"register-lastname-input": "lastName",
|
||||||
"register-email-input": "email",
|
"register-email-input": "email",
|
||||||
"register-password-input": "password",
|
"register-password-input": "password",
|
||||||
"register-confirm-input": "confirm",
|
"register-confirm-input": "confirm",
|
||||||
};
|
};
|
||||||
|
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
firstname: "",
|
firstName: "",
|
||||||
lastname: "",
|
lastName: "",
|
||||||
email: "",
|
email: "",
|
||||||
password: "",
|
password: "",
|
||||||
confirm: "",
|
confirm: "",
|
||||||
@@ -129,9 +129,9 @@ const Register = ({ isAdmin }) => {
|
|||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="Daniel"
|
placeholder="Daniel"
|
||||||
autoComplete="given-name"
|
autoComplete="given-name"
|
||||||
value={form.firstname}
|
value={form.firstName}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors.firstname}
|
error={errors.firstName}
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
id="register-lastname-input"
|
id="register-lastname-input"
|
||||||
@@ -139,9 +139,9 @@ const Register = ({ isAdmin }) => {
|
|||||||
isRequired={true}
|
isRequired={true}
|
||||||
placeholder="Cojocea"
|
placeholder="Cojocea"
|
||||||
autoComplete="family-name"
|
autoComplete="family-name"
|
||||||
value={form.lastname}
|
value={form.lastName}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
error={errors.lastname}
|
error={errors.lastName}
|
||||||
/>
|
/>
|
||||||
<Field
|
<Field
|
||||||
type="email"
|
type="email"
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ const passwordSchema = joi
|
|||||||
});
|
});
|
||||||
|
|
||||||
const credentials = joi.object({
|
const credentials = joi.object({
|
||||||
firstname: nameSchema,
|
firstName: nameSchema,
|
||||||
lastname: nameSchema,
|
lastName: nameSchema,
|
||||||
email: joi
|
email: joi
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
Reference in new issue
Block a user