git ssb

2+

mixmix / ticktack



Tree: 17ff653872ea29756b16c13932a8b662d5e1b663

Files: 17ff653872ea29756b16c13932a8b662d5e1b663 / app / page / threadNew.js

1569 bytesRaw
1const nest = require('depnest')
2const { h, Struct, Value, computed } = require('mutant')
3
4exports.gives = nest('app.page.threadNew')
5
6exports.needs = nest({
7 'translations.sync.strings': 'first',
8 'about.html.image': 'first',
9 'about.obs.name': 'first',
10 'app.html.thread': 'first',
11 'history.sync.push': 'first',
12 'keys.sync.id': 'first',
13 'message.html.compose': 'first'
14})
15
16exports.create = (api) => {
17
18 return nest('app.page.threadNew', threadNew)
19
20 function threadNew (location) {
21 const strings = api.translations.sync.strings()
22 const { feed } = location
23 const name = api.about.obs.name(feed)
24
25 const meta = Struct({
26 type: 'post',
27 recps: [
28 api.keys.sync.id(),
29 { link: feed, name }
30 ],
31 subject: Value()
32 })
33 const composer = api.message.html.compose(
34 { meta, shrink: false },
35 (err, msg) => api.history.sync.push(err ? err : msg)
36 )
37
38 return h('Page -threadNew', {title: strings.threadNew.pageTitle}, [
39 h('div.container', [
40 h('div.field -to', [
41 h('div.label', strings.threadNew.field.to),
42 h('div.recps', [
43 h('div.recp', [
44 api.about.html.image(feed),
45 h('div.name', name)
46 ])
47 ])
48 ]),
49 h('div.field -subject', [
50 h('div.label', strings.threadNew.field.subject),
51 h('input', {
52 'ev-input': e => meta.subject.set(e.target.value),
53 placeholder: strings.optionalField
54 }),
55 ]),
56 composer
57 ])
58 ])
59 }
60}
61
62
63
64
65

Built with git-ssb-web