git ssb

16+

Dominic / patchbay



Tree: 2b05be8ee023fdd9580d6a845ba074a425756685

Files: 2b05be8ee023fdd9580d6a845ba074a425756685 / app / html / menu.js

778 bytesRaw
1const nest = require('depnest')
2const { h } = require('mutant')
3
4exports.gives = nest('app.html.menu')
5
6exports.needs = nest({
7 'app.html.menuItem': 'map',
8 'app.sync.goTo': 'first'
9})
10
11exports.create = function (api) {
12 var _menu
13
14 return nest('app.html.menu', function menu () {
15 if (_menu) return _menu
16
17 const menuItems = api.app.html.menuItem(api.app.sync.goTo).map(item => {
18 // Remove custom order from dependencies that give app.html.menuItem
19 item.style.order = null
20 return item
21 })
22 const sortedMenuItems = Object.values(menuItems).sort((a, b) =>
23 a.text.localeCompare(b.text)
24 )
25
26 // TODO: move goTo out into each menuItem
27 _menu = h('i.Menu.fa.fa-bars', [
28 h('div', sortedMenuItems)
29 ])
30
31 return _menu
32 })
33}
34

Built with git-ssb-web