Add roadmap rendering

This commit is contained in:
Kamran Ahmed
2021-08-29 21:29:14 +02:00
parent 74ef38cdb6
commit 67b8af3f6b
14 changed files with 121 additions and 45 deletions

View File

@ -20,14 +20,12 @@ export type RoadmapType = {
contentPath?: string;
resourcesPath: string;
isCommunity: boolean;
id: string;
url: string;
};
export function getRequestedRoadmap(req: NextApiRequest): RoadmapType | undefined {
// remove trailing slashes
const normalizedUrl = req.url?.replace(/\/$/, '') || '';
return (roadmaps as RoadmapType[]).find(roadmap => normalizedUrl.startsWith(roadmap.url));
export function getRoadmapById(id: string): RoadmapType | undefined {
return (roadmaps as RoadmapType[]).find(roadmap => roadmap.id === id);
}
export function getAllRoadmaps(): RoadmapType[] {