git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: fdc31e27bc5cf938a560cff2c56cc39de9352cbf

Files: fdc31e27bc5cf938a560cff2c56cc39de9352cbf / plugs / message / html / layout / mini.js

917 bytesRaw
1const h = require('mutant/h')
2const nest = require('depnest')
3
4exports.needs = nest({
5 'message.html': {
6 backlinks: 'first',
7 author: 'first',
8 meta: 'map',
9 timestamp: 'first'
10 },
11 'profile.html.person': 'first'
12})
13
14exports.gives = nest('message.html.layout')
15
16exports.create = (api) => {
17 return nest('message.html.layout', mini)
18
19 function mini (msg, opts) {
20 var classList = []
21 var additionalMeta = []
22 if (opts.priority >= 2) {
23 classList.push('-new')
24 additionalMeta.push(h('span.flag -new', {title: 'New Message'}))
25 }
26 if (opts.layout !== 'mini') return
27 return h('Message -mini', {classList}, [
28 h('header', [
29 h('div.mini', [
30 api.profile.html.person(msg.value.author), ' ',
31 opts.content
32 ]),
33 h('div.meta', {}, [
34 api.message.html.timestamp(msg),
35 additionalMeta
36 ])
37 ])
38 ])
39 }
40}
41

Built with git-ssb-web