diff --git a/src/components/ProjectCard.astro b/src/components/ProjectCard.astro index 0f65161..1f0bb1c 100644 --- a/src/components/ProjectCard.astro +++ b/src/components/ProjectCard.astro @@ -13,12 +13,13 @@ interface Props { image?: ImageMetadata; stars?: number; downloads?: number; + category?: string; } -const { title, slug, description, techStack, repoUrl, image, stars, downloads } = Astro.props; +const { title, slug, description, techStack, repoUrl, image, stars, downloads, category } = Astro.props; --- -
+
{image && ( { +export const getStaticPaths = (async () => { const allProjects = await getProjectsWithStats(); // Sort by GitHub stars (highest first), using live stats when available const sortedProjects = allProjects.sort((a, b) => { @@ -14,10 +13,32 @@ export const getStaticPaths = (async ({ paginate }) => { return bStars - aStars; }); - return paginate(sortedProjects, { pageSize: 9 }); + return [{ params: { page: undefined }, props: { projects: sortedProjects } }]; }) satisfies GetStaticPaths; -const { page } = Astro.props; +const { projects } = Astro.props; + +// Category labels for filter buttons +const categoryLabels: Record = { + 'vs-extension': 'VS Extensions', + 'vscode-extension': 'VS Code Extensions', + 'github-action': 'GitHub Actions', + 'cli-tool': 'CLI Tools', + 'nuget-package': 'NuGet Packages', + 'desktop-app': 'Desktop Apps', + 'documentation': 'Documentation', +}; + +// Get unique categories from projects, sorted by count (descending) +const categoryCounts = projects.reduce((acc, project) => { + const cat = project.data.category; + acc[cat] = (acc[cat] || 0) + 1; + return acc; +}, {} as Record); + +const categories = Object.entries(categoryCounts) + .sort((a, b) => b[1] - a[1]) + .map(([cat]) => cat); --- @@ -28,8 +49,28 @@ const { page } = Astro.props; A collection of open source projects I've created and maintain, sorted by GitHub stars.

-
- {page.data.map(project => { + +
+ + {categories.map(cat => ( + + ))} +
+ +
+ {projects.map(project => { const stars = project.githubStats?.stars ?? project.data.stars; const downloads = project.marketplaceStats?.downloads ?? project.marketplaceStats?.installs ?? project.data.downloads; return ( @@ -42,18 +83,48 @@ const { page } = Astro.props; image={project.resolvedImage} stars={stars} downloads={downloads} + category={project.data.category} /> ); })}
- - {page.lastPage > 1 && ( - - )}
+ +