diff --git a/package-lock.json b/package-lock.json
index d628bd92..68cfbbb8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,6 +34,7 @@
"dotenv": "^16.3.1",
"framer-motion": "^11.0.3",
"js-cookie": "^3.0.5",
+ "lodash": "^4.17.21",
"react": "^18.2.0",
"react-calendar": "^4.8.0",
"react-dom": "^18.2.0",
@@ -13776,7 +13777,8 @@
},
"node_modules/lodash": {
"version": "4.17.21",
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.camelcase": {
"version": "4.3.0",
diff --git a/package.json b/package.json
index 36e922cb..94304f07 100644
--- a/package.json
+++ b/package.json
@@ -48,6 +48,7 @@
"dotenv": "^16.3.1",
"framer-motion": "^11.0.3",
"js-cookie": "^3.0.5",
+ "lodash": "^4.17.21",
"react": "^18.2.0",
"react-calendar": "^4.8.0",
"react-dom": "^18.2.0",
diff --git a/src/components/shared/buttons/globalbutton/Button.jsx b/src/components/shared/buttons/globalbutton/Button.jsx
index 70b1632d..d16d9e3e 100644
--- a/src/components/shared/buttons/globalbutton/Button.jsx
+++ b/src/components/shared/buttons/globalbutton/Button.jsx
@@ -1,5 +1,4 @@
/* eslint-disable react/no-unknown-property */
-import React from "react";
import { Link } from "react-router-dom";
import { ClipLoader } from "react-spinners";
import styles from "./Button.module.css";
diff --git a/src/components/shared/profileCompletion/ProfileCompletion.jsx b/src/components/shared/profileCompletion/ProfileCompletion.jsx
index 79274ca7..be287fca 100644
--- a/src/components/shared/profileCompletion/ProfileCompletion.jsx
+++ b/src/components/shared/profileCompletion/ProfileCompletion.jsx
@@ -1,142 +1,95 @@
/* eslint-disable no-unused-vars */
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-
+import { useState } from "react";
+import { useDispatch, useSelector } from "react-redux";
+
+import { selectUser, updateUserData } from "@redux/slice/userSlice";
+import { UpdateUser } from "@service/MilanApi";
+import { useMutation } from "@tanstack/react-query";
+import { showErrorToast, showSuccessToast } from "@utils/Toasts";
+import _ from "lodash";
+import { Button } from "..";
import getProfileFields from "../../../utils/getProfileFields";
-import Button from "../buttons/globalbutton/Button";
import "./ProfileCompletion.scss";
-const ProfileCompletion = ({ editProfile }) => {
- const [part, setPart] = useState(editProfile ? 2 : 1);
- const [currentStep, setcurrentStep] = useState(2);
- const [currentIndex, setcurrentIndex] = useState(0);
- const [formData, setFormData] = useState({});
- const [errors, setErrors] = useState({});
- const user = useSelector((state) => state.user);
-
- useEffect(() => {
- if (editProfile) {
- setFormData(user);
- }
- }, [editProfile]);
-
- const fields = getProfileFields(user, editProfile);
-
- const totalfields = fields.length;
-
- const handleIncrementStep = () => {
- if (currentStep + 2 <= totalfields) {
- setcurrentIndex(currentIndex + 2);
- setcurrentStep(currentStep + 2);
- }
- };
-
- const handleDecrementStep = () => {
- if (currentStep - 2 >= 2) {
- setcurrentIndex(currentIndex - 2);
- setcurrentStep(currentStep - 2);
- }
- };
+const ProfileCompletion = () => {
+ const [credentials, setCredentials] = useState({});
+ const user = useSelector(selectUser);
+ const fields = getProfileFields(user);
+ const dispatch = useDispatch();
const handleChange = (e) => {
- setFormData({ ...formData, [e.target.name]: e.target.value });
- setErrors({ ...errors, [e.target.name]: undefined });
+ setCredentials({
+ ...credentials,
+ [e.target.name]: e.target.value,
+ });
};
- const handleSubmit = async (e) => {
- e.preventDefault();
-
- // formData is an object
- // lenght of an object
-
- // const response = await UpdateUser(formData);
- // if (response?.status !== 200) {
- // showErrorToast(response?.data?.message);
- // } else {
- // dispatch(updateUserData(formData));
- // setFormData({});
- // setShowProfileModal(false);
- // seteditProfile(false);
- // showSuccessToast(response?.data?.message);
- // mutate(clubEndpoints.details(user?.userName));
- // }
- };
+ const { mutate: handleUpdateDetails } = useMutation({
+ mutationFn: UpdateUser,
+ onSuccess: (data) => {
+ dispatch(updateUserData(credentials));
+ showSuccessToast(data?.message);
+ },
+ onError: (error) => {
+ showErrorToast(error?.message);
+ },
+ });
return (
- {part === 1 ? (
-
Choose Account Type
- ) : (
-
{editProfile ? "Edit Profile" : `We're almost done`}
- )}
+
We're almost done
- {part === 1 ? (
-
Your Account Type is permanent and cannot be changed later.
- ) : !editProfile ? (
-
- Please complete your profile to enjoy the full benefits of the
- platform.
-
- ) : null}
+
+ To make your Organization visible to others, please complete your
+ profile.
+
- {/*
*/}
-
-
-
- {currentStep == totalfields ? (
+
+
);
diff --git a/src/components/shared/profileCompletion/ProfileCompletion.scss b/src/components/shared/profileCompletion/ProfileCompletion.scss
index 425584da..027ec9ac 100644
--- a/src/components/shared/profileCompletion/ProfileCompletion.scss
+++ b/src/components/shared/profileCompletion/ProfileCompletion.scss
@@ -37,6 +37,7 @@
font-weight: 700;
color: var(--secondary);
font-family: var(--outfit);
+ margin-bottom: 0;
@media screen and (max-width: 500px) {
font-size: 1.5rem;
@@ -44,7 +45,7 @@
}
p {
- font-size: 1.1rem;
+ font-size: 15px;
font-weight: 400;
color: black;
font-family: var(--outfit);
@@ -63,9 +64,9 @@
flex-direction: column;
position: relative;
width: 100%;
+ font-family: var(--outfit);
label {
- font-family: var(--outfit);
font-size: 17px;
font-weight: 400;
margin-bottom: 3px;
@@ -85,7 +86,6 @@
font-size: 16px;
color: red;
margin-top: 5px;
- font-family: var(--outfit);
}
input,
@@ -136,7 +136,6 @@
padding: 0.5rem 1rem;
font-size: 1rem;
font-weight: 500;
-
border-radius: 5px;
transition: all 0.3s ease;
@@ -145,16 +144,3 @@
}
}
}
-
-.crossButton {
- padding: 0;
- margin: 0;
- position: absolute;
- right: 12px;
- top: 7px;
- font-size: 27px;
- border: 0;
- box-shadow: none;
- color: var(--secondary);
- cursor: pointer;
-}
diff --git a/src/pages/auth/SignUp.jsx b/src/pages/auth/SignUp.jsx
index e06a6ffb..1d075260 100644
--- a/src/pages/auth/SignUp.jsx
+++ b/src/pages/auth/SignUp.jsx
@@ -6,6 +6,7 @@ import { FaEye } from "react-icons/fa";
import { FaEyeSlash } from "react-icons/fa6";
import { FcGoogle } from "react-icons/fc";
import { Link } from "react-router-dom";
+import Select from "react-select";
import rightabstract from "../../assets/pictures/authpages/authbanner.png";
import { Button } from "../../components/shared";
import { useAuth } from "../../hooks/useAuth";
@@ -60,7 +61,36 @@ const SignUp = () => {
-
+
+
+
+
+