import '@material/web/iconbutton/standard-icon-button.js';
import {
mdiMenu,
mdiMenuOpen
} from '@mdi/js';
import {collect} from 'collect.js';
import {
Vnode,
VnodeDOM
} from 'mithril';
import {
Attributes,
Component
} from 'mithril-utilities';
import Stream from 'mithril/stream';
import logo from '~/../images/logo.png';
import Drawer from '~/Components/layout/Drawer';
import NotificationsAction from '~/Components/layout/topappbar_actions/NotificationsAction';
import PeriodSwitcherAction from '~/Components/layout/topappbar_actions/PeriodSwitcherAction';
import PrintAction from '~/Components/layout/topappbar_actions/PrintAction';
import UserInfoAction from '~/Components/layout/topappbar_actions/UserInfoAction';
import MdIcon from '~/Components/MdIcon';
import {VnodeCollectionItem} from '~/typings/jsx';
import {
isMobile,
mobileMediaQuery
} from '~/utils/misc';
import '~/WebComponents/TopAppBar';
export default class TopAppBar extends Component {
drawerOpenState = Stream(!isMobile());
view(vnode: Vnode) {
return (
<>
{vnode.children}
{__('OpenSTAManager')}
{this.actions().toArray()}
>
);
}
oncreate(vnode: VnodeDOM) {
super.oncreate(vnode);
this.element.addEventListener('MDCTopAppBar:nav', () => {
this.drawerOpenState(!this.drawerOpenState());
});
mobileMediaQuery().addEventListener('change', (event) => {
this.drawerOpenState(event.matches || this.drawerOpenState());
});
this.drawerOpenState.map((value) => {
m.redraw();
return value;
});
}
actions() {
return collect({
notifications: ,
print: ,
periodSwitcher: ,
userInfo:
});
}
}