import { Box, Button, Text, Container, Link, Stack, Badge } from '@chakra-ui/react';
import { ArrowBackIcon, AtSignIcon, DownloadIcon, ViewIcon } from '@chakra-ui/icons';
import { GlobalHeader } from '../../components/global-header';
import { OpensourceBanner } from '../../components/opensource-banner';
import { UpdatesBanner } from '../../components/updates-banner';
import { Footer } from '../../components/footer';
import { PageHeader } from '../../components/page-header';
import { getAllRoadmaps, getRoadmapById, RoadmapType } from '../../lib/roadmap';
import MdRenderer from '../../components/md-renderer';
import Helmet from '../../components/helmet';
import siteConfig from '../../content/site.json';
import React from 'react';
import { event } from '../../lib/gtag';
type RoadmapProps = {
roadmap: RoadmapType;
};
function ImageRoadmap(props: RoadmapProps) {
const { roadmap } = props;
if (!roadmap.imagePath) {
return null;
}
return (
);
}
function TextualRoadmap(props: RoadmapProps) {
const { roadmap } = props;
if (!roadmap.landingPath) {
return null;
}
// Remove trailing slashes
const normalizedPath = roadmap.landingPath.replace(/^\//, '');
const LandingContent = require(`../../content/${normalizedPath}`).default;
return (
);
}
export function NewBanner() {
return (
event({
category: 'Subscription',
action: 'Clicked the YouTube banner',
label: 'YouTube Alert on Roadmap'
})}>
New
Roadmap topics to be covered on our YouTube
Channel
Topic videos being made on YouTube
»
);
}
export default function Roadmap(props: RoadmapProps) {
const { roadmap } = props;
return (
}
title={roadmap.title}
subtitle={roadmap.description}
>
{roadmap.pdfUrl && (
}
colorScheme='yellow'
variant='solid'
_hover={{ textDecoration: 'none' }}>
Download
)}
}
colorScheme='yellow' variant='solid' _hover={{ textDecoration: 'none' }}>
Subscribe
);
}
type StaticPathItem = {
params: {
roadmap: string
}
};
export async function getStaticPaths() {
const roadmaps = getAllRoadmaps();
const paramsList: StaticPathItem[] = roadmaps.map(roadmap => ({
params: { 'roadmap': roadmap.id }
}));
return {
paths: paramsList,
fallback: false
};
}
type ContextType = {
params: {
roadmap: string
}
};
export async function getStaticProps(context: ContextType) {
const roadmapId: string = context?.params?.roadmap;
return {
props: {
roadmap: getRoadmapById(roadmapId)
}
};
}