git ssb

2+

mixmix / ticktack



Tree: f53d4720c0fe90f6e4f8f94d0f986812e6ca896b

Files: f53d4720c0fe90f6e4f8f94d0f986812e6ca896b / app / page / threadShow.js

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

Built with git-ssb-web