@@ -222,42 +222,11 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
222222 data-test-id = { dataTestIdLegacy ? `${ dataTestIdLegacy } -actions` : undefined }
223223 >
224224 { activityActions &&
225- activityActions . map ( ( action , idx ) => {
226- const actionButtonRef = React . useRef ( null ) ;
227- const ActionButton = ( ) => (
228- < IconButton
229- data-test-id = { action [ "data-test-id" ] }
230- data-testid = { action [ "data-testid" ] }
231- name = { action . icon }
232- text = { action . tooltip }
233- onClick = { action . action }
234- disabled = { action . disabled }
235- intent = { action . hasStateWarning ? "warning" : undefined }
236- tooltipProps = { {
237- hoverOpenDelay : 200 ,
238- placement : "bottom"
239- } }
240- active = { action . active }
241- />
242- )
243- return action . notification ?
244- < >
245- < span key = { idx } ref = { actionButtonRef } >
246- < ActionButton />
247- </ span >
248- { actionButtonRef . current && (
249- < DecoupledOverlay targetSelectorOrElement = { actionButtonRef . current } paddingSize = { "small" } >
250- < Notification
251- message = { action . notification . message }
252- intent = { action . notification . intent ?? "neutral" }
253- onDismiss = { action . notification . onClose }
254- timeout = { action . notification . timeout }
255- />
256- </ DecoupledOverlay >
257- ) }
258- </ > :
259- < ActionButton key = { idx } />
260- } ) }
225+ activityActions . map ( ( action , idx ) => < ActivityActionButton
226+ key = { idx }
227+ action = { action }
228+ />
229+ ) }
261230 { additionalActions }
262231 { activityContextMenu && activityContextMenu . menuItems . length > 0 && (
263232 < ContextMenu
@@ -290,3 +259,44 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
290259 < div className = { classname } > { widget } </ div >
291260 ) ;
292261}
262+
263+ interface ActivityActionButtonProps {
264+ action : ActivityControlWidgetAction
265+ }
266+
267+ const ActivityActionButton = ( { action} : ActivityActionButtonProps ) => {
268+ const actionButtonRef = React . useRef ( null ) ;
269+ const ActionButton = ( ) => (
270+ < IconButton
271+ data-test-id = { action [ "data-test-id" ] }
272+ data-testid = { action [ "data-testid" ] }
273+ name = { action . icon }
274+ text = { action . tooltip }
275+ onClick = { action . action }
276+ disabled = { action . disabled }
277+ intent = { action . hasStateWarning ? "warning" : undefined }
278+ tooltipProps = { {
279+ hoverOpenDelay : 200 ,
280+ placement : "bottom"
281+ } }
282+ active = { action . active }
283+ />
284+ )
285+ return action . notification ?
286+ < >
287+ < span ref = { actionButtonRef } >
288+ < ActionButton />
289+ </ span >
290+ { actionButtonRef . current && (
291+ < DecoupledOverlay targetSelectorOrElement = { actionButtonRef . current } paddingSize = { "small" } >
292+ < Notification
293+ message = { action . notification . message }
294+ intent = { action . notification . intent ?? "neutral" }
295+ onDismiss = { action . notification . onClose }
296+ timeout = { action . notification . timeout }
297+ />
298+ </ DecoupledOverlay >
299+ ) }
300+ </ > :
301+ < ActionButton />
302+ }
0 commit comments