Skip to content

Commit

Permalink
Merge pull request #1637 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Dev Server
  • Loading branch information
nashnsulthan authored Oct 6, 2024
2 parents e2b936c + 68d06d3 commit 74fa5e8
Show file tree
Hide file tree
Showing 19 changed files with 2,091 additions and 127 deletions.
3 changes: 2 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
VITE_BACKEND_URL=
VITE_FRONTEND_URL=
VITE_DISCORD_INVITE_URL=
VITE_RAZORPAY_KEY_ID=
VITE_RAZORPAY_KEY_ID=
VITE_DISCORD_AUTH_URL=
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"react-select": "^5.7.7",
"react-spinners": "^0.13.8",
"react-tabs": "^6.0.1",
"react-tag-input-component": "^2.0.2",
"react-tooltip": "^5.18.1",
"recharts": "^2.10.2",
"sass": "^1.62.1",
Expand Down
8 changes: 8 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
.rti--container {
width: 250px;
max-height: 100px;
overflow: scroll;
}
.rti--container .rti--input {
width: 100%;
}

.css-13cymwt-control,
.css-t3ipsp-control {
Expand Down
15 changes: 14 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Donation from "./modules/Public/Donation/Donation";
import Refund from "./modules/Public/Donation/pages/Refund";
import DonationSuccess from "./modules/Public/Donation/pages/DonationSuccess";
import OpenGrad from "./modules/Dashboard/modules/OpenGrad";
import UserInterest from "./modules/Common/Authentication/pages/Onboarding/UserInterest/UserInterest";

const Profile = lazy(
() => import("./modules/Dashboard/modules/Profile/pages/Profile")
Expand Down Expand Up @@ -291,7 +292,19 @@ function App() {
element: <AuthRoutes />,
children: [
{ path: "register/:role", element: <AccountCreation /> },
{ path: "register/", element: <AccountCreation /> },
{
path: "register/",
children: [
{
path: "",
element: <AccountCreation />
},
{
path: "interests",
element: <UserInterest />
}
]
},
{ path: "login", element: <SignIn /> },
{ path: "forgot-password", element: <ForgetPassword /> },
{ path: "reset-password", element: <ResetPassword /> }
Expand Down
351 changes: 351 additions & 0 deletions src/modules/Common/Authentication/assets/interests/creative.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
201 changes: 201 additions & 0 deletions src/modules/Common/Authentication/assets/interests/makers.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
342 changes: 342 additions & 0 deletions src/modules/Common/Authentication/assets/interests/management.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
222 changes: 222 additions & 0 deletions src/modules/Common/Authentication/assets/interests/others.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
160 changes: 160 additions & 0 deletions src/modules/Common/Authentication/assets/interests/software.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,20 @@ import { HiEye, HiEyeSlash } from "react-icons/hi2";

import OnboardingTemplate from "../../../components/OnboardingTeamplate/OnboardingTemplate";
import OnboardingHeader from "../../../components/OnboardingHeader/OnboardingHeader";
import {
getDWMSDetails,
getRoles,
validate
} from "../../../services/newOnboardingApis";
import { getDWMSDetails } from "../../../services/newOnboardingApis";
import { Form, Formik } from "formik";
import * as z from "yup";
import { FormikTextInputWithoutLabel as SimpleInput } from "@/MuLearnComponents/FormikComponents/FormikComponents";
import { PowerfulButton } from "@/MuLearnComponents/MuButtons/MuButton";
import { useEffect, useRef, useState } from "react";
import { useEffect, useState } from "react";

// import { useToast } from "@chakra-ui/react";
import { useNavigate, useParams } from "react-router-dom";
import Select from "react-select";
import makeAnimated from "react-select/animated";
import { getCommunities } from "../../../services/onboardingApis";
import { BiSupport } from "react-icons/bi";
import { isDev } from "@/MuLearnServices/common_functions";
import roleOptions from "../RolePage/data/roleOptions";
import muBrand from "/src/modules/Common/Authentication/assets/µLearn.png";
import { submitUserData } from "../../../services/newOnboardingApis";
import toast from "react-hot-toast";

const animatedComponents = makeAnimated();

type DWMSData = {
email: string;
fullName: string;
Expand Down Expand Up @@ -77,29 +66,29 @@ const scheme = z.object({

export default function AccountCreation() {
let { role } = useParams();
const [popUP, setPopUp] = useState(role ? false : true);
// const [popUP, setPopUp] = useState(role ? false : true);
// const toast = useToast();
const navigate = useNavigate();
const [roles, setRoles] = useState([{ id: "", title: "" }]);
// const [roles, setRoles] = useState([{ id: "", title: "" }]);
const urlParams = new URLSearchParams(window.location.search);
const param = urlParams.get("param");
const referralId = urlParams.get("referral_id");
const [selectedRoleId, setSelectedRoleId] = useState<string>("");
const [selectedRole, setSelectedRole] = useState<string>("");
// const [selectedRoleId, setSelectedRoleId] = useState<string>("");
// const [selectedRole, setSelectedRole] = useState<string>("");

//ref to community selector for resetting - temporary fix
const community_select_ref = useRef<any>();
// const community_select_ref = useRef<any>();

const [isLoading, setIsLoading] = useState(false);
const [isVisible, setVisible] = useState(false);
const [isVisibleC, setVisibleC] = useState(false);
// const [isVisibleC, setVisibleC] = useState(false);
const [dwmsData, setDWMSData] = useState<DWMSData>();

const [isTncChecked, setTncChecked] = useState(false);

const [communitiesList, setCommunitiesList] = useState([
{ id: "", title: "" }
]);
// const [communitiesList, setCommunitiesList] = useState([
// { id: "", title: "" }
// ]);
const [initialValues, setInitialValues] = useState({
email: "",
fullName: "",
Expand All @@ -117,19 +106,6 @@ export default function AccountCreation() {
useEffect(() => {
if (isLoading) return;
setIsLoading(true);
getCommunities({
setCommunityAPI: setCommunitiesList,
setIsLoading: setIsLoading
});
getRoles().then((res: any) => {
setRoles(res);
setIsLoading(false);
setSelectedRoleId(
res.find((role: any) => role.title.toLowerCase() === role)
?.id || ""
);
// setSelectedRole(role);
});
if (param) {
getDWMSDetails(param, (data: any) => {
setDWMSData({
Expand Down Expand Up @@ -206,14 +182,6 @@ export default function AccountCreation() {
userData.communities = values.communities;
}

if (role) {
userData.role = roles.find(e => e.title.toLowerCase() === role)?.id;
}

if (selectedRoleId) {
userData.role = selectedRoleId;
}

if (param) {
userData.integration = {
param: param,
Expand All @@ -225,22 +193,22 @@ export default function AccountCreation() {
userData.dob = dwmsData.dob;
}

const isSuccess = await validate({
// const isSuccess = await validate({
// userData: userData,
// setIsSubmitting: setIsLoading
// // toast: toast // Make sure to pass the toast parameter correctly
// });
submitUserData({
setIsLoading: setIsLoading,
userData: userData,
setIsSubmitting: setIsLoading
// toast: toast // Make sure to pass the toast parameter correctly
// toast: toast,
navigate: navigate
});
// if (isSuccess && selectedRole.toLowerCase() !== "other") {
// navigate("/register/about", { state: userData });
// } else if (isSuccess && selectedRole.toLowerCase() === "other") {

if (isSuccess && selectedRole.toLowerCase() !== "other") {
navigate("/register/about", { state: userData });
} else if (isSuccess && selectedRole.toLowerCase() === "other") {
submitUserData({
setIsLoading: setIsLoading,
userData: userData,
// toast: toast,
navigate: navigate
});
}
// }
};
// console.log(selectedRole, role);

Expand All @@ -258,7 +226,7 @@ export default function AccountCreation() {
>
{formik => (
<Form>
{popUP && (
{/* {popUP && (
<div className={styles.popUp}>
<div className={styles.box}>
<img src={muBrand} alt="mulearn" />
Expand Down Expand Up @@ -302,7 +270,7 @@ export default function AccountCreation() {
</div>
</div>
</div>
)}
)} */}
<div className={styles.accountCreationContainer}>
<div className={styles.accountCreationInputs}>
<div className={styles.inputBox}>
Expand Down Expand Up @@ -628,13 +596,7 @@ export default function AccountCreation() {
style={{ marginTop: "10px" }}
isLoading={isLoading}
>
{selectedRole.toLowerCase() !== "other"
? isLoading
? "Validating..."
: "Next Step"
: isLoading
? "Validating..."
: "Submit"}
{isLoading ? "Validating..." : "Submit"}
</PowerfulButton>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function CollegePage({
): boolean => {
if (value === "Others") return true; // Always show "Others" option
if (!string) return true;
return label.toLowerCase().startsWith(string.toLowerCase());
return label.toLowerCase().includes(string.toLowerCase());
};

useEffect(() => {
Expand Down
Loading

0 comments on commit 74fa5e8

Please sign in to comment.