git ssb

2+

mixmix / ticktack



Tree: 9b70108d00646124112662ec83dd9733d7afca7d

Files: 9b70108d00646124112662ec83dd9733d7afca7d / app / page / threadShow.js

1278 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 'unread.sync.markRead': 'first'
13})
14
15exports.create = (api) => {
16 return nest('app.page.threadShow', threadShow)
17
18 function threadShow (location) {
19 // location = a thread (message, may be decorated with replies)
20 const { key, value } = location
21 const root = get(value, 'content.root', key)
22 const channel = get(value, 'content.channel')
23
24 //unread state is set in here...
25 const thread = api.app.html.thread(root)
26
27 const meta = {
28 type: 'post',
29 root,
30 //XXX incorrect branch
31 branch: get(last(location.replies), 'key'),
32 // >> lastId? CHECK THIS LOGIC
33 channel,
34 recps: get(location, 'value.content.recps')
35 }
36 const composer = api.message.html.compose({ meta, shrink: false })
37
38 return h('Page -threadShow', [
39 api.app.html.context(location),
40 h('div.content', [
41 when(thread.subject, h('h1', thread.subject)),
42 thread,
43 composer
44 ]),
45 ])
46 }
47}
48
49
50
51
52
53
54

Built with git-ssb-web