feat: remove a skill category empty
This commit is contained in:
@@ -20,6 +20,8 @@ interface TreeCategoryHeaderProps {
|
||||
totalMembers: number;
|
||||
hasMembers: boolean;
|
||||
};
|
||||
onDeleteCategory?: (categoryName: string) => void; // Nouvelle prop pour supprimer les catégories de skills
|
||||
canDeleteCategory?: boolean; // Si la catégorie peut être supprimée
|
||||
}
|
||||
|
||||
export function TreeCategoryHeader({
|
||||
@@ -34,6 +36,8 @@ export function TreeCategoryHeader({
|
||||
canDelete = true,
|
||||
isDirection = false,
|
||||
directionStats,
|
||||
onDeleteCategory,
|
||||
canDeleteCategory = false,
|
||||
}: TreeCategoryHeaderProps) {
|
||||
return (
|
||||
<div>
|
||||
@@ -85,6 +89,26 @@ export function TreeCategoryHeader({
|
||||
<Trash2 className="w-3 h-3" />
|
||||
</Button>
|
||||
)}
|
||||
{/* Bouton de suppression pour les catégories de skills vides */}
|
||||
{!isDirection && onDeleteCategory && itemCount === 0 && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation(); // Empêcher l'ouverture/fermeture
|
||||
onDeleteCategory(category);
|
||||
}}
|
||||
className="text-red-400 hover:text-red-300 hover:bg-red-500/20 h-6 w-6 p-0"
|
||||
disabled={!canDeleteCategory}
|
||||
title={
|
||||
canDeleteCategory
|
||||
? `Supprimer la catégorie "${category}"`
|
||||
: `Impossible de supprimer la catégorie "${category}"`
|
||||
}
|
||||
>
|
||||
<Trash2 className="w-3 h-3" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user