git ssb

2+

mixmix / ticktack



Tree: c2bb5938dd867f68b9245abaae29edc60ca2bb7c

Files: c2bb5938dd867f68b9245abaae29edc60ca2bb7c / app / page / threadShow.js

1173 bytesRaw
1const nest = require('depnest')
2const { h, computed, when } = require('mutant')
3const last = require('lodash/last')
4const get = require('lodash/get')
5
6exports.gives = nest('app.page.threadShow')
7
8exports.needs = nest({
9 'app.html.context': 'first',
10 'app.html.thread': 'first',
11 'message.html.compose': 'first'
12})
13
14exports.create = (api) => {
15 return nest('app.page.threadShow', threadShow)
16
17 function threadShow (location) {
18 // location = a thread (message, may be decorated with replies)
19 const { key, value } = location
20 const root = get(value, 'content.root', key)
21 const channel = get(value, 'content.channel')
22
23 const thread = api.app.html.thread(root)
24
25 const meta = {
26 type: 'post',
27 root,
28 branch: get(last(location.replies), 'key'),
29 // >> lastId? CHECK THIS LOGIC
30 channel,
31 recps: get(location, 'value.content.recps')
32 }
33 const composer = api.message.html.compose({ meta, shrink: false })
34
35 return h('Page -threadShow', [
36 api.app.html.context(location),
37 h('div.content', [
38 when(thread.subject, h('h1', thread.subject)),
39 thread,
40 composer
41 ]),
42 ])
43 }
44}
45
46
47

Built with git-ssb-web