Skip to content

Commit

Permalink
[Refactor] Add /opportunities or /resources to Related Page Paths (th…
Browse files Browse the repository at this point in the history
…3cyb3rhub#710)

- Update page paths for pages related to opportunities or resources.
  • Loading branch information
Krishnaag23 committed Oct 8, 2024
1 parent 95f5842 commit 22640f2
Show file tree
Hide file tree
Showing 14 changed files with 1,126 additions and 19 deletions.
30 changes: 17 additions & 13 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import Homepage from "./components/Homepage/Homepage";
import ScrollToTop from "./components/Other/ScrollToTop";
import {
About,
Community,
// Community,
// CyberGames,
Footer,
InterviewQuestions,
// InterviewQuestions,
Jobs,
// LearningPath,
Login,
Navbar,
NotFound,
// OSINTGame,
Quiz,
// Quiz,
Sidebar,
SpecialSponsors,
Support,
Expand All @@ -37,10 +37,10 @@ import DashboardRoute from "./components/Dashboard/DashboardRoute";
import FeedsRoute from "./components/Feeds/FeedsRoute";
import Course from "./components/Courses/NewCourses/Course";
import QuizPage from "./components/Resources/Quiz/Categories/QuizPage";
import ToolsRoutes from "./components/Tools/ToolsRoute";
// import ToolsRoutes from "./components/Tools/ToolsRoute";
import CtfRoute from "./components/CaptureTheFlag/CTFRoute";
import BlogsRoute from "./components/Blogs/BlogsRoute";
import RoadmapsRoute from "./components/Learn/Roadmaps/RoadmapsRoute";
// import RoadmapsRoute from "./components/Resources/Roadmaps/RoadmapsRoute";
import CoursesRoute from "./components/Learn/Courses/CoursesRoute";
import ForumRoute from "./components/Forum/ForumRoute";
import SecurityRoutes from "./components/Other/Security/SecurityRoutes";
Expand Down Expand Up @@ -132,9 +132,9 @@ const App = () => {
<Route path={"/websecurity/*"} element={<WebSecurityRoutes />} />

{/* Resources */}
<Route path={"/roadmaps/*"} element={<RoadmapsRoute />} />
{/* <Route path={"/roadmaps/*"} element={<RoadmapsRoute />} />
<Route path={"/interviewQuestions"} element={<InterviewQuestions />} />
<Route path={"/tools/*"} element={<ToolsRoutes />} />
<Route path={"/tools/*"} element={<ToolsRoutes />} /> */}
<Route path={"/resources/*"} element={<ResourcesRoutes />} />
<Route path={"/courses/*"} element={<CoursesRoute />} />

Expand All @@ -150,14 +150,18 @@ const App = () => {
<Route exact path={"/user/edit/:username"} element={<EditPublicProfile />} />
</Route>

<Route exact path={"/community"} element={<Community />} />
{/* <Route exact path={"/community"} element={<Community />} /> */}
<Route exact path={"/support"} element={<Support />} />
<Route exact path={"/sponsors"} element={<SpecialSponsors />} />

<Route exact path={"/volunteer"} element={<Volunteer />} />
<Route exact path={"/opensec-projects"} element={<OpenSecProjects />} />
<Route exact path={"/community-events"} element={<DisplayCommunityEvents />} />
<Route exact path={"/community-events/:eventId"} element={<DisplayEventDetails />} />
<Route exact path={"/opportunities/opensec-projects"} element={<OpenSecProjects />} />
<Route exact path={"/opportunities/community-events"} element={<DisplayCommunityEvents />} />
<Route
exact
path={"/opportunities/community-events/:eventId"}
element={<DisplayEventDetails />}
/>

{/* <Route exact path={"/thecyberxcel"} element={<TheCyberXcel />} /> */}
{/* <Route exact path={"/thecyberspeak"} element={<TheCyberXcel />} /> */}
Expand All @@ -168,8 +172,8 @@ const App = () => {

{/* <Route path={"/dashboard/forum/create"} element={<CreateForumPost />} /> */}

<Route path={"/internship"} element={<Jobs />} />
<Route path={"/quiz"} element={<Quiz />} />
<Route path={"/opportunities/internship"} element={<Jobs />} />
{/* <Route path={"/quiz"} element={<Quiz />} /> */}
<Route path={"/createquiz"} element={<MakeQuiz />} />
<Route path={"/quiz/:type"} element={<QuizPage />} />

Expand Down
2 changes: 1 addition & 1 deletion src/components/Homepage/ContactForm/ContactForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import apiStatus from "src/features/apiStatus";
import { Wrapper } from "src/components/Dashboard/Profile/ProfileElements";
import UnderMaintenance from "src/components/Other/UnderMaintenance/UnderMaintenance";
// import { volunteerPrograms } from "src/components/Opportunities/Volunteer/VolunteerData";
import { RedirectLink } from "src/components/Learn/Roadmaps/RoadmapElements.jsx";
import { RedirectLink } from "src/components/Resources/Roadmaps/RoadmapElements.jsx";
import { DiscordButtonIcon } from "src/components/Other/Community/CommunityElements.jsx";

const ContactForm = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { ListContent, List, Link } from "src/components/Learn/Roadmaps/RoadmapsElements";
import { ListContent, List, Link } from "src/components/Resources/Roadmaps/RoadmapsElements";
import { getCdnAssets } from "src/features/apiUrl";
const HacktoberfestXthecyberworld = `${getCdnAssets}/images/Events/HacktoberfestXthecyberworld.png`;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Resources/Resources.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Section } from "./WriteUps/WriteUpsElements";
import Roadmaps from "src/components/Learn/Roadmaps/Roadmaps";
import Roadmaps from "src/components/Resources/Roadmaps/Roadmaps";

const Resources = () => {
return (
Expand Down
9 changes: 8 additions & 1 deletion src/components/Resources/ResourcesRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from "react";
import { Route, Routes } from "react-router-dom";
import { NotFound } from "src/components/index";
import { Community, InterviewQuestions, Quiz, NotFound } from "src/components/index";
import Methodology from "src/components/Resources/Methodology/MethodologyMain.jsx";
import Checklist from "src/components/Resources/Checklist/Checklist.jsx";
import Hacklist from "src/components/Resources/Hacklist/Hacklist.jsx";
import Cheatsheets from "src/components/Resources/Cheatsheets/Cheatsheets.jsx";
import Payloads from "src/components/Resources/Payloads/Payloads.jsx";
import Hackliner from "src/components/Resources/Hackliner/Hackliner.jsx";
import RoadmapsRoute from "src/components/Resources/Roadmaps/RoadmapsRoute";
import ToolsRoutes from "src/components/Tools/ToolsRoute";

const ResourcesRoutes = () => {
// const resources = [
Expand All @@ -15,6 +17,11 @@ const ResourcesRoutes = () => {
// ]
return (
<Routes>
<Route path={"/roadmaps"} element={<RoadmapsRoute />} />
<Route exact path={"/community"} element={<Community />} />
<Route path={"/quiz"} element={<Quiz />} />
<Route path={"/interviewQuestions"} element={<InterviewQuestions />} />
<Route path={"/tools/*"} element={<ToolsRoutes />} />
<Route path={"/methodology"} element={<Methodology />} />
<Route path={"/checklist"} element={<Checklist />} />
<Route path={"/cheatsheets"} element={<Cheatsheets />} />
Expand Down
17 changes: 17 additions & 0 deletions src/components/Resources/Roadmaps/CyberSecurityData.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// const CyberSecurityData = [
// {
// title: "Cyber Security",
// links: [
// {
// title: "Cyber Security Tutorial for Beginners",
// url: "https://youtu.be/3QhU9jd03a0",
// target: "_blank",
// },
// {
// title: "Cyber Security for Beginners",
// url: "https://youtu.be/1S0aBV-Waeo",
// target: "_blank",
// },
// ],
// },
// ];
76 changes: 76 additions & 0 deletions src/components/Resources/Roadmaps/Roadmap.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React, { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import RoadmapsData from "./RoadmapsData";
import { encodeURL } from "src/components/Blogs/util";
import {
RedirectLink,
RoadmapContainer,
RoadmapContentHeading,
RoadmapDetails,
RoadmapDetailsCard,
RoadmapDetailsContainer,
RoadmapHeading,
RoadmapHeadingSection,
RoadmapSectionHeading,
} from "./RoadmapElements";
import { DotSymbol } from "src/components/Homepage/Info/InfoElements";
import { Checkbox, CheckboxContainer } from "src/components/Courses/LearningPath/LearningPathElements.jsx";

const Roadmap = () => {
const { title } = useParams();
const SelectedRoadmap = RoadmapsData?.find(
(roadmap) => encodeURL(roadmap?.title).toLowerCase() === title.toLowerCase(),
);

const [checkboxState, setCheckboxState] = useState(() => {
return JSON.parse(localStorage.getItem(`roadmaps-localstorage`)) || {};
});

useEffect(() => {
localStorage.setItem(`roadmaps-localstorage`, JSON.stringify(checkboxState));
}, [checkboxState, title]);

const handleCheckboxChange = (section, resource) => {
const newState = {
...checkboxState,
[section]: {
...checkboxState[section],
[resource]: !checkboxState[section]?.[resource],
},
};
setCheckboxState(newState);
};

return (
<RoadmapContainer>
<RoadmapHeadingSection>
<RoadmapHeading> {SelectedRoadmap?.title} </RoadmapHeading>
</RoadmapHeadingSection>

<RoadmapDetailsContainer>
{SelectedRoadmap?.details.map((resources, sectionId) => (
<RoadmapDetails key={sectionId}>
<RoadmapSectionHeading> {resources?.section} </RoadmapSectionHeading>
{resources?.resources.map((resource, resourceId) => (
<RoadmapDetailsCard key={resourceId}>
<DotSymbol />
<RedirectLink href={resource?.url} target={"_blank"}>
<RoadmapContentHeading>{resource?.title}</RoadmapContentHeading>
</RedirectLink>
<CheckboxContainer>
<Checkbox
type="checkbox"
checked={checkboxState[resources.section]?.[resource.title] || false}
onChange={() => handleCheckboxChange(resources.section, resource.title)}
/>
</CheckboxContainer>
</RoadmapDetailsCard>
))}
</RoadmapDetails>
))}
</RoadmapDetailsContainer>
</RoadmapContainer>
);
};

export default Roadmap;
Empty file.
Loading

0 comments on commit 22640f2

Please sign in to comment.