import { Store } from 'shared/libs/stores' ; import { NavGroup } from 'teleport/types' ; const defaultState = { sideNav : [ ] as NavItem [ ] , topNav : [ ] as NavItem [ ] , topMenu : [ ] as NavItem [ ] , } ; export default class StoreNav extends Store < typeof defaultState > { state = { ... defaultState , } ; addTopMenuItem ( item ) { const items = [ ... this . state . topMenu , item ] ; return this . setState ( { topMenu : items , } ) ; } addTopItem ( item ) { const items = [ ... this . state . topNav , item ] ; return this . setState ( { topNav : items , } ) ; } addSideItem ( item ) { const items = [ ... this . state . sideNav , item ] ; return this . setState ( { sideNav : items , } ) ; } getSideItems ( ) { return this . state . sideNav ; } getTopMenuItems ( ) { return this . state . topMenu ; } getTopItems ( ) { return this . state . topNav ; } } export type NavItem = { title : string ; Icon : any ; exact ? : boolean ; getLink ( clusterId ) : string ; group ? : NavGroup ; } ;