feat: add showCloseButton prop to HITL edit panel for improved customization

- Introduced showCloseButton prop to control the visibility of the close button in the HITL edit panel.
- Updated the component to conditionally render the close button based on the new prop.
This commit is contained in:
Anish Sarkar 2026-03-17 23:58:50 +05:30
parent b7130100aa
commit 5ea347121b

View file

@ -17,12 +17,14 @@ export function HitlEditPanelContent({
content: initialContent, content: initialContent,
onSave, onSave,
onClose, onClose,
showCloseButton = true,
}: { }: {
title: string; title: string;
content: string; content: string;
toolName: string; toolName: string;
onSave: (title: string, content: string) => void; onSave: (title: string, content: string) => void;
onClose?: () => void; onClose?: () => void;
showCloseButton?: boolean;
}) { }) {
const [editedTitle, setEditedTitle] = useState(initialTitle); const [editedTitle, setEditedTitle] = useState(initialTitle);
const markdownRef = useRef(initialContent); const markdownRef = useRef(initialContent);
@ -49,7 +51,7 @@ export function HitlEditPanelContent({
className="flex-1 min-w-0 bg-transparent text-sm font-semibold text-foreground outline-none placeholder:text-muted-foreground" className="flex-1 min-w-0 bg-transparent text-sm font-semibold text-foreground outline-none placeholder:text-muted-foreground"
aria-label="Page title" aria-label="Page title"
/> />
{onClose && ( {onClose && showCloseButton && (
<Button variant="ghost" size="icon" onClick={onClose} className="size-7 shrink-0"> <Button variant="ghost" size="icon" onClick={onClose} className="size-7 shrink-0">
<XIcon className="size-4" /> <XIcon className="size-4" />
<span className="sr-only">Close panel</span> <span className="sr-only">Close panel</span>
@ -124,6 +126,7 @@ function MobileHitlEditDrawer() {
toolName={panelState.toolName} toolName={panelState.toolName}
onSave={panelState.onSave} onSave={panelState.onSave}
onClose={closePanel} onClose={closePanel}
showCloseButton={false}
/> />
</div> </div>
</DrawerContent> </DrawerContent>