import React, { useMemo } from 'react'; import { IconButton, PopoverMenu, PopoverMenuItemProps, } from '@wix/design-system'; import { observer } from 'mobx-react-lite'; import { MoreSmall } from '@wix/wix-ui-icons-common'; import { getDefaultActionCellProps } from '../CollectionItemActions/getDefaultActionCellProps'; import { SecondaryActionAction } from '../ActionCell'; import { FiltersMap } from '../../exports/core'; import { KanbanBaseProps } from '.'; import { ItemActionsState } from '../../state'; import { KanbanState } from '../../state/KanbanState'; import { MessageActionModal } from '../ActionModal'; interface StageActionsProps { state: KanbanState; stageKey: string; stageActionCell: KanbanBaseProps['stageActionCell']; } function _StageActions({ state, stageKey, stageActionCell, }: StageActionsProps) { const keyedItem = state.stagesCollectionState.getKeyedItem(stageKey); const stageActionsState = useMemo(() => { if (!keyedItem) { return null; } return new ItemActionsState({ keyedItem, fade: 'static', collection: state.stagesCollectionState, reportBi: state.toolbar.reportBi, }); }, [keyedItem, state.stagesCollectionState, state.toolbar.reportBi]); if (!keyedItem || !stageActionsState) { return null; } const resolvedActionCell = typeof stageActionCell === 'function' ? stageActionCell( keyedItem.item, keyedItem.indexWithinPage, stageActionsState.actionCellAPI, ) : stageActionCell; const secondaryActions = resolvedActionCell?.secondaryActions; if (!secondaryActions?.length) { return null; } return ( <> {stageActionsState.confirmModal.value && ( )} { return ( { e.stopPropagation(); toggle(); }} > ); }} > {secondaryActions.map((secondaryAction, index) => { if (secondaryAction.divider) { return ; } const action = secondaryAction as SecondaryActionAction; const { icon: prefixIcon, skin, ...rest } = action; return ( ); })} ); } export const StageActions = observer(_StageActions);