From 03ccec54e2ee51a7f8e03e4e7e82feb0d30c8b20 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 8 Nov 2023 15:32:16 +0530 Subject: [PATCH 1/7] when we select ACB pathway then ACB partner should selected --- src/components/Class/ClassForm.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/Class/ClassForm.js b/src/components/Class/ClassForm.js index ba4d4842c..61a8958fe 100644 --- a/src/components/Class/ClassForm.js +++ b/src/components/Class/ClassForm.js @@ -787,6 +787,25 @@ function ClassForm({ .join(", ") .replace(/,([^,]*)$/, " and$1"); + const pathwayData = Newpathways.find((item) => { + return item.id === classFields.pathway_id; + }); + + useEffect(() => { + if (pathwayData?.code === "ACB") { + const amazonCodingBootcamp = partnerData.find( + (partner) => partner.label?.toLowerCase() === "amazon coding bootcamp" + ); + if (amazonCodingBootcamp) { + setSelectedPartners([amazonCodingBootcamp]); + setClassFields({ + ...classFields, + ["partner_id"]: [amazonCodingBootcamp.id], + }); + } + } + }, [pathwayData, partnerData]); + return ( <> {showSuccessModal ? ( From f0f78d8220552ade658d368a06ab1a6554981061 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 8 Nov 2023 15:34:20 +0530 Subject: [PATCH 2/7] when we select ACB pathway then ACB partner should selected --- src/components/Class/ClassForm.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Class/ClassForm.js b/src/components/Class/ClassForm.js index 61a8958fe..ab01c1a5e 100644 --- a/src/components/Class/ClassForm.js +++ b/src/components/Class/ClassForm.js @@ -792,11 +792,12 @@ function ClassForm({ }); useEffect(() => { + if (pathwayData?.code === "ACB") { const amazonCodingBootcamp = partnerData.find( (partner) => partner.label?.toLowerCase() === "amazon coding bootcamp" ); - if (amazonCodingBootcamp) { + if (amazonCodingBootcamp ) { setSelectedPartners([amazonCodingBootcamp]); setClassFields({ ...classFields, From 82de8ae601202246be9d43c8976d8e5831a314a5 Mon Sep 17 00:00:00 2001 From: Shivansh Rawat Date: Mon, 27 Nov 2023 11:06:19 +0530 Subject: [PATCH 3/7] login and classes changed --- src/components/Header/index.js | 55 ++++++++----------------- src/components/Header/styles.js | 20 +++++++++ src/components/PathwayExercise/index.js | 2 +- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/components/Header/index.js b/src/components/Header/index.js index 757a1b754..b656a97aa 100644 --- a/src/components/Header/index.js +++ b/src/components/Header/index.js @@ -189,16 +189,7 @@ const PublicMenuOption = ({ leftDrawer, toggleDrawer }) => { > Donate @@ -209,31 +200,23 @@ const PublicMenuOption = ({ leftDrawer, toggleDrawer }) => { )} - {localStorage.getItem("studentAuth") ? - - - Scratch - - - - - : ( + {localStorage.getItem("studentAuth") ? ( + + + Scratch + + + + ) : ( <> {!leftDrawer && ( @@ -250,8 +233,6 @@ const PublicMenuOption = ({ leftDrawer, toggleDrawer }) => { )} )} - - ); }; diff --git a/src/components/Header/styles.js b/src/components/Header/styles.js index 564eb9d95..85aef2edf 100644 --- a/src/components/Header/styles.js +++ b/src/components/Header/styles.js @@ -40,6 +40,26 @@ const useStyles = makeStyles((theme) => ({ buttonLink: { textDecoration: "none", }, + scratchLink: { + height: "36px", + padding: "6px 16px", + display: "flex", + alignItems: "center", + "&:hover": { + backgroundColor: "#E9F5E9", + borderRadius: "8px", + }, + }, + donate: { + height: "36px", + padding: "6px 16px", + display: "flex", + alignItems: "center", + "&:hover": { + backgroundColor: "#E9F5E9", + borderRadius: "8px", + }, + } })); export default useStyles; diff --git a/src/components/PathwayExercise/index.js b/src/components/PathwayExercise/index.js index 2cd450fa0..f3b0a9eb9 100644 --- a/src/components/PathwayExercise/index.js +++ b/src/components/PathwayExercise/index.js @@ -175,7 +175,7 @@ function PathwayExercise() { if(localStorage.getItem("studentAuth")|| (user && user?.data?.token)){ return }else{ - history.push("/login"); + history.push(PATHS.LOGIN); } },[]) From 3161dea7622cdaf8399a8677739fa9aaca1bce60 Mon Sep 17 00:00:00 2001 From: SHIVANSH RAWAT <105305947+Shivansh3218@users.noreply.github.com> Date: Wed, 29 Nov 2023 08:58:48 +0530 Subject: [PATCH 4/7] Update CONTRIBUTING.md Added scratch url --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 221da2336..9eab6f42a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,6 +38,7 @@ git checkout dev REACT_APP_MERAKI_URL = 'https://merd-api.merakilearn.org/' REACT_APP_CHANAKYA_BASE_URL = 'https://join.navgurukul.org/api/' REACT_APP_ADMISSIONS_URL = 'https://admissions.navgurukul.org/' + REACT_APP_SCRATCH_URL = 'https://dev.scratch.merakilearn.org/login/' REACT_APP_API_KEY = '' REACT_APP_authDomain = '' REACT_APP_projectId = '' From 95d10cec1a16e79b6ab652d0a6a299d5d459402b Mon Sep 17 00:00:00 2001 From: psd9988 Date: Wed, 29 Nov 2023 19:41:38 +0530 Subject: [PATCH 5/7] routing on login for ACB students joined using referal link and already enrolled ACB students --- .vscode/settings.json | 3 +++ src/pages/Login/index.js | 46 +++++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..14f60307e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.inlineSuggest.showToolbar": "onHover" +} \ No newline at end of file diff --git a/src/pages/Login/index.js b/src/pages/Login/index.js index 5a37800c9..f1922f7c3 100644 --- a/src/pages/Login/index.js +++ b/src/pages/Login/index.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; import { useSelector, useDispatch } from "react-redux"; -import { Redirect } from "react-router-dom"; +import { Redirect, useHistory, useLocation } from "react-router-dom"; import GoogleLogin from "react-google-login"; import axios from "axios"; import { actions as userActions } from "../../components/User/redux/action"; @@ -14,12 +14,10 @@ import useMediaQuery from "@mui/material/useMediaQuery"; import GoogleIcon from "./assets/GoogleIcon"; import useStyles from "./styles"; import { breakpoints } from "../../theme/constant"; -import { useParams } from "react-router-dom"; function Login(props) { - // for amazon coding bootcamp redirect:- - const { utm_medium } = useParams(); - // console.log(utm_medium); + const history = useHistory(); + const location = useLocation(); const [queryString, setqueryString] = useState(null); const user = useSelector(({ User }) => User); const dispatch = useDispatch(); @@ -71,6 +69,11 @@ function Login(props) { pathway.data.pathways.find((pathway) => pathway.code === "PRGPYT"); const pythonPathwayId = pythonPathway && pythonPathway.id; + const amazonPathway = + pathway.data && + pathway.data.pathways.find((pathway) => pathway.code === "ACB"); + const amazonPathwayId = amazonPathway && amazonPathway.id; + const rolesLandingPages = { volunteer: PATHS.CLASS, admin: PATHS.PARTNERS, @@ -89,7 +92,18 @@ function Login(props) { }, data: { referrer: queryString }, }) - .then((res) => {}) + .then((res) => { + // For ACB Students joining using referrer link redirection below:- + const queryParams = new URLSearchParams(location.search); + const referrer = queryParams.get("referrer"); + if (referrer.includes("amazon")) { + history.push( + interpolatePath(PATHS.PATHWAY_COURSE, { + pathwayId: amazonPathwayId, + }) + ); + } + }) .catch((err) => {}); } if (props.location.state == "/volunteer-with-us") { @@ -102,6 +116,22 @@ function Login(props) { if (props.location.state) { return ; } + + // For already registered ACB Students redirection below:- + if ( + data?.user?.partner_id == 932 && + !data?.user?.rolesList.includes("partner") && + !data?.user?.rolesList.includes("admin") + ) { + return ( + + ); + } + return ( <> {pythonPathwayId && ( @@ -114,11 +144,7 @@ function Login(props) { } if (rolesList != false) { - if (!(rolesList.includes("partner") || rolesList.includes("admin"))) { - if (utm_medium.includes("amazon")) { - return ; - } return ; } } else if (rolesList.length == 0) { From b735937fee99741cf7e2663ff7832aa205815f8c Mon Sep 17 00:00:00 2001 From: psd9988 Date: Fri, 1 Dec 2023 11:29:56 +0530 Subject: [PATCH 6/7] fixed routing issue with already registered ACB student --- src/pages/Login/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/Login/index.js b/src/pages/Login/index.js index f1922f7c3..4214126f0 100644 --- a/src/pages/Login/index.js +++ b/src/pages/Login/index.js @@ -69,10 +69,19 @@ function Login(props) { pathway.data.pathways.find((pathway) => pathway.code === "PRGPYT"); const pythonPathwayId = pythonPathway && pythonPathway.id; + // PathwayId for Amazon Pathway:- const amazonPathway = pathway.data && pathway.data.pathways.find((pathway) => pathway.code === "ACB"); - const amazonPathwayId = amazonPathway && amazonPathway.id; + const [amazonPathwayId, setAmazonPathwayId] = useState(null); + + useEffect(() => { + if(amazonPathwayId == null){ + setAmazonPathwayId(amazonPathway && amazonPathway.id) + } + }, [user]); + + // --------------------------------------------- const rolesLandingPages = { volunteer: PATHS.CLASS, From f2df70eb7605fd9792b8d5a2953835dcfd2ff0f9 Mon Sep 17 00:00:00 2001 From: komalahire Date: Fri, 8 Dec 2023 18:42:35 +0530 Subject: [PATCH 7/7] ACB changes pushing in to main --- src/pages/Home/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/Home/index.js b/src/pages/Home/index.js index 66f85d422..481b0a6be 100644 --- a/src/pages/Home/index.js +++ b/src/pages/Home/index.js @@ -40,7 +40,6 @@ function Home() { const roles = useSelector(selectRolesData); const history = useHistory(); - useEffect(() => { const urlParams = new URLSearchParams(window.location.search); const studentAuthParam = urlParams.get("studentAuth"); @@ -70,7 +69,6 @@ function Home() { } }, []); - useEffect(() => { dispatch(pathwayActions.getPathways()); }, [dispatch]); @@ -344,7 +342,6 @@ function Home() { {/* Section 5 */} - Hear from our Users