All files / components/profile DeveloperSection.tsx

97.79% Statements 133/136
84.21% Branches 16/19
100% Functions 1/1
97.79% Lines 133/136

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 1851x                             1x 9x 9x 9x   9x 9x   9x 9x 8x 8x 8x 8x 24x 24x 24x 8x 8x 8x     9x 8x 8x 8x 8x 24x 24x 24x 8x 8x 8x     9x 8x 8x 8x 8x 24x 24x 24x 8x 8x 8x   9x     9x 9x 8x 8x 8x 8x 8x   8x 8x 8x 8x     9x 8x     9x 8x   9x     9x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x   2x   2x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x 2x   2x 2x     2x 2x 2x 6x 6x 6x 2x 2x         2x       2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x   2x 2x 2x 2x 2x   2x   2x 2x 2x 2x 2x   9x   9x  
'use client';
 
import Link from 'next/link';
import Image from 'next/image';
import { Github, ExternalLink, Star, GitFork, Code2 } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import type { DeveloperProfile, CodeProject } from '@/types/database';
 
interface DeveloperSectionProps {
  developerProfile: DeveloperProfile;
  projects: CodeProject[];
}
 
export function DeveloperSection({ developerProfile, projects }: DeveloperSectionProps) {
  const featuredProjects = projects.filter((p) => p.is_featured);
  const otherProjects = projects.filter((p) => !p.is_featured);
  const displayProjects = [...featuredProjects, ...otherProjects].slice(0, 6);
 
  return (
    <div className="space-y-8">
      {/* Skills & Tech */}
      <div className="space-y-4">
        {developerProfile.primary_languages && developerProfile.primary_languages.length > 0 && (
          <div>
            <h3 className="mb-2 text-sm font-medium text-muted-foreground">Languages</h3>
            <div className="flex flex-wrap gap-2">
              {developerProfile.primary_languages.map((lang: string) => (
                <Badge key={lang} variant="secondary">
                  {lang}
                </Badge>
              ))}
            </div>
          </div>
        )}
 
        {developerProfile.frameworks && developerProfile.frameworks.length > 0 && (
          <div>
            <h3 className="mb-2 text-sm font-medium text-muted-foreground">Frameworks</h3>
            <div className="flex flex-wrap gap-2">
              {developerProfile.frameworks.map((framework: string) => (
                <Badge key={framework} variant="outline">
                  {framework}
                </Badge>
              ))}
            </div>
          </div>
        )}
 
        {developerProfile.tools && developerProfile.tools.length > 0 && (
          <div>
            <h3 className="mb-2 text-sm font-medium text-muted-foreground">Tools</h3>
            <div className="flex flex-wrap gap-2">
              {developerProfile.tools.map((tool: string) => (
                <Badge key={tool} variant="outline">
                  {tool}
                </Badge>
              ))}
            </div>
          </div>
        )}
      </div>
 
      {/* GitHub & Info */}
      <div className="flex flex-wrap items-center gap-4">
        {developerProfile.github_username && (
          <Button variant="outline" size="sm" asChild>
            <Link
              href={`https://github.com/${developerProfile.github_username}`}
              target="_blank"
              rel="noopener noreferrer"
            >
              <Github className="mr-2 h-4 w-4" />
              {developerProfile.github_username}
            </Link>
          </Button>
        )}
 
        {developerProfile.years_experience && developerProfile.years_experience > 0 && (
          <Badge variant="secondary">{developerProfile.years_experience}+ years experience</Badge>
        )}
 
        {developerProfile.open_to_work && (
          <Badge className="bg-green-500/10 text-green-600">Open to Work</Badge>
        )}
      </div>
 
      {/* Projects */}
      {displayProjects.length > 0 && (
        <div>
          <h3 className="mb-4 text-lg font-semibold">Projects</h3>
          <div className="grid gap-4 sm:grid-cols-2">
            {displayProjects.map((project) => (
              <Card key={project.id} className="group overflow-hidden">
                {project.thumbnail_url && (
                  <div className="relative aspect-video overflow-hidden">
                    <Image
                      src={project.thumbnail_url}
                      alt={project.title}
                      fill
                      className="object-cover transition-transform group-hover:scale-105"
                    />
                    {project.is_featured && (
                      <Badge className="absolute left-2 top-2 text-xs">Featured</Badge>
                    )}
                  </div>
                )}
                <CardContent className={project.thumbnail_url ? 'p-4' : 'pt-4'}>
                  <div className="flex items-start justify-between gap-2">
                    <div className="min-w-0 flex-1">
                      <h4 className="truncate font-medium">{project.title}</h4>
                      {project.description && (
                        <p className="mt-1 line-clamp-2 text-sm text-muted-foreground">
                          {project.description}
                        </p>
                      )}
                    </div>
                    <div className="flex gap-1">
                      {project.github_repo_url && (
                        <Button variant="ghost" size="icon" className="h-8 w-8" asChild>
                          <Link href={project.github_repo_url} target="_blank" rel="noopener">
                            <Github className="h-4 w-4" />
                          </Link>
                        </Button>
                      )}
                      {project.live_demo_url && (
                        <Button variant="ghost" size="icon" className="h-8 w-8" asChild>
                          <Link href={project.live_demo_url} target="_blank" rel="noopener">
                            <ExternalLink className="h-4 w-4" />
                          </Link>
                        </Button>
                      )}
                    </div>
                  </div>
 
                  {/* Tech stack */}
                  {project.technologies && project.technologies.length > 0 && (
                    <div className="mt-3 flex flex-wrap gap-1">
                      {project.technologies.slice(0, 4).map((tech: string) => (
                        <Badge key={tech} variant="outline" className="text-xs">
                          {tech}
                        </Badge>
                      ))}
                      {project.technologies.length > 4 && (
                        <Badge variant="outline" className="text-xs">
                          +{project.technologies.length - 4}
                        </Badge>
                      )}
                    </div>
                  )}
 
                  {/* GitHub stats */}
                  {project.is_from_github && (project.stars || project.forks) && (
                    <div className="mt-3 flex items-center gap-3 text-sm text-muted-foreground">
                      {project.stars != null && project.stars > 0 && (
                        <span className="flex items-center gap-1">
                          <Star className="h-3.5 w-3.5" />
                          {project.stars}
                        </span>
                      )}
                      {project.forks != null && project.forks > 0 && (
                        <span className="flex items-center gap-1">
                          <GitFork className="h-3.5 w-3.5" />
                          {project.forks}
                        </span>
                      )}
                      {project.code_language && (
                        <span className="flex items-center gap-1">
                          <Code2 className="h-3.5 w-3.5" />
                          {project.code_language}
                        </span>
                      )}
                    </div>
                  )}
                </CardContent>
              </Card>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}