Files: f6a16e3fc5c25cadd2445d141a36a91d964a1813 / app / page / blogNew.js
1489 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, Struct, Value } = require('mutant') |
3 | |
4 | exports.gives = nest('app.page.blogNew') |
5 | |
6 | exports.needs = nest({ |
7 | 'app.html.context': 'first', |
8 | // 'app.html.threadCard': 'first', |
9 | 'history.sync.push': 'first', |
10 | // 'keys.sync.id': 'first', |
11 | 'message.html.compose': 'first', |
12 | 'translations.sync.strings': 'first', |
13 | // 'state.obs.threads': 'first', |
14 | // 'unread.sync.isUnread': 'first' |
15 | }) |
16 | |
17 | exports.create = (api) => { |
18 | var contentHtmlObs |
19 | |
20 | return nest('app.page.blogNew', blogNew) |
21 | |
22 | function blogNew (location) { |
23 | const strings = api.translations.sync.strings() |
24 | |
25 | const meta = Struct({ |
26 | type: 'blog', |
27 | channel: Value(), |
28 | title: Value(), |
29 | }) |
30 | |
31 | const composer = api.message.html.compose( |
32 | { meta, shrink: false }, |
33 | (err, msg) => api.history.sync.push(err ? err : msg) |
34 | ) |
35 | |
36 | return h('Page -blogNew', [ |
37 | api.app.html.context(location), |
38 | h('div.content', [ |
39 | h('div.field -channel', [ |
40 | h('div.label', strings.channel), |
41 | h('input', { |
42 | 'ev-input': e => meta.title.set(e.target.value), // TODO - suggest-mention |
43 | placeholder: strings.channel |
44 | }), |
45 | ]), |
46 | h('div.field -title', [ |
47 | h('div.label', strings.blogNew.field.title), |
48 | h('input', { |
49 | 'ev-input': e => meta.title.set(e.target.value), |
50 | placeholder: strings.blogNew.field.title |
51 | }), |
52 | ]), |
53 | composer |
54 | ]) |
55 | ]) |
56 | } |
57 | } |
58 |
Built with git-ssb-web