From f941cbab5f45444412dbebf04ccdca6a97d097f7 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 11 Dec 2025 10:01:00 +0000 Subject: [PATCH] Update workbench events (#30254) GitOrigin-RevId: 7434483ce125676f1d7d76dfcb09d6691f9dadef --- .../components/rail/rail-panel-header.tsx | 14 ++++++++++++-- .../js/shared/components/copy-to-clipboard.tsx | 8 ++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel-header.tsx b/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel-header.tsx index 8685d9419d..3099245ee1 100644 --- a/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel-header.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/rail/rail-panel-header.tsx @@ -1,18 +1,28 @@ import { useTranslation } from 'react-i18next' import { useRailContext } from '../../contexts/rail-context' import OLIconButton from '@/shared/components/ol/ol-icon-button' -import React from 'react' +import React, { useCallback } from 'react' import OLTooltip from '@/shared/components/ol/ol-tooltip' export default function RailPanelHeader({ title, actions, + onClose, }: { title: React.ReactNode actions?: React.ReactNode[] + onClose?: () => void }) { const { t } = useTranslation() const { handlePaneCollapse } = useRailContext() + + const handleClose = useCallback(() => { + handlePaneCollapse() + if (onClose) { + onClose() + } + }, [handlePaneCollapse, onClose]) + return (

{title}

@@ -25,7 +35,7 @@ export default function RailPanelHeader({ overlayProps={{ placement: 'bottom' }} > (({ content, tooltipId, kind = 'icon', unfilled = false }) => { + onClick?: () => void +}>(({ content, tooltipId, kind = 'icon', unfilled = false, onClick }) => { const { t } = useTranslation() const [copied, setCopied] = useState(false) @@ -21,7 +22,10 @@ export const CopyToClipboard = memo<{ setCopied(false) }, 1500) }) - }, [content]) + if (onClick) { + onClick() + } + }, [content, onClick]) if (!navigator.clipboard?.writeText) { return null