Files: 0baf5414ce7a4d8be1f75148ec7dce869d876d66 / message / html / render / zz_fallback.js
683 bytesRaw
1 | var h = require('mutant/h') |
2 | var nest = require('depnest') |
3 | |
4 | exports.needs = nest({ |
5 | 'message.html': { |
6 | decorate: 'reduce', |
7 | layout: 'first' |
8 | } |
9 | } |
10 | |
11 | exports.gives = nest('message.html.render') |
12 | |
13 | exports.create = function (api) { |
14 | return nest('message.html.render', message_render) |
15 | |
16 | function message_render (msg) { |
17 | var element = api.message_layout(msg, { |
18 | content: message_content(msg), |
19 | layout: 'mini' |
20 | }) |
21 | |
22 | return api.message_decorate(element, { msg }) |
23 | } |
24 | |
25 | function message_content (msg) { |
26 | if (typeof msg.value.content === 'string') { |
27 | return h('code', {}, 'PRIVATE') |
28 | } else { |
29 | return h('code', {}, msg.value.content.type) |
30 | } |
31 | } |
32 | } |
33 |
Built with git-ssb-web