Refactor and add json url

This commit is contained in:
Kamran Ahmed
2021-12-07 14:05:13 +01:00
parent 82456021ad
commit 8a99ecbecd
15 changed files with 37 additions and 23 deletions

View File

@ -19,7 +19,7 @@ export function RoadmapError(props: RoadmapProps) {
rounded='5px' rounded='5px'
color='white' color='white'
> >
<Heading mb='4px' size='md'>Oops! There's an error</Heading> <Heading mb='4px' size='md'>Oops! There&apos;s an error</Heading>
<Text>Try refreshing or <Link target='_blank' fontWeight={700} textDecoration={'underline'} fontSize='14px' href={siteConfig.url.issue}>report a bug</Link> and use the <Link fontWeight={700} textDecoration={'underline'} href={`/${roadmap.id}`}>non-interactive version</Link></Text> <Text>Try refreshing or <Link target='_blank' fontWeight={700} textDecoration={'underline'} fontSize='14px' href={siteConfig.url.issue}>report a bug</Link> and use the <Link fontWeight={700} textDecoration={'underline'} href={`/${roadmap.id}`}>non-interactive version</Link></Text>
</Container> </Container>
); );

View File

@ -13,6 +13,7 @@
"javascript developer", "javascript developer",
"frontend development skills", "frontend development skills",
"frontend development skills test", "frontend development skills test",
"frontend roadmap",
"frontend engineer roadmap", "frontend engineer roadmap",
"frontend developer roadmap", "frontend developer roadmap",
"become a frontend developer", "become a frontend developer",
@ -37,6 +38,7 @@
}, },
"featured": true, "featured": true,
"imagePath": "/roadmaps/frontend.png", "imagePath": "/roadmaps/frontend.png",
"jsonUrl": "/project/frontend.json",
"resourcesPath": "/roadmaps/100-frontend/resources.md", "resourcesPath": "/roadmaps/100-frontend/resources.md",
"pdfUrl": "https://kamranahmedse.gumroad.com/l/frontend-roadmap", "pdfUrl": "https://kamranahmedse.gumroad.com/l/frontend-roadmap",
"contentPathsFilePath": "/roadmaps/100-frontend/content-paths.json", "contentPathsFilePath": "/roadmaps/100-frontend/content-paths.json",

View File

@ -12,6 +12,7 @@
"javascript developer", "javascript developer",
"frontend development skills", "frontend development skills",
"frontend development skills test", "frontend development skills test",
"frontend roadmap",
"frontend engineer roadmap", "frontend engineer roadmap",
"frontend developer roadmap", "frontend developer roadmap",
"become a frontend developer", "become a frontend developer",
@ -36,7 +37,8 @@
}, },
"featured": true, "featured": true,
"imagePath": "/roadmaps/frontend.png", "imagePath": "/roadmaps/frontend.png",
"jsonUrl": "/project/frontend.json",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"pdfUrl": "https://kamranahmedse.gumroad.com/l/frontend-roadmap", "pdfUrl": "https://kamranahmedse.gumroad.com/l/frontend-roadmap",
"contentPathsFilePath": "./content-paths.json" "contentPathsFilePath": "./content-paths.json"
} }

View File

@ -5,6 +5,7 @@
"keywords": [ "keywords": [
"guide to becoming a developer", "guide to becoming a developer",
"guide to becoming a backend developer", "guide to becoming a backend developer",
"backend roadmap",
"backend developer", "backend developer",
"backend engineer", "backend engineer",
"backend skills", "backend skills",
@ -31,7 +32,8 @@
"featuredTitle": "Backend", "featuredTitle": "Backend",
"featuredDescription": "Step by step guide to becoming a backend developer in 2021", "featuredDescription": "Step by step guide to becoming a backend developer in 2021",
"featured": true, "featured": true,
"imagePath": "/roadmaps/backend.png", "imageUrl": "/roadmaps/backend.png",
"jsonUrl": "/project/frontend.json",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"author": { "author": {
"name": "Kamran Ahmed", "name": "Kamran Ahmed",

View File

@ -25,7 +25,8 @@
"featuredTitle": "DevOps", "featuredTitle": "DevOps",
"featuredDescription": "Step by step guide for DevOps or operations role in 2021", "featuredDescription": "Step by step guide for DevOps or operations role in 2021",
"featured": true, "featured": true,
"imagePath": "/roadmaps/devops.png", "imageUrl": "/roadmaps/devops.png",
"jsonUrl": "/project/devops.json",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"versions": [ "versions": [
"latest", "latest",

View File

@ -25,6 +25,7 @@
"featured": true, "featured": true,
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"jsonUrl": "/project/react.json",
"versions": [ "versions": [
"latest", "latest",
"2018", "2018",

View File

@ -23,6 +23,7 @@
"isTextHeavy": false, "isTextHeavy": false,
"isCommunity": false, "isCommunity": false,
"featured": true, "featured": true,
"jsonUrl": "/project/angular.json",
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"versions": [ "versions": [

View File

@ -23,6 +23,7 @@
"isTextHeavy": true, "isTextHeavy": true,
"isCommunity": false, "isCommunity": false,
"featured": true, "featured": true,
"jsonUrl": "/project/android.json",
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"versions": [ "versions": [

View File

@ -23,6 +23,7 @@
"isTextHeavy": true, "isTextHeavy": true,
"isCommunity": false, "isCommunity": false,
"featured": true, "featured": true,
"jsonUrl": "/project/python.json",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"pdfUrl": "https://kamranahmedse.gumroad.com/l/python-roadmap", "pdfUrl": "https://kamranahmedse.gumroad.com/l/python-roadmap",

View File

@ -34,6 +34,7 @@
"isCommunity": false, "isCommunity": false,
"isUpcoming": false, "isUpcoming": false,
"featured": true, "featured": true,
"jsonUrl": "/project/golang.json",
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"pdfUrl": "https://kamranahmedse.gumroad.com/l/go-roadmap", "pdfUrl": "https://kamranahmedse.gumroad.com/l/go-roadmap",

View File

@ -33,6 +33,7 @@
"isCommunity": false, "isCommunity": false,
"isUpcoming": false, "isUpcoming": false,
"featured": true, "featured": true,
"jsonUrl": "/project/java.json",
"landingPath": "./landscape.md", "landingPath": "./landscape.md",
"resourcesPath": "./resources.md", "resourcesPath": "./resources.md",
"versions": [ "versions": [

View File

@ -4,18 +4,19 @@ export type RoadmapType = {
seo: { seo: {
title: string; title: string;
description: string; description: string;
keywords: string[] keywords: string[];
}, };
title: string, title: string;
description: string, description: string;
featuredTitle: string; featuredTitle: string;
featuredDescription: string, featuredDescription: string;
author: { author: {
name: string, name: string;
url: string url: string;
}, };
featured: boolean, featured: boolean;
imagePath?: string, imageUrl?: string;
jsonUrl?: string;
landingPath?: string; landingPath?: string;
resourcesPath: string; resourcesPath: string;
contentPathsFilePath?: string; contentPathsFilePath?: string;
@ -27,15 +28,15 @@ export type RoadmapType = {
}; };
export function getRoadmapById(id: string): RoadmapType | undefined { export function getRoadmapById(id: string): RoadmapType | undefined {
return (roadmaps as RoadmapType[]).find(roadmap => roadmap.id === id); return (roadmaps as RoadmapType[]).find((roadmap) => roadmap.id === id);
} }
export function getAllRoadmaps(): RoadmapType[] { export function getAllRoadmaps(): RoadmapType[] {
return (roadmaps as RoadmapType[]); return roadmaps as RoadmapType[];
} }
export function getFeaturedRoadmaps(): RoadmapType[] { export function getFeaturedRoadmaps(): RoadmapType[] {
const roadmaps: RoadmapType[] = getAllRoadmaps(); const roadmaps: RoadmapType[] = getAllRoadmaps();
return roadmaps.filter(roadmap => roadmap.featured); return roadmaps.filter((roadmap) => roadmap.featured);
} }

View File

@ -15,14 +15,14 @@ type RoadmapProps = {
function ImageRoadmap(props: RoadmapProps) { function ImageRoadmap(props: RoadmapProps) {
const { roadmap } = props; const { roadmap } = props;
if (!roadmap.imagePath) { if (!roadmap.imageUrl) {
return null; return null;
} }
return ( return (
<Container maxW={'900px'} position="relative"> <Container maxW={'900px'} position="relative">
<Box mb="30px"> <Box mb="30px">
<Image alt={roadmap.title} src={roadmap.imagePath} /> <Image alt={roadmap.title} src={roadmap.imageUrl} />
</Box> </Box>
</Container> </Container>
); );

View File

@ -30,7 +30,7 @@ function RoadmapRenderer(props: RoadmapProps) {
const [hasErrorRendering, setHasErrorRendering] = useState(false); const [hasErrorRendering, setHasErrorRendering] = useState(false);
useEffect(() => { useEffect(() => {
get(`/project/${roadmap.id}.json`) get(roadmap.jsonUrl)
.then((roadmapJson) => { .then((roadmapJson) => {
setRoadmapJson(roadmapJson); setRoadmapJson(roadmapJson);
}) })
@ -38,7 +38,7 @@ function RoadmapRenderer(props: RoadmapProps) {
console.error(err); console.error(err);
setHasErrorRendering(true); setHasErrorRendering(true);
}); });
}, [get, roadmap.id]); }, [get, roadmap.id, roadmap.jsonUrl]);
// Event bindings for the roadmap interactivity // Event bindings for the roadmap interactivity
useEffect(() => { useEffect(() => {

View File

@ -3,7 +3,7 @@
<url> <url>
<loc>https://roadmap.sh/frontend</loc> <loc>https://roadmap.sh/frontend</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<lastmod>2021-12-04T23:57:18.813Z</lastmod> <lastmod>2021-12-07T12:17:26.159Z</lastmod>
<priority>1.0</priority> <priority>1.0</priority>
</url> </url>
<url> <url>
@ -273,7 +273,7 @@
<url> <url>
<loc>https://roadmap.sh/thanks</loc> <loc>https://roadmap.sh/thanks</loc>
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<lastmod>2021-11-30T15:46:40.893Z</lastmod> <lastmod>2021-12-06T14:21:37.276Z</lastmod>
<priority>0.5</priority> <priority>0.5</priority>
</url> </url>
<url> <url>