diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx index e3c69646d..b8b1fa287 100644 --- a/src/components/Badge.tsx +++ b/src/components/Badge.tsx @@ -13,6 +13,7 @@ export function Badge(type: BadgeProps) { yellow: 'bg-yellow-100 text-yellow-700 border-yellow-200', grey: 'bg-gray-100 text-gray-700 border-gray-200', white: 'bg-white text-black border-gray-200', + teal: 'bg-teal-100 text-teal-700 border-teal-200', }; return ( diff --git a/src/components/Projects/ProjectCard.tsx b/src/components/Projects/ProjectCard.tsx index 3d3ced104..2bfc18a30 100644 --- a/src/components/Projects/ProjectCard.tsx +++ b/src/components/Projects/ProjectCard.tsx @@ -23,6 +23,7 @@ export function ProjectCard(props: ProjectCardProps) { & { id: string; + roadmaps: RoadmapFileType[]; }; /** @@ -74,9 +81,14 @@ export async function getProjectById( groupId: string, ): Promise { const project = await import(`../data/projects/${groupId}.md`); + const roadmapIds = project.frontmatter.roadmapIds || []; + const roadmaps = await Promise.all( + roadmapIds.map((roadmapId: string) => getRoadmapById(roadmapId)), + ); return { ...project, + roadmaps: roadmaps, id: projectPathToId(project.file), }; } diff --git a/src/pages/projects/[projectId].astro b/src/pages/projects/[projectId].astro new file mode 100644 index 000000000..016c0e2fd --- /dev/null +++ b/src/pages/projects/[projectId].astro @@ -0,0 +1,95 @@ +--- +import { EditorRoadmap } from '../../components/EditorRoadmap/EditorRoadmap'; +import FrameRenderer from '../../components/FrameRenderer/FrameRenderer.astro'; +import RelatedRoadmaps from '../../components/RelatedRoadmaps.astro'; +import RoadmapHeader from '../../components/RoadmapHeader.astro'; +import ShareIcons from '../../components/ShareIcons/ShareIcons.astro'; +import { TopicDetail } from '../../components/TopicDetail/TopicDetail'; +import { UserProgressModal } from '../../components/UserProgress/UserProgressModal'; +import BaseLayout from '../../layouts/BaseLayout.astro'; +import { Badge } from '../../components/Badge'; +import { + generateArticleSchema, + generateFAQSchema, +} from '../../lib/jsonld-schema'; +import { getOpenGraphImageUrl } from '../../lib/open-graph'; +import { type RoadmapFrontmatter, getRoadmapIds } from '../../lib/roadmap'; +import RoadmapNote from '../../components/RoadmapNote.astro'; +import { RoadmapTitleQuestion } from '../../components/RoadmapTitleQuestion'; +import ResourceProgressStats from '../../components/ResourceProgressStats.astro'; +import { + getAllProjects, + getProjectById, + getProjectsByRoadmapId, + ProjectFrontmatter, +} from '../../lib/project'; +import AstroIcon from '../../components/AstroIcon.astro'; + +export async function getStaticPaths() { + const projects = await getAllProjects(); + + return projects + .map((project) => project.id) + .map((projectId) => ({ + params: { projectId }, + })); +} + +interface Params extends Record { + projectId: string; +} + +const { projectId } = Astro.params as Params; + +const project = await getProjectById(projectId); +const projectData = project.frontmatter as ProjectFrontmatter; + +let jsonLdSchema = []; + +const ogImageUrl = projectData?.seo?.ogImageUrl || '/images/og-img.png'; +--- + + +
+
+ + +
+
+
+ + +
+

{projectData.title}

+

{projectData.description}

+
+
+
+
+