import { Box, Container } from '@chakra-ui/react';
import { GlobalHeader } from '../../components/global-header';
import { OpensourceBanner } from '../../components/opensource-banner';
import { Footer } from '../../components/footer';
import { getAllRoadmaps, getRoadmapById, RoadmapType } from '../../lib/roadmap';
import MdRenderer from '../../components/md-renderer';
import Helmet from '../../components/helmet';
import { RoadmapPageHeader } from '../../components/roadmap/roadmap-page-header';
type RoadmapProps = {
roadmap: RoadmapType;
};
function RoadmapResources(props: RoadmapProps) {
const { roadmap } = props;
if (!roadmap.resourcesPath) {
return null;
}
// Remove trailing slashes
const normalizedPath = roadmap.resourcesPath.replace(/^\//, '');
const RoadmapContent = require(`../../content/${normalizedPath}`).default;
return (
);
}
export default function Roadmap(props: RoadmapProps) {
const { roadmap } = props;
return (
);
}
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)
}
};
}