git ssb

2+

Dominic / yap



Tree: 2e24f63f3e975823d94bc8e83243dd998d9caa5f

Files: 2e24f63f3e975823d94bc8e83243dd998d9caa5f / message-layout.js

910 bytesRaw
1var u = require('yap-util')
2var ref = require('ssb-ref')
3var niceAgo = require('nice-ago')
4var toUrl = u.toUrl
5
6module.exports = function (opts, apply) {
7 return ['div.Message',
8 apply.cacheAttrs(toUrl('message', {id: opts.key}), opts.key, apply.since),
9 ['div.MessageSide',
10 apply('avatar', {id: opts.author, name: false, image: true}),
11 ['a', {
12 href: toUrl('message', {id: opts.id || opts.key}),
13 title: new Date(opts.ts)+'\n'+opts.key
14 },
15 ''+niceAgo(Date.now(), opts.ts)
16 ]
17 ],
18 ['div.MessageMain',
19 ['div.MessageMeta',
20 apply('avatar', {id: opts.author, name: true, image: false}),
21 ['label.msgId', opts.id],
22 opts.meta ? opts.meta : ''
23 ],
24 ['div.MessageContent', opts.content],
25 opts.extra && ['div.MessageExtra', apply('extra', {id: opts.key || opts.id, root: opts.root, branch: opts.branch})]
26 ]
27 ]
28}
29

Built with git-ssb-web