Files: 1c2926f12ff8e365e1d469f23180b50d50b9c749 / app / page / shortcuts.js
810 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = require('mutant') |
3 | const fs = require('fs') |
4 | const { join } = require('path') |
5 | |
6 | const rawMd = fs.readFileSync(join(__dirname, './SHORTCUTS.md'), 'utf8') |
7 | |
8 | exports.gives = nest({ |
9 | 'app.html.menuItem': true, |
10 | 'app.page.shortcuts': true |
11 | }) |
12 | |
13 | exports.needs = nest({ |
14 | 'app.sync.goTo': 'first', |
15 | 'message.html.markdown': 'first' |
16 | }) |
17 | |
18 | exports.create = function (api) { |
19 | return nest({ |
20 | 'app.html.menuItem': menuItem, |
21 | 'app.page.shortcuts': shortcutsPage |
22 | }) |
23 | |
24 | function menuItem () { |
25 | return h('a', { |
26 | 'ev-click': () => api.app.sync.goTo({ page: 'shortcuts' }) |
27 | }, '/shortcuts') |
28 | } |
29 | |
30 | function shortcutsPage (location) { |
31 | const page = h('Shortcuts', [ |
32 | api.message.html.markdown(rawMd) |
33 | ]) |
34 | |
35 | page.title = '/shortcuts' |
36 | return page |
37 | } |
38 | } |
39 |
Built with git-ssb-web