import type { Project } from '../types/project'; import ProjectCard from './ProjectCard'; import { useMemo } from 'react'; interface ProjectGridProps { projects: Project[]; loading: boolean; } export default function ProjectGrid({ projects, loading }: ProjectGridProps) { const projectsByType = useMemo(() => { const grouped: Record = { platform: [], client: [], 'dev tool': [], other: [] }; projects.forEach(project => { const type = project.type.toLowerCase(); if (type === 'platform' || type === 'semi-platform') { grouped.platform.push(project); } else if (type === 'client') { grouped.client.push(project); } else if (type === 'dev tool') { grouped['dev tool'].push(project); } else { grouped.other.push(project); } }); return grouped; }, [projects]); if (loading) { return (
{[...Array(12)].map((_, i) => (
))}
); } if (projects.length === 0) { return (

No projects found

Try adjusting your filters or search query

); } const sections = [ { title: 'Platforms', key: 'platform' }, { title: 'Clients', key: 'client' }, { title: 'Dev Tools', key: 'dev tool' } ]; return (
{sections.map(section => { const sectionProjects = projectsByType[section.key]; if (!sectionProjects || sectionProjects.length === 0) return null; return (

{section.title}

{sectionProjects.length}
{sectionProjects.map(project => ( ))}
); })} {projectsByType.other.length > 0 && (

Other

{projectsByType.other.length}
{projectsByType.other.map(project => ( ))}
)}
); }