git ssb

2+

mixmix / ticktack



Tree: 38e0417253d2dc77736737889d97f936df7f35a0

Files: 38e0417253d2dc77736737889d97f936df7f35a0 / app / page / threadShow.js

1024 bytesRaw
1const nest = require('depnest')
2const { h } = 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.nav': '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 decorated with replies)
19 const { key: root, replies, channel } = location
20
21 const thread = api.app.html.thread(root)
22
23 const meta = {
24 type: 'post',
25 root,
26 branch: get(last(location.replies), 'key'), // >> lastId? CHECK THIS LOGIC
27 channel,
28 recps: get(location, 'value.content.recps')
29 }
30 const composer = api.message.html.compose({ meta, shrink: false })
31
32 return h('Page -threadShow', [
33 h('h1', 'Private message'),
34 api.app.html.nav(),
35 h('div.container', [
36 thread,
37 composer
38 ]),
39 ])
40 }
41}
42

Built with git-ssb-web