diff --git a/src/Components/Navbar/Mobile.jsx b/src/Components/Navbar/Mobile.jsx index 72557a2..3e7252d 100644 --- a/src/Components/Navbar/Mobile.jsx +++ b/src/Components/Navbar/Mobile.jsx @@ -1,10 +1,14 @@ import React from "react"; import NavLinks from "./NavLinks"; import Notification from "./Notification"; -import { links } from "./Mylinks"; +import { getLinks } from "./Mylinks"; import SearchBar from "./SearchBar"; import { useState } from "react"; +import { useCallback } from "react"; +import SheetAPI from "../../Utils/SheetAPI"; +import { useEffect } from "react"; export const MobileTopBar = ({ setNotificationOpen, notificationOpen, handleScrolling, setOpen, open }) => { + function menuCloseEvent() { setOpen(!open); setNotificationOpen(false); @@ -69,7 +73,7 @@ export const MobileMenu = ({ setNotificationOpen, setOpen, handleScrolling, open className="py-3 px-28 " > { + const [variable, setVariable] = useState([]) + const ig = variable.map(link => { + if (link.parent === 'null') + return ({ + name: link?.heading, + link: `https://learn.mulearn.org/${link?.code}`, + }) + else return {} + }) + const Sheet = useCallback(() => { + SheetAPI('https://docs.google.com/spreadsheets/d/1C7MyDDpRCIq3bnXi-bdWQrUdYMJ0_2cBkpoJ7POQA6A/edit#gid=0', 'landing_pages', setVariable) + }, []) + useEffect(() => { + if (variable.length <= 0) + Sheet() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [variable.length]) return ( <> {!visible && - links.map((link, index) => ( + getLinks(ig).map((link, index) => (
{ test1(link); }}>

{link.name}

{ test1(link); }} > diff --git a/src/Components/Navbar/Mylinks.jsx b/src/Components/Navbar/Mylinks.jsx index 0f08e41..506af76 100644 --- a/src/Components/Navbar/Mylinks.jsx +++ b/src/Components/Navbar/Mylinks.jsx @@ -1,4 +1,485 @@ const mainlink = "https://mulearn.org"; + +export function getLinks(ig = []) { + return [ + { + head: -1, + name: "About", + submenu: true, + sublinks: [ + { + name: "Key Pages", + submenu: true, + sublinks: [ + { + name: "Our Team", + submenu: false, + sublinks: [], + link: mainlink + "/team", + foreign: false, + }, + ], + }, + { + name: "Partners", + submenu: true, + sublinks: [ + { + name: "Community Partners", + submenu: false, + sublinks: [], + link: mainlink + "/community-partners", + foreign: false, + }, + { + name: "Company Partners", + submenu: false, + sublinks: [], + link: mainlink + "/company-partners", + foreign: false, + }, + ], + }, + { + name: "Leaderboard", + submenu: true, + sublinks: [ + { + name: "Overall Leaderboards", + link: mainlink + "/leaderboard", + }, + { + name: "Monthly Leaderboards", + link: mainlink + "/leaderboard/monthly", + }, + ], + }, + { + name: "Media", + submenu: true, + sublinks: [ + { + name: "Gallery", + submenu: false, + sublinks: [], + link: mainlink + "/gallery", + foreign: false, + }, + { + name: "News", + submenu: false, + sublinks: [], + link: mainlink + "/news", + foreign: false, + }, + { + name: "Blogs", + submenu: false, + sublinks: [], + link: mainlink + "/blogs", + foreign: false, + }, + ], + }, + { + name: "Events", + submenu: true, + sublinks: [ + { + name: "Global Calendar", + submenu: false, + sublinks: [], + link: mainlink + "/calendar", + foreign: false, + }, + { + name: "Announcements", + submenu: false, + sublinks: [], + link: mainlink + "/announcements", + foreign: false, + }, + { + name: "Weekly Events", + submenu: false, + sublinks: [], + link: mainlink + "/events", + foreign: false, + }, + ], + }, + ], + }, + { + head: -1, + name: "Programs", + submenu: true, + sublinks: [ + { + head: 1, + name: "Flagship", + submenu: true, + sublinks: [ + { + name: "YIP", + submenu: false, + sublinks: [], + link: mainlink + "/yip", + foreign: true, + }, + { + name: "Foundation Program", + submenu: false, + sublinks: [], + link: "https://foundation.mulearn.org", + foreign: true, + }, + { + name: "Art of Teaching", + submenu: false, + sublinks: [], + link: mainlink + "/artofteaching", + foreign: false, + }, + ], + }, + { + head: 1, + name: "Others", + submenu: true, + sublinks: [ + { + name: "Wiki Syllabus", + submenu: false, + sublinks: [], + link: mainlink + "/wikisyllabus", + foreign: false, + }, + { + name: "Hacktober Fest", + submenu: false, + sublinks: [], + link: mainlink + "/hacktoberfest", + foreign: false, + }, + { + name: "Build For Team", + submenu: false, + sublinks: [], + link: mainlink + "/BuildForTeam", + foreign: false, + }, + ], + }, + ], + }, + { + head: -1, + name: "Campus Chapters", + submenu: true, + sublinks: [ + { + head: 2, + name: "The Chaptership", + submenu: true, + link: "/campuschapters", + sublinks: [ + { + name: "Lead a Campus", + link: "https://airtable.com/shrmtngt3zopg8eVh", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Find Your Campus", + link: mainlink + "/campuschapters#findchapter", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Campus Logo Generator", + link: mainlink + "/campuschapters/#logo-generator", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Success Stories", + link: mainlink + "/blogs", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 2, + name: "The Orientation", + submenu: true, + sublinks: [ + { + name: "Typing Mastery", + link: "/challenge/typing", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Typing Mastery Leaderboard", + link: "/challenge/typingmastery", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 2, + name: "The Enablement", + submenu: true, + link: "/challenges", + sublinks: [ + { + name: "Self Introduction", + link: "/common/enablement/1", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Intro to Command Line", + link: "/challenge/intro-to-command-line", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Introduction to GitHub", + link: "/challenge/intro-to-github", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Introduction to Markdown", + link: "/challenge/intro-to-markdown", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Introduction to HTML", + link: "/challenge/intro-to-html", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Introduction to Github Page", + link: "/challenge/intro-to-github-pages", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Introduction to Discord", + link: "/common/enablement/2", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 2, + name: " The Learning", + submenu: true, + link: "/", + sublinks: [ + { + name: "Form Learning Cirlces", + link: "/create", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Interest Groups", + link: "/", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Challenges", + link: "/challenges", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Bootcamps", + link: "/bootcamps", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + ], + }, + { + head: -1, + name: "Interest Group", + submenu: true, + sublinks: [ + { + head: 3, + name: "Interest Groups", + submenu: true, + link: "/", + sublinks: [...ig], + }, + { + head: 3, + name: "Bootcamps", + submenu: true, + link: "/bootcamps", + sublinks: [ + { + name: "Android", + link: "/bootcamps/ig/android", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Artificial Intelligence", + link: "/bootcamps/ai", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "CTF", + link: "/bootcamps/ctf", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Flutter", + link: "/bootcamps/ig/flutter", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Web Development", + link: "/bootcamps/ig/web", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Python", + link: "/bootcamps/python", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 3, + name: "Practice", + submenu: true, + sublinks: [ + { + name: "OpenSource Projects", + link: "/opensource", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Problem Shelf", + link: "/problemshelves", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Challenges", + link: "/challenges", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Courses", + link: "/courses", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "API Setu", + link: "/apisetu", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 3, + name: "Learning Circles", + submenu: true, + sublinks: [ + { + name: "Create Circle", + link: "/create", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Join Circles", + link: "/join", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + { + head: 3, + name: "Search", + submenu: true, + sublinks: [ + { + name: "Mentor Directory", + link: "/mentors", + submenu: false, + sublinks: [], + foreign: false, + }, + { + name: "Existing Circles", + link: "/searchcircles", + submenu: false, + sublinks: [], + foreign: false, + }, + ], + }, + ], + }, + ] +} export const links = [ { head: -1, @@ -338,64 +819,7 @@ export const links = [ name: "Interest Groups", submenu: true, link: "/", - sublinks: [ - { - name: "Android Development", - link: "/webmobile/android", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "Artifical Intelligence", - link: "/aimlanalytics/ai", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "Civil Engineering", - link: "/noncircuit/civil", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "Cyber Security", - link: "/cybersec", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "IoT", - link: "/iotrf/iot", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "Product Management", - link: "/innovationentre/pm", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "UX", - link: "/uiuxcreative/ux", - submenu: false, - sublinks: [], - foreign: false, - }, - { - name: "Web Development", - link: "/webmobile/web", - submenu: false, - sublinks: [], - foreign: false, - }, - ], + sublinks: [], }, { head: 3, diff --git a/src/Components/Navbar/NavLinks.jsx b/src/Components/Navbar/NavLinks.jsx index 3e3b2bc..b869462 100644 --- a/src/Components/Navbar/NavLinks.jsx +++ b/src/Components/Navbar/NavLinks.jsx @@ -1,16 +1,35 @@ -import React, { useState } from "react"; -import { links } from "./Mylinks"; +import React, { useCallback, useState } from "react"; +import { getLinks } from "./Mylinks"; import { MobileView } from "./Mobile"; import { MenuName, SubMenu } from "./Desktop"; import "./Navbar.css"; /* Added CSS*/ +import SheetAPI from "../../Utils/SheetAPI"; +import { useEffect } from "react"; const NavLinks = () => { const [currentLink, setCurrent] = useState(""); const [visible, setVisibility] = useState(false); const [prev, setPrev] = useState(""); + const [variable, setVariable] = useState([]) + const ig = variable.map(link => { + if (link.parent === 'null') + return ({ + name: link?.heading, + link: `https://learn.mulearn.org/${link?.code}`, + }) + else return {} + }) + const Sheet = useCallback(() => { + SheetAPI('https://docs.google.com/spreadsheets/d/1C7MyDDpRCIq3bnXi-bdWQrUdYMJ0_2cBkpoJ7POQA6A/edit#gid=0', 'landing_pages', setVariable) + }, []) + useEffect(() => { + if (variable.length <= 0) + Sheet() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [variable.length,]) return ( <> - {links.map((link, index) => ( + {getLinks(ig).map((link, index) => (
diff --git a/src/Pages/InterestGroups/InterestGroup.jsx b/src/Pages/InterestGroups/InterestGroup.jsx index ac2427c..ead7604 100644 --- a/src/Pages/InterestGroups/InterestGroup.jsx +++ b/src/Pages/InterestGroups/InterestGroup.jsx @@ -86,6 +86,7 @@ const InterestGroup = ({ setInterest }) => { height="500px" >
+
Interest Group Roadmap Credits: Roadmap.sh
} {mentors && diff --git a/src/Pages/InterestGroups/InterestGroup.module.css b/src/Pages/InterestGroups/InterestGroup.module.css index 653f18c..150902c 100644 --- a/src/Pages/InterestGroups/InterestGroup.module.css +++ b/src/Pages/InterestGroups/InterestGroup.module.css @@ -19,6 +19,17 @@ display: none; } +.credits { + text-align: center; + display: block; + margin: auto; + margin-top: 1rem; +} + +.credits a { + color: #f6842c; +} + .fv_heading { font-family: "Noto Sans", sans-serif; color: #f6842c; diff --git a/src/Pages/InterestGroups/Utils/getInterestGroupsData.js b/src/Pages/InterestGroups/Utils/getInterestGroupsData.js index 2080826..0ff7a39 100644 --- a/src/Pages/InterestGroups/Utils/getInterestGroupsData.js +++ b/src/Pages/InterestGroups/Utils/getInterestGroupsData.js @@ -1,7 +1,7 @@ import SheetAPI from "../../../Utils/SheetAPI" import { mainSheetLink } from "../IComponents/Info" -function getInterestGroupsData(summary, id, setSummary, setIgSummary,link=mainSheetLink,sheetName="landing_pages") { +function getInterestGroupsData(summary, id, setSummary, setIgSummary, link = mainSheetLink, sheetName = "landing_pages") { if (!summary.length) SheetAPI(link, sheetName, setSummary) else if (id !== undefined) { @@ -14,11 +14,11 @@ export default getInterestGroupsData function handleData(mainIg, setMainIg, id, sub, setIgSummary, setSubSummary, setPeople) { if (!mainIg.length) { - SheetAPI(mainSheetLink, 'landing_pages', setMainIg) + SheetAPI(mainSheetLink, 'landing_pages', setMainIg) } else if (sub === undefined) { - const main = mainIg.find((ig) => ig.code === id) - setIgSummary(main) + const main = mainIg.find((ig) => ig.code === id) + setIgSummary(main) } else { const subIg = mainIg.find((ig) => ig.code === sub) diff --git a/src/Pages/LearningCircles/Home/Home.jsx b/src/Pages/LearningCircles/Home/Home.jsx index 04ee58a..91853b0 100644 --- a/src/Pages/LearningCircles/Home/Home.jsx +++ b/src/Pages/LearningCircles/Home/Home.jsx @@ -24,8 +24,7 @@ import illustrations from "./assets/illustrations.png"; import InterestCard from "../../../Components/InterestCard/InterestCard"; import Preloader from "../../../Components/Preloader/Preloader"; -import { useRef } from "react"; -import SheetAPI from "../../../Utils/SheetAPI"; + import getInterestGroupsData from "../../InterestGroups/Utils/getInterestGroupsData"; const Home = ({ diff --git a/src/Utils/SheetAPI.js b/src/Utils/SheetAPI.js index 94d2f02..6c97b87 100644 --- a/src/Utils/SheetAPI.js +++ b/src/Utils/SheetAPI.js @@ -1,7 +1,7 @@ import axios from "axios" -function SheetAPI(spreadsheetId,sheetName,setData) { - if(spreadsheetId===undefined ||sheetName===undefined ) { +function SheetAPI(spreadsheetId, sheetName, setData) { + if (spreadsheetId === undefined || sheetName === undefined) { return undefined } const API = "https://opensheet.elk.sh/"