git ssb

2+

mixmix / ticktack



Tree: f1e1c0f3aedd176590017f411e2a923155169442

Files: f1e1c0f3aedd176590017f411e2a923155169442 / app / page / threadShow.js

988 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 })
31
32 return h('Page -threadShow', [
33 h('h1', 'Private message'),
34 api.app.html.nav(),
35 h('div.container', thread),
36 composer
37 ])
38 }
39}
40

Built with git-ssb-web