Skip to content

Commit

Permalink
Merge branch 'learnathon-2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
paritshivani authored Oct 14, 2024
2 parents 2efa8b4 + 63a27cc commit b054b23
Show file tree
Hide file tree
Showing 22 changed files with 1,573 additions and 336 deletions.
Binary file added module-template/public/image24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/be/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@
"NO_CHAT_REQUEST": "কোনো চ্যাট অনুরোধ নেই",
"PHONE":"ফোন",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"Learnathon 2.0",
"LERN_MESSAGE":"Learnathon 2.0 20/09/2024 থেকে 20/10/2024 পর্যন্ত শুরু হয়েছে। আপনি এখন আপনার জমাগুলি তৈরি এবং ভাগ করতে পারেন!",
"CREATE_CONTENT":"সামগ্রী তৈরি করুন",
"REQUEST_TO_CREATE":"তৈরি করার অনুরোধ"
"REQUEST_TO_CREATE":"তৈরি করার অনুরোধ",
"PARTICIPATE_NOW":"এখনই অংশগ্রহণ করুন",
"LERN_title": "The Learnathon 2.0 শুরু হয়েছে!",
"LERN_MESSAGE": "যেখানে শহুরে অনুশীলনকারীরা সহযোগিতামূলক শিক্ষাকে উৎসাহিত করার জন্য সমাধানগুলি ভাগ করে নেয়।",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18ই নভেম্বর 2024 এ চালু হয়েছে এবং 20শে ডিসেম্বর 2024 পর্যন্ত চলবে। এখনই আপনার শহুরে সমাধান জমা দিন!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,10 @@
"PHONE": "Phone",
"PHONE_NUMBER": "(+91 11) 24617517, 24617543, 24617595",
"SESSION_TIMEOUT_MESSAGE": "Failed to fetch data.please try again.",
"LERN_title": "Learnathon 2.0",
"LERN_MESSAGE": "Learnathon 2.0 has started from 20/09/2024 to 20/10/2024. You can now create and share your submissions!",
"CREATE_CONTENT": "Create Content",
"REQUEST_TO_CREATE": "Request to Create"
"REQUEST_TO_CREATE": "Request to Create",
"PARTICIPATE_NOW":"Participate Now",
"LERN_title": "The Learnathon 2.0 Has Begun!",
"LERN_MESSAGE": "Where urban practitioners share solutions to foster collaborative learning.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 launched on 18th November 2024 and will continue until 20th December 2024. Submit your urban solutions now!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/gg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@
"NO_CHAT_REQUEST": "કોઈ ચેટ વિનંતી નથી",
"PHONE":"ફોન",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"લર્નથોન 2.0",
"LERN_MESSAGE":"લર્નથોન 2.0 20/09/2024 થી 20/10/2024 સુધી શરૂ થઈ છે. તમે હવે તમારા સબમિશન બનાવી અને શેર કરી શકો છો!",
"CREATE_CONTENT":"સામગ્રી બનાવો",
"REQUEST_TO_CREATE":"બનાવવાની વિનંતી"
"REQUEST_TO_CREATE":"બનાવવાની વિનંતી",
"PARTICIPATE_NOW":"હવે ભાગ લો",
"LERN_title": "ધ લર્નથોન 2.0 શરૂ થઈ ગયું છે!",
"LERN_MESSAGE": "જ્યાં શહેરી પ્રેક્ટિશનરો સહયોગી શિક્ષણને પ્રોત્સાહન આપવા માટે ઉકેલો શેર કરે છે.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18મી નવેમ્બર 2024 ના રોજ લોન્ચ થયું અને 20મી ડિસેમ્બર 2024 સુધી ચાલુ રહેશે. તમારા શહેરી ઉકેલો હમણાં જ સબમિટ કરો!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@
"NO_CHAT_REQUEST": "कोई चैट अनुरोध नहीं",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"लर्नथॉन 2.0",
"LERN_MESSAGE":"लर्नथॉन 2.0 20/09/2024 से 20/10/2024 तक शुरू हो चुका है। अब आप अपने सबमिशन बना और साझा कर सकते हैं!",
"CREATE_CONTENT":"सामग्री बनाएँ",
"REQUEST_TO_CREATE":"बनाने का अनुरोध"
"REQUEST_TO_CREATE":"बनाने का अनुरोध",
"PARTICIPATE_NOW":"अभी भाग लें",
"LERN_title": "लर्नथॉन 2.0 शुरू हो गया है!",
"LERN_MESSAGE": "जहां शहरी व्यवसायी सहयोगात्मक शिक्षा को बढ़ावा देने के लिए समाधान साझा करते हैं।",
"LERN_MESSAGE_LINE_TWO":"लर्नथॉन 2.0 18 नवंबर 2024 को लॉन्च हुआ और 20 दिसंबर 2024 तक जारी रहेगा। अब अपना शहरी समाधान सबमिट करें!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/ma/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,11 @@
"NO_CHAT_REQUEST": "चॅट विनंती नाही",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"लर्नथॉन 2.0",
"LERN_MESSAGE":"लर्नथॉन 2.0 20/09/2024 ते 20/10/2024 पर्यंत सुरू झाली आहे. तुम्ही आता तुमचे सबमिशन तयार आणि शेअर करू शकता!",
"CREATE_CONTENT":"सामग्री तयार करा",
"REQUEST_TO_CREATE":"तयार करण्याची विनंती"
"REQUEST_TO_CREATE":"तयार करण्याची विनंती",
"PARTICIPATE_NOW":"आता सहभागी व्हा",
"LERN_title": "लर्नथॉन २.० सुरु झाली आहे!",
"LERN_MESSAGE": "जेथे शहरी अभ्यासक सहयोगी शिक्षणाला चालना देण्यासाठी उपाय सामायिक करतात.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 नोव्हेंबर 2024 ला लॉन्च झाला आणि 20 डिसेंबर 2024 पर्यंत सुरू राहील. तुमचे शहरी उपाय आता सबमिट करा!"
}

8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/mal/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@
"NO_CHAT_REQUEST": "ചാറ്റ് അഭ്യര്‍ത്ഥനയില്ല",
"PHONE":"ഫോൺ",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"ലേണത്തോൺ 2.0",
"LERN_MESSAGE":"ലേണത്തോൺ 2.0 20/09/2024 മുതൽ 20/10/2024 വരെ ആരംഭിച്ചു. നിങ്ങൾക്ക് ഇപ്പോൾ നിങ്ങളുടെ സമർപ്പിക്കലുകൾ സൃഷ്ടിക്കാനും പങ്കിടാനും കഴിയും!",
"CREATE_CONTENT":"ഉള്ളടക്കം സൃഷ്ടിക്കുക",
"REQUEST_TO_CREATE":"സൃഷ്ടിക്കാനുള്ള അഭ്യർത്ഥന"
"REQUEST_TO_CREATE":"സൃഷ്ടിക്കാനുള്ള അഭ്യർത്ഥന",
"PARTICIPATE_NOW":"ഇപ്പോൾ പങ്കെടുക്കുക",
"LERN_title": "ലേണത്തോൺ 2.0 ആരംഭിച്ചു!",
"LERN_MESSAGE": "സഹകരണ പഠനം പ്രോത്സാഹിപ്പിക്കുന്നതിന് നഗരപരിശീലകർ പരിഹാരങ്ങൾ പങ്കിടുന്നിടത്ത്.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 2024 നവംബർ 18-ന് സമാരംഭിച്ചു, 2024 ഡിസംബർ 20 വരെ തുടരും. നിങ്ങളുടെ നഗര പരിഹാരങ്ങൾ ഇപ്പോൾ സമർപ്പിക്കുക!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/ta/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@
"NO_CHAT_REQUEST": "சாட் கோரிக்கை இல்லை",
"PHONE":"தொலைபேசி",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"LERN_title":"கற்றல் 2.0",
"LERN_MESSAGE":"கற்றல் 2.0 20/09/2024 முதல் 20/10/2024 வரை தொடங்கியது. நீங்கள் இப்போது உங்கள் சமர்ப்பிப்புகளை உருவாக்கி பகிரலாம்!",
"CREATE_CONTENT":"உள்ளடக்கத்தை உருவாக்கவும்",
"REQUEST_TO_CREATE":"உருவாக்க கோரிக்கை"
"REQUEST_TO_CREATE":"உருவாக்க கோரிக்கை",
"PARTICIPATE_NOW":"இப்போது பங்கேற்கவும்",
"LERN_title": "The Learnathon 2.0 Has Begun!",
"LERN_MESSAGE": "நகர்ப்புற பயிற்சியாளர்கள் கூட்டுக் கற்றலை வளர்ப்பதற்கான தீர்வுகளை எங்கே பகிர்ந்து கொள்கிறார்கள்.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 நவம்பர் 2024 அன்று தொடங்கப்பட்டது மற்றும் 20 டிசம்பர் 2024 வரை தொடரும். உங்கள் நகர்ப்புற தீர்வுகளை இப்போதே சமர்ப்பிக்கவும்!"
}
8 changes: 5 additions & 3 deletions packages/nulp_elite/public/locales/te/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@
"PHONE":"ఫోన్",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"WHAT_DO_YOU_WANT_TO_LEARN_TODAY":"ఈరోజు మీరు ఏమి నేర్చుకోవాలనుకుంటున్నారు",
"LERN_title":"లెర్నాథాన్ 2.0",
"LERN_MESSAGE":"లెర్నాథాన్ 2.0 20/09/2024 నుండి 20/10/2024 వరకు ప్రారంభమైంది. మీరు ఇప్పుడు మీ సమర్పణలను సృష్టించవచ్చు మరియు భాగస్వామ్యం చేయవచ్చు!",
"CREATE_CONTENT":"కంటెంట్‌ని సృష్టించండి",
"REQUEST_TO_CREATE":"సృష్టించడానికి అభ్యర్థన"
"REQUEST_TO_CREATE":"సృష్టించడానికి అభ్యర్థన",
"PARTICIPATE_NOW":"ఇప్పుడే పాల్గొనండి",
"LERN_title": "లెర్నాథాన్ 2.0 ప్రారంభమైంది!",
"LERN_MESSAGE": "పట్టణ అభ్యాసకులు సహకార అభ్యాసాన్ని ప్రోత్సహించడానికి పరిష్కారాలను పంచుకునే చోట.",
"LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 నవంబర్ 2024న ప్రారంభించబడింది మరియు 20 డిసెంబర్ 2024 వరకు కొనసాగుతుంది. మీ పట్టణ పరిష్కారాలను ఇప్పుడే సమర్పించండి!"
}
16 changes: 9 additions & 7 deletions packages/nulp_elite/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import PopupForm from "pages/profileData";
import axios from "axios";
import ReactGA from "react-ga4";
import LernModal from "components/learnathon/LernModal";
import LernSubmissionTable from "pages/learnathon/LernSubmissionTable";

function App() {
// const [t] = useTranslation();
Expand Down Expand Up @@ -111,12 +112,6 @@ function App() {
path: routeConfig.ROUTES.JOIN_COURSE_PAGE.JOIN_COURSE,
component: JoinCourse,
},
// {
// moduleName: "nulp_elite",
// path: "/joinCourse/:contentId",
// component: JoinCourse,
// },

{
moduleName: "nulp_elite",
path: routeConfig.ROUTES.PLAYER_PAGE.PLAYER,
Expand Down Expand Up @@ -217,8 +212,14 @@ function App() {
path: routeConfig.ROUTES.LEARNATHON.CREATELEARNCONTENT,
component: LernCreatorForm,
},
{
moduleName: "nulp_elite",
path: routeConfig.ROUTES.LEARNATHON.MYLERNSUBMISSION,
component: LernSubmissionTable,

},
];
createForm;

initializeI18n(
["translation"],
`${process.env.PUBLIC_URL}/locales/{{lng}}/{{ns}}.json`
Expand Down Expand Up @@ -327,6 +328,7 @@ function App() {
</Routes>
</Router>
<LernModal />

</React.Suspense>
{/* </ChakraProvider> */}
{/* </ChakraProvider> */}
Expand Down
Binary file added packages/nulp_elite/src/assets/image24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/nulp_elite/src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function BoxCard({ items, index, onClick, continueLearning }) {
const { t } = useTranslation();

useEffect(() => {
console.log("items-------", items);
if (items.se_gradeLevels) {
setSubdomain(processString(items.se_gradeLevels[0]));
} else if (items.gradeLevel) {
Expand Down
156 changes: 140 additions & 16 deletions packages/nulp_elite/src/components/learnathon/LernModal.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,118 @@
import React, { useState, useEffect } from 'react';
import { Modal, Box, Typography, IconButton } from '@mui/material';
import { Modal, Box, IconButton, Button, Grid } from '@mui/material';
import * as util from "services/utilService";
const urlConfig = require("../../configs/urlConfig.json");
import CloseIcon from "@mui/icons-material/Close";
import Divider from '@mui/material/Divider';
import { useTranslation } from "react-i18next";
import { useNavigate } from 'react-router-dom';
import axios from "axios";
import ToasterCommon from 'pages/ToasterCommon';

const LernModal = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const [toasterMessage, setToasterMessage] = useState("");
const [toasterOpen, setToasterOpen] = useState(false);
const [roleList, setRoleList] = useState([]);
const [isModalOpen, setIsModalOpen] = useState(() => {
// Check if the modal has been shown in the current session
const isModalShown = sessionStorage.getItem('isModalShown');
return isModalShown !== 'true'; // Show modal if not already shown
});

const [lernUser, setLernUser] = useState([]);
const [responseCode,setResponseCode] = useState([]);
const [orgId,setOrgId] = useState([]);
const _userId = util.userId();
const handleClose = () => {
setIsModalOpen(false);
sessionStorage.setItem('isModalShown', 'true'); // Set flag to not show modal again
};


const fetchData = async () => {
try {
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.USER.GET_PROFILE}${_userId}`;
const response = await fetch(url);
const data = await response.json();
const rolesData = data.result.response.channel;
const roles =data.result.response.roles;
console.log(roles,'roles array');
const organizationId=roles[0]?.scope[0]?.organisationId;
const extractedRoles = roles.map(roleObj => roleObj.role);
setRoleList(extractedRoles);
console.log(organizationId,'organizationId');
setOrgId(organizationId);
setLernUser(rolesData);
} catch (error) {
console.error("Error fetching user data:", error);
}
};

const checkAccess = async () => {
try {
const url = `${urlConfig.URLS.CHECK_USER_ACCESS}`;
const response = await fetch(url);
const data = await response.json();

const userID = data.result.data;
const user = userID.find((user) => user.user_id === _userId);

if (!user) {
console.log("User ID not found. Calling fetchUserAccess...");
fetchUserAccess();
} else if (user.creator_access === true) {
navigate('/webapp/mylernsubmissions');
setIsModalOpen(false);
console.log("User ID found with creator access. No need to call fetchUserAccess.");
} else if (user.creator_access === false) {
console.log("User ID found but no creator access. Calling fetchUserAccess...");
fetchUserAccess();
}
} catch (error) {
console.error("Error fetching user data:", error);
}
};


let responsecode;
const isCreator = roleList.includes("CONTENT_CREATOR");
const fetchUserAccess = async () => {
try {
const url = `${urlConfig.URLS.PROVIDE_ACCESS}`;
const role = isCreator ? roleList : ["CONTENT_CREATOR", ...roleList];
const requestPayload = {
request: {
organisationId: orgId,
roles: role,
userId: _userId,
},
};

if (isCreator) {
requestPayload.isCreator = true;
}

const response = await axios.post(url, requestPayload);
const data = await response.data;
const result = data.result.data.responseCode;

responsecode = result;
setResponseCode(result);

if (result === "OK") {
navigate('webapp/mylernsubmissions');
setIsModalOpen(false);
} else {
setToasterMessage("Something went wrong! Please try again later");
}
} catch (error) {
console.log('error', error);
}
};


// Fetch data when the component mounts or _userId changes
useEffect(() => {
if (_userId) {
Expand All @@ -51,21 +131,44 @@ const LernModal = () => {
boxShadow: 24,
p: 4,
overflow: "auto",
borderRadius:'10px',
width: {
xs: '100%',
sm: '100%',
md: '600px',
},
};
console.log(lernUser,'lernUser form modal');

const handleCardClick = async () => {
if (lernUser === 'nulp-learn') {
navigate('/webapp/mylernsubmissions');
setIsModalOpen(false); // Close the modal
} else{
await checkAccess();
}
};


return (
<div>
{toasterMessage && (
<Box
>
<ToasterCommon response={toasterMessage} />
</Box>
)}
<Modal
open={isModalOpen}
onClose={handleClose}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
>

<Box sx={style}>
<Box display="flex" justifyContent="space-between" alignItems="center">
<Box>
<Box className="h2-title">
{t("LERN_title")}
{t("LERN_title")}
</Box>
</Box>
<Box>
Expand All @@ -75,20 +178,41 @@ const LernModal = () => {
</Box>
</Box>
<Box className="mt-10 xs-mb-10">
<Divider />
</Box>
<Box>
<Typography variant="body2" color="textSecondary">
{t("LERN_MESSAGE")}
</Typography>
</Box>
<Box className='lg-mt-30'>
{lernUser === 'nulp-learn' ? (
<a class="viewAll">{t("CREATE_CONTENT")}</a>
) : (
<a class="viewAll">{t("REQUEST_TO_CREATE")}</a>
)}
<Divider />
</Box>
<Grid container spacing={2}>

<Grid item xs={12} sm={12} md={4}>
<Box className='profileBox'>
<img
src={require("../../assets/image24.png")}
alt=""
/>
</Box>
</Grid>
<Grid item xs={12} sm={12} md={8}>
<Box className='profileBox ml-20'>
<Box className='mt-20'>
{t("LERN_MESSAGE")}
</Box>
<Box className='mt-20'>
{t("LERN_MESSAGE_LINE_TWO")}
</Box>

<Box className='lg-mt-30'>
{lernUser === 'nulp-learn' ? (
<Button className="viewAll" onClick={handleCardClick}>
{t("PARTICIPATE_NOW")}
</Button>
) : (
<Button className="viewAll" onClick={handleCardClick}>
{t("PARTICIPATE_NOW")}
</Button>
)}
</Box>
</Box>
</Grid>
</Grid>
</Box>
</Modal>
</div>
Expand Down
4 changes: 3 additions & 1 deletion packages/nulp_elite/src/configs/routeConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
"POLLS_VIEW_ALL": "/webapp/pollsDetails"
},
"LEARNATHON": {
"CREATELEARNCONTENT": "/webapp/learnthon"
"CREATELEARNCONTENT": "/webapp/learnthon",
"SUBMISSIONLIST": "webapp/SubmissionList",
"MYLERNSUBMISSION": "/webapp/mylernsubmissions"
}
}
}
Loading

0 comments on commit b054b23

Please sign in to comment.