Files: 38e0417253d2dc77736737889d97f936df7f35a0 / app / page / threadShow.js
1024 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 | 'app.html.nav': 'first', |
10 | 'app.html.thread': 'first', |
11 | 'message.html.compose': 'first' |
12 | }) |
13 | |
14 | exports.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, shrink: false }) |
31 | |
32 | return h('Page -threadShow', [ |
33 | h('h1', 'Private message'), |
34 | api.app.html.nav(), |
35 | h('div.container', [ |
36 | thread, |
37 | composer |
38 | ]), |
39 | ]) |
40 | } |
41 | } |
42 |
Built with git-ssb-web