git ssb

16+

Dominic / patchbay



Tree: 5735e273f1d15ee90fb67318abe87d354d52a937

Files: 5735e273f1d15ee90fb67318abe87d354d52a937 / feed / html / feedCard.js

878 bytesRaw
1const nest = require('depnest')
2const { h, resolve, computed } = require('mutant')
3
4exports.gives = nest({
5 'feed.html.feedCard': true
6})
7
8exports.needs = nest({
9 'message.html.render': 'first',
10})
11
12
13exports.create = function (api) {
14 return nest({
15 'feed.html.feedCard': feedCard,
16 })
17
18 function feedCard (msgObs) {
19 const msg = resolve(msgObs) // actually the rollup
20
21 const opts = {
22 attributes: {
23 tabindex: '0', // needed to be able to show focus on keyscroll
24 'data-id': msg.key,
25 'data-root': msg.value.content.root || msg.key
26 },
27 }
28 return h('FeedCard', opts, [
29 api.message.html.render(msg),
30 'Recent replies:',
31 computed(msgObs, msg => {
32 return h('ul', msg.replies.map(reply => h('li', [
33 reply.value.timestamp,
34 ' ',
35 reply.key
36 ])))
37 })
38 ])
39 }
40}
41
42

Built with git-ssb-web