Files: fdc31e27bc5cf938a560cff2c56cc39de9352cbf / plugs / message / html / layout / mini.js
917 bytesRaw
1 | const h = require('mutant/h') |
2 | const nest = require('depnest') |
3 | |
4 | exports.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 | |
14 | exports.gives = nest('message.html.layout') |
15 | |
16 | exports.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