Files: 9bf270081d898c0ec622f792b7f8e6e340f7a102 / app / page / threadShow.js
1098 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = 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 | 'translations.sync.strings': 'first', |
10 | 'app.html.nav': 'first', |
11 | 'app.html.thread': 'first', |
12 | 'message.html.compose': 'first' |
13 | }) |
14 | |
15 | exports.create = (api) => { |
16 | var strings = api.translations.sync.strings() |
17 | |
18 | return nest('app.page.threadShow', threadShow) |
19 | |
20 | function threadShow (location) { |
21 | // location = a thread (message decorated with replies) |
22 | const { key: root, replies, channel } = location |
23 | |
24 | const thread = api.app.html.thread(root) |
25 | |
26 | const meta = { |
27 | type: 'post', |
28 | root, |
29 | branch: get(last(location.replies), 'key'), |
30 | // >> lastId? CHECK THIS LOGIC |
31 | channel: channel, |
32 | recps: get(location, 'value.content.recps') |
33 | } |
34 | const composer = api.message.html.compose({ meta, shrink: false }) |
35 | |
36 | return h('Page -threadShow', {title: strings.threadShow}, [ |
37 | h('div.container', [ |
38 | thread, |
39 | composer |
40 | ]), |
41 | ]) |
42 | } |
43 | } |
44 | |
45 |
Built with git-ssb-web