Skip to content

Commit

Permalink
Merge pull request #660 from sonaliTekdi/learnathon_developement
Browse files Browse the repository at this point in the history
Task #228134  - [FE] - Registration side changes for learnathon (webapp)
  • Loading branch information
paritshivani authored Oct 3, 2024
2 parents f0987ba + 24d8ba6 commit 9defc3b
Show file tree
Hide file tree
Showing 19 changed files with 760 additions and 258 deletions.
8 changes: 6 additions & 2 deletions packages/nulp_elite/public/locales/be/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@

"SELECT_CATEGORY_FIRST":"প্রথমে একটি বিভাগ নির্বাচন করুন",
"SELECT_PREF":"পছন্দ নির্বাচন করুন",
"CHANGE_PREF_OLD_USER":"আমরা কাঠামোতে কিছু পরিবর্তন করেছি অনুগ্রহ করে আপনার পছন্দ নির্বাচন করুন"
"CHANGE_PREF_OLD_USER":"আমরা কাঠামোতে কিছু পরিবর্তন করেছি অনুগ্রহ করে আপনার পছন্দ নির্বাচন করুন",
"COURSE & CERTIFICATES": "কোর্স এবং সার্টিফিকেট",
"ALL_PLAYER": "সমস্ত খেলোয়াড়",
"LICENSEDETAILS": "লাইসেন্সের বিবরণ",
Expand Down Expand Up @@ -321,5 +321,9 @@

"NO_CHAT_REQUEST": "কোনো চ্যাট অনুরোধ নেই",
"PHONE":"ফোন",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"তৈরি করার অনুরোধ"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,9 @@
"LAST_NAME":"Last Name",
"NO_CHAT_REQUEST" : "No Chat Request",
"PHONE":"Phone",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"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"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/gg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,5 +324,9 @@
"LAST_NAME":"છેલ્લું નામ",
"NO_CHAT_REQUEST": "કોઈ ચેટ વિનંતી નથી",
"PHONE":"ફોન",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"બનાવવાની વિનંતી"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,9 @@
"LAST_NAME":"अंतिम नाम",
"NO_CHAT_REQUEST": "कोई चैट अनुरोध नहीं",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"बनाने का अनुरोध"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/ma/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@
"LAST_NAME":"आडनाव",
"NO_CHAT_REQUEST": "चॅट विनंती नाही",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"तयार करण्याची विनंती"
}

6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/mal/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,9 @@
"LAST_NAME":"അവസാന നാമം",
"NO_CHAT_REQUEST": "ചാറ്റ് അഭ്യര്‍ത്ഥനയില്ല",
"PHONE":"ഫോൺ",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"സൃഷ്ടിക്കാനുള്ള അഭ്യർത്ഥന"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/ta/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,9 @@
"LAST_NAME":"கடைசி பெயர்",
"NO_CHAT_REQUEST": "சாட் கோரிக்கை இல்லை",
"PHONE":"தொலைபேசி",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595"
"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":"உருவாக்க கோரிக்கை"
}
6 changes: 5 additions & 1 deletion packages/nulp_elite/public/locales/te/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,9 @@
"NO_CHAT_REQUEST": "చాట్ అభ్యర్థన లేదు",
"PHONE":"ఫోన్",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"WHAT_DO_YOU_WANT_TO_LEARN_TODAY":"ఈరోజు మీరు ఏమి నేర్చుకోవాలనుకుంటున్నారు"
"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":"సృష్టించడానికి అభ్యర్థన"
}
19 changes: 12 additions & 7 deletions packages/nulp_elite/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { useEffect, useState } from "react";
import "./App.css";
import "./styles/style.css";
import {
NativeBaseProvider,
} from "native-base";
import { NativeBaseProvider } from "native-base";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { initializeI18n } from "@shiksha/common-lib";
import * as util from "services/utilService";
Expand Down Expand Up @@ -36,11 +34,13 @@ import createForm from "pages/voting/createForm";
import VotingDetails from "pages/voting/votingDetails";
import votingDashboard from "pages/voting/votingDashboard";
import pollsDetails from "pages/voting/pollsDetails";
import LernCreatorForm from "pages/learnathon/lernCreatorForm";
const urlConfig = require("./configs/urlConfig.json");
const routeConfig = require("./configs/routeConfig.json");
import PopupForm from "pages/profileData";
import axios from "axios";
import ReactGA from 'react-ga4';
import ReactGA from "react-ga4";
import LernModal from "components/learnathon/LernModal";

function App() {
// const [t] = useTranslation();
Expand All @@ -53,8 +53,7 @@ function App() {
const _userId = util.userId();
const [orgId, setOrgId] = useState();
const [userData, setUserData] = React.useState(false);
ReactGA.initialize('G-QH3SHT9MTG');

ReactGA.initialize("G-QH3SHT9MTG");

const routes = [
{
Expand Down Expand Up @@ -213,6 +212,11 @@ function App() {
path: routeConfig.ROUTES.POLL.POLLS_VIEW_ALL,
component: pollsDetails,
},
{
moduleName: "nulp_elite",
path: routeConfig.ROUTES.LEARNATHON.CREATELEARNCONTENT,
component: LernCreatorForm,
},
];
createForm;
initializeI18n(
Expand Down Expand Up @@ -286,7 +290,7 @@ function App() {
console.error("Error fetching user data:", error);
}
};
console.log("Prod here")
console.log("dev here");
fetchData();
UserData();
}, []);
Expand Down Expand Up @@ -322,6 +326,7 @@ console.log("Prod here")
))}
</Routes>
</Router>
<LernModal />
</React.Suspense>
{/* </ChakraProvider> */}
{/* </ChakraProvider> */}
Expand Down
12 changes: 8 additions & 4 deletions packages/nulp_elite/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ function Header({ globalSearchQuery }) {
boxShadow: searchQuery ? '0 2px 4px rgba(0, 0, 0, 0.2)' : 'none',
color: searchQuery ? '#fff' : "#000"
};

const handleLogout =() => {
sessionStorage.setItem('isModalShown', 'false');
}
return (
<>
<Box
Expand Down Expand Up @@ -612,8 +614,10 @@ function Header({ globalSearchQuery }) {

</MenuItem>
</Link>
<Link href="/logoff" underline="none" textAlign="center">
<Link href="/logoff" underline="none" textAlign="center"
onClick={handleLogout}>
<MenuItem>


{t("LOGOUT")}

Expand Down Expand Up @@ -672,7 +676,7 @@ function Header({ globalSearchQuery }) {

</MenuItem>
</Link>
<Link href="/logoff" textAlign="center" underline="none">
<Link href="/logoff" textAlign="center" underline="none" onClick={handleLogout}>
<MenuItem>

<LogoutOutlinedIcon
Expand Down Expand Up @@ -971,7 +975,7 @@ function Header({ globalSearchQuery }) {
{t("HELP")}
</MenuItem>
</Link>
<Link href="/logoff" underline="none" textAlign="center">
<Link href="/logoff" underline="none" textAlign="center" onClick={handleLogout}>
<MenuItem>
{t("LOGOUT")}
</MenuItem>
Expand Down
99 changes: 99 additions & 0 deletions packages/nulp_elite/src/components/learnathon/LernModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React, { useState, useEffect } from 'react';
import { Modal, Box, Typography, IconButton } 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";

const LernModal = () => {
const { t } = useTranslation();
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 _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;
setLernUser(rolesData);
} catch (error) {
console.error("Error fetching user data:", error);
}
};

// Fetch data when the component mounts or _userId changes
useEffect(() => {
if (_userId) {
fetchData();
}
}, [_userId]);

const style = {
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: 400,
bgcolor: "background.paper",
border: "2px solid #000",
boxShadow: 24,
p: 4,
overflow: "auto",
};

return (
<div>
<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")}
</Box>
</Box>
<Box>
<IconButton onClick={handleClose}>
<CloseIcon />
</IconButton>
</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-lern' ? (
<a class="viewAll">{t("CREATE_CONTENT")}</a>
) : (
<a class="viewAll">{t("REQUEST_TO_CREATE")}</a>
)}
</Box>
</Box>
</Modal>
</div>
);
};

export default LernModal;
Empty file.
7 changes: 5 additions & 2 deletions packages/nulp_elite/src/configs/routeConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"DASHBOARD_PAGE": {
"DASHBOARD": "/webapp/dashboard"
},
"LEARNING_REPORT":"/dashBoard/allDashboard",
"ADMIN":"/dashBoard/addusess",
"LEARNING_REPORT": "/dashBoard/allDashboard",
"ADMIN": "/dashBoard/addusess",
"ALL_CONTENT_PAGE": {
"ALL_CONTENT": "/webapp/all"
},
Expand Down Expand Up @@ -83,6 +83,9 @@
"POLL_FORM": "/webapp/createform",
"POLL_DASHBOARD": "/webapp/pollDashboard",
"POLLS_VIEW_ALL": "/webapp/pollsDetails"
},
"LEARNATHON": {
"CREATELEARNCONTENT": "/webapp/learnthon"
}
}
}
Empty file.
Loading

0 comments on commit 9defc3b

Please sign in to comment.