2026-01-30 19:59:44 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { ArrowLeft, MoreHorizontal, Pencil, Trash2, Share2, Copy } from "lucide-react";
|
|
|
|
|
import { useRouter } from "next/navigation";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
|
|
|
|
import {
|
|
|
|
|
DropdownMenu,
|
|
|
|
|
DropdownMenuContent,
|
|
|
|
|
DropdownMenuItem,
|
|
|
|
|
DropdownMenuSeparator,
|
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
|
} from "@/components/ui/dropdown-menu";
|
2026-01-31 12:56:51 +00:00
|
|
|
import { ProjectStatusBadge } from "@/components/ui/project-status-badge";
|
|
|
|
|
import { Project } from "@/types/project";
|
2026-01-30 19:59:44 +00:00
|
|
|
|
|
|
|
|
interface ProjectHeaderProps {
|
|
|
|
|
project: Project;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Función para generar iniciales
|
|
|
|
|
function getInitials(name: string): string {
|
|
|
|
|
return name
|
|
|
|
|
.split(" ")
|
|
|
|
|
.map((word) => word[0])
|
|
|
|
|
.join("")
|
|
|
|
|
.toUpperCase()
|
|
|
|
|
.slice(0, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function ProjectHeader({ project }: ProjectHeaderProps) {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const initials = getInitials(project.name);
|
|
|
|
|
|
|
|
|
|
const handleCopyRef = () => {
|
|
|
|
|
navigator.clipboard.writeText(project.ref);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="border-b bg-card">
|
|
|
|
|
<div className="px-6 py-4">
|
|
|
|
|
{/* Navegación */}
|
|
|
|
|
<div className="flex items-center gap-2 text-sm text-muted-foreground mb-4">
|
|
|
|
|
<Link href="/proyectos" className="hover:text-foreground transition-colors">
|
|
|
|
|
Proyectos
|
|
|
|
|
</Link>
|
|
|
|
|
<span>/</span>
|
|
|
|
|
<span className="text-foreground font-medium">{project.ref}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Header principal */}
|
|
|
|
|
<div className="flex items-start justify-between gap-4">
|
|
|
|
|
<div className="flex items-start gap-4">
|
|
|
|
|
{/* Avatar */}
|
|
|
|
|
<Avatar className="h-16 w-16 shrink-0">
|
|
|
|
|
<AvatarFallback className="bg-gradient-to-br from-blue-500 to-purple-600 text-white font-semibold text-xl">
|
|
|
|
|
{initials}
|
|
|
|
|
</AvatarFallback>
|
|
|
|
|
</Avatar>
|
|
|
|
|
|
|
|
|
|
{/* Info principal */}
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<h1 className="text-2xl font-bold tracking-tight">{project.name}</h1>
|
2026-01-31 12:56:51 +00:00
|
|
|
<ProjectStatusBadge status={project.status} className="text-sm px-3 py-1" />
|
2026-01-30 19:59:44 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center gap-4 text-sm text-muted-foreground">
|
|
|
|
|
<button
|
|
|
|
|
onClick={handleCopyRef}
|
|
|
|
|
className="flex items-center gap-1.5 hover:text-foreground transition-colors font-mono"
|
|
|
|
|
title="Copiar referencia"
|
|
|
|
|
>
|
|
|
|
|
{project.ref}
|
|
|
|
|
<Copy className="h-3.5 w-3.5" />
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
{project.client !== "Sin cliente" && (
|
|
|
|
|
<>
|
|
|
|
|
<span className="text-muted-foreground/50">|</span>
|
|
|
|
|
<span>{project.client}</span>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Acciones */}
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<Button variant="outline" size="sm" onClick={() => router.back()}>
|
|
|
|
|
<ArrowLeft className="h-4 w-4 mr-2" />
|
|
|
|
|
Volver
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
|
|
<DropdownMenu>
|
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
|
<Button variant="outline" size="icon" className="h-9 w-9">
|
|
|
|
|
<MoreHorizontal className="h-4 w-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
|
<DropdownMenuContent align="end">
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<Pencil className="h-4 w-4 mr-2" />
|
|
|
|
|
Editar proyecto
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
<DropdownMenuItem>
|
|
|
|
|
<Share2 className="h-4 w-4 mr-2" />
|
|
|
|
|
Compartir
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
|
<DropdownMenuItem className="text-destructive focus:text-destructive">
|
|
|
|
|
<Trash2 className="h-4 w-4 mr-2" />
|
|
|
|
|
Eliminar
|
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
</DropdownMenuContent>
|
|
|
|
|
</DropdownMenu>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|