import * as m from 'mithril' ; import state from '../state/state' ; import EditMenu from './menus/EditMenu' ; import FileMenu from './menus/FileMenu' ; import MoveNodeMenu from './menus/MoveNodeMenu' ; import SizeSettingsMenu from './menus/SizeSettingsMenu' ; import UndoRedoMenu from './menus/UndoRedoMenu' ; returns function Menu ( ) { return { view : ( ) : m . Vnode => { switch ( state . ui . getCurrentMenu ( ) ) { case 'edit' : return m ( EditMenu ) ; case 'file' : return m ( FileMenu ) ; case 'moveNode' : return m ( MoveNodeMenu ) ; case 'sizeSettings' : return m ( SizeSettingsMenu ) ; case 'undoRedo' : return m ( UndoRedoMenu ) ; default : return m ( '' ) ; } } , } ; } export default Menu ;