import { useState } from 'react'; import type { Project } from '../types/project'; interface ProjectCardProps { project: Project; } export default function ProjectCard({ project }: ProjectCardProps) { const [showWarning, setShowWarning] = useState(false); const [showInfrastructureInfo, setShowInfrastructureInfo] = useState(false); const getLinkIcon = (kind: string, url?: string) => { // Special case: Show Bluesky icon for social links on bsky.app if (kind === 'social' && url?.includes('bsky.app')) { return ( ); } // Special case: Show Mastodon icon for social links on Mastodon instances if (kind === 'social' && (url?.includes('mastodon.social') || url?.includes('tech.lgbt') || url?.includes('social.funkwhale.audio'))) { return ( Mastodon ); } switch (kind) { case 'homepage': return ( ); case 'repo': // Use GitHub icon only for GitHub URLs, otherwise use code icon if (url?.includes('github.com')) { return ( ); } else { return ( ); } case 'docs': return ( ); case 'demo': return ( ); case 'spec': return ( ); case 'social': return ( ); default: return ( ); } }; const homepageLink = project.links?.find(link => link.kind === 'homepage')?.url; return (
{project.logoUrl ? ( {`${project.name} ) : (
)}

{project.name}

{(project.domain || project.owner) && (

{project.domain || `github.com/${project.owner}`}

)}
{project.hasIndependentInfrastructure && (
{showInfrastructureInfo && ( <>
setShowInfrastructureInfo(false)} />
Runs fully independent infrastructure
)}
Runs fully independent infrastructure
)} {project.type === 'semi-platform' && (
{showWarning && ( <>
setShowWarning(false)} />
Has not implemented open-source platform-based AT Protocol lexicon
)}
Has not implemented open-source platform-based AT Protocol lexicon
)}
{project.bannerUrl && (
{`${project.name}
)}

{project.description}

{project.tags.map(tag => ( {tag} ))}
{project.links && project.links.length > 0 && (
{project.links.map((link, index) => ( {getLinkIcon(link.kind, link.url)} ))}
)}
); }