@@ -2,7 +2,6 @@ import { useLayoutEffect } from 'react';
22import { useDispatch } from 'react-redux' ;
33import actions from 'actions' ;
44import PropTypes from 'prop-types' ;
5- import createItemsForBookmarkOutlineFlyout from 'src/helpers/createItemsForBookmarkOutlineFlyout' ;
65
76const createFlyoutItem = ( option , icon , label ) => ( {
87 icon,
@@ -51,7 +50,36 @@ const MoreOptionsContextMenuFlyout = ({
5150 const bookmarkOutlineFlyout = {
5251 dataElement : flyoutSelector ,
5352 className : 'MoreOptionsContextMenuFlyout' ,
54- items : createItemsForBookmarkOutlineFlyout ( menuItems , type , shouldHideDeleteButton , handleOnClick , menuTypes ) ,
53+ items : menuItems . map ( ( item ) => {
54+ const { option } = item ;
55+ let hidden = false ;
56+ if ( option === menuTypes . DELETE ) {
57+ hidden = shouldHideDeleteButton ;
58+ }
59+ if ( [ menuTypes . DOWNLOAD , menuTypes . OPENFILE ] . includes ( option ) ) {
60+ hidden = type !== 'portfolio' ;
61+ }
62+ if ( option === menuTypes . SETDEST ) {
63+ hidden = type !== 'outline' ;
64+ }
65+ if ( option === menuTypes . OPENFORMFIELDPANEL ) {
66+ hidden = [ 'portfolio' , 'bookmark' ] . includes ( type ) ;
67+ }
68+ if ( [ menuTypes . MOVE_UP , menuTypes . MOVE_DOWN ] . includes ( option ) ) {
69+ hidden = ! [ 'portfolio' ] . includes ( type ) ;
70+ }
71+
72+ if ( [ menuTypes . MOVE_LEFT , menuTypes . MOVE_RIGHT , menuTypes . MOVE_UP , menuTypes . MOVE_DOWN ] . includes ( option ) ) {
73+ hidden = type !== 'outline' ;
74+ }
75+
76+ return {
77+ ...item ,
78+ hidden,
79+ dataElement : `${ type } ${ item . dataElement } ` ,
80+ onClick : ( ) => handleOnClick ( item . option ) ,
81+ } ;
82+ } ) ,
5583 } ;
5684 async function runDispatch ( ) {
5785 if ( ! currentFlyout ) {
0 commit comments