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