'use client';
import React from 'react';
import {ArrowLeft, LucideIcon, Pencil, Plus, Save, Share2, Trash2, X} from 'lucide-react';
import {useTranslations} from '@/lib/i18n';
import {ViewMode} from '@/lib/types/settings';
import Button from '@/components/ui/Button';
import IconButton from '@/components/ui/IconButton';
type ActionVariant = 'primary' | 'danger' | 'ghost';
interface ActionButton {
icon: LucideIcon;
onClick: () => void;
title?: string;
variant?: ActionVariant;
}
interface SidebarHeaderProps {
title: string;
defaultTitle: string;
viewMode: ViewMode;
isNew: boolean;
onBack: () => void;
onEdit?: () => void;
onSave?: () => void;
onCancel?: () => void;
onDelete?: () => void;
onExport?: () => void;
showExport?: boolean;
showDelete?: boolean;
}
/**
* ToolDetailHeader - Header pour les composants Editor (ComposerRightBar) et Settings Detail/Edit
* Comportement par mode:
* - list: Retourne null (pas de header)
* - detail: Boutons Back, Edit, Delete, Export (si applicable)
* - edit: Boutons Cancel, Save/Create
*/
export default function ToolDetailHeader({
title,
defaultTitle,
viewMode,
isNew,
onBack,
onEdit,
onSave,
onCancel,
onDelete,
onExport,
showExport = false,
showDelete = true,
}: SidebarHeaderProps): React.JSX.Element | null {
const t = useTranslations();
if (viewMode === 'list') {
return null;
}
function renderActionButton(button: ActionButton, index: number): React.JSX.Element {
return (