|
|
|
@ -73,13 +73,21 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => |
|
|
|
|
|
|
|
|
|
const menu = () => { |
|
|
|
|
let group = 0 |
|
|
|
|
return actions.filter(item => filterItem(item)).map((item, index) => { |
|
|
|
|
const groupedActions = actions.filter(item => filterItem(item)).reduce((acc, item) => { |
|
|
|
|
if (item.group === undefined || item.group === null) item.group = 99 |
|
|
|
|
if (!acc[item.group]) acc[item.group] = [] |
|
|
|
|
acc[item.group].push(item) |
|
|
|
|
return acc; |
|
|
|
|
}, []) |
|
|
|
|
console.log(groupedActions) |
|
|
|
|
return groupedActions.map((groupItem, groupIndex) => groupItem.map((item, index) => { |
|
|
|
|
const key = groupIndex*index |
|
|
|
|
const className = `remixui_liitem ${group !== item.group ? 'border-top': ''}` |
|
|
|
|
group = item.group |
|
|
|
|
if(item.name === "Upload File"){ |
|
|
|
|
return <li |
|
|
|
|
id={`menuitem${item.name.toLowerCase()}`} |
|
|
|
|
key={index} |
|
|
|
|
key={key} |
|
|
|
|
className={className} |
|
|
|
|
onClick={()=>{ |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'uploadFile']) |
|
|
|
@ -91,7 +99,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => |
|
|
|
|
if(item.name === "Load a Local File"){ |
|
|
|
|
return <li |
|
|
|
|
id={`menuitem${item.name.toLowerCase()}`} |
|
|
|
|
key={index} |
|
|
|
|
key={key} |
|
|
|
|
className={className} |
|
|
|
|
onClick={()=>{ |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'uploadFile']) |
|
|
|
@ -101,7 +109,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => |
|
|
|
|
} |
|
|
|
|
return <li |
|
|
|
|
id={`menuitem${item.name.toLowerCase()}`} |
|
|
|
|
key={index} |
|
|
|
|
key={key} |
|
|
|
|
className={className} |
|
|
|
|
onClick={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
@ -173,7 +181,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => |
|
|
|
|
} |
|
|
|
|
hideContextMenu() |
|
|
|
|
}}>{intl.formatMessage({id: `filePanel.${item.id}`, defaultMessage: item.label || item.name})}</li> |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|