diff --git a/src/component/elements/ToolbarPopoverItem.tsx b/src/component/elements/ToolbarPopoverItem.tsx index 2292ff57ba..16e13bed8c 100644 --- a/src/component/elements/ToolbarPopoverItem.tsx +++ b/src/component/elements/ToolbarPopoverItem.tsx @@ -22,7 +22,7 @@ interface CustomToolbarPopoverItemProps > { itemProps?: Omit; options: Array>; - onClick: (data?: T) => void; + onClick?: (data?: T) => void; } export function ToolbarPopoverItem( @@ -53,13 +53,13 @@ export function ToolbarPopoverItem( text, tooltip = '', tooltipProps, - disabled = !option.tooltip, + disabled, ...otherOptions } = option; return ( ( })} renderTarget={({ isOpen, ...props }) => ( onClick?.(data)} {...otherOptions} {...props} - onClick={() => onClick(data)} /> )} /> diff --git a/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx b/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx index 3c7a4cdd32..9182dd4334 100644 --- a/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +++ b/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx @@ -253,6 +253,28 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) { const hasMolecules = molecules && molecules.length > 0; const showCounter = hasMolecules && renderSource !== 'predictionPanel'; + + const moreMenu: ToolbarPopoverMenuItem[] = [ + { + icon: , + text: 'Expand all hydrogens', + data: { + id: 'expandAllHydrogens', + }, + disabled: !hasMolecules, + onClick: () => expandMoleculeHydrogens(true), + }, + { + icon: , + text: 'Collapse all hydrogens', + data: { + id: 'collapseAllHydrogens', + }, + disabled: !hasMolecules, + onClick: () => expandMoleculeHydrogens(false), + }, + ]; + return ( - } - onClick={() => expandMoleculeHydrogens(true)} - disabled={!hasMolecules} - /> - } - onClick={() => expandMoleculeHydrogens(false)} - disabled={!hasMolecules} + + diff --git a/src/component/toolbar/ToolBar.tsx b/src/component/toolbar/ToolBar.tsx index cd28e0210a..bedf3ebd18 100644 --- a/src/component/toolbar/ToolBar.tsx +++ b/src/component/toolbar/ToolBar.tsx @@ -80,7 +80,7 @@ function useExportList() { const isExperimentalFeature = useCheckExperimentalFeature(); const spectrum = useActiveSpectrum(); const exportMenu = isExperimentalFeature - ? EXPORT_MENU + ? [...EXPORT_MENU] : EXPORT_MENU.filter((item) => item.id !== 'nmre'); if (spectrum) { @@ -133,7 +133,7 @@ export default function ToolBar() { const { fidCounter, ftCounter } = useDatumWithSpectraStatistics(); const importMenu = isExperimentalFeature - ? IMPORT_MENU + ? [...IMPORT_MENU] : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString'); const exportMenu = useExportList();