Files: d6d6eae9c07646a979ad0e986e126984fbd0f2cd / app / page / threadShow.js
1246 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed, when } = require('mutant') |
3 | const last = require('lodash/last') |
4 | const get = require('lodash/get') |
5 | |
6 | exports.gives = nest('app.page.threadShow') |
7 | |
8 | exports.needs = nest({ |
9 | 'app.html.sideNav': 'first', |
10 | 'app.html.thread': 'first', |
11 | 'message.html.compose': 'first', |
12 | 'unread.sync.markRead': 'first', |
13 | 'feed.obs.thread': 'first' |
14 | }) |
15 | |
16 | exports.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.sideNav(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