"use client";
import Link from 'next/link';
import { Calendar, DollarSign, TrendingUp } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
import { Project, ProjectStatus } from '@/types/project';
interface ProjectListItemProps {
project: Project;
}
// Función para generar iniciales
function getInitials(name: string): string {
return name
.split(' ')
.map(word => word[0])
.join('')
.toUpperCase()
.slice(0, 2);
}
// Componente para el badge de estado con estilos directos
function StatusBadge({ status }: { status: ProjectStatus }) {
if (status === '0') {
return (
Borrador
);
}
if (status === '1') {
return (
Abierto
);
}
if (status === '2') {
return (
Cerrado
);
}
// Fallback
return (
Desconocido
);
}
/**
* Componente de fila de proyecto para vista de lista
* Diseño horizontal y compacto
*/
export default function ProjectListItem({ project }: ProjectListItemProps) {
const initials = getInitials(project.name);
return (
{/* Avatar */}
{initials}
{/* Info Principal */}
{project.name}
{project.ref}
{project.client !== 'Sin cliente' && (
{project.client}
)}
{/* Estado */}
{/* Progreso */}
Progreso
{project.progress}%
{/* Presupuesto */}
€{project.budget.toLocaleString('es-ES', { minimumFractionDigits: 0, maximumFractionDigits: 0 })}
Presupuesto
{/* Fechas */}
{new Date(project.startDate).toLocaleDateString('es-ES', { day: '2-digit', month: 'short' })}
Inicio
);
}