git ssb

0+

Dominic / yap-gatherings



Tree: 94f0e4dd667e6f3e2c417ed1c141aaa49f8cdf08

Files: 94f0e4dd667e6f3e2c417ed1c141aaa49f8cdf08 / render.js

1163 bytesRaw
1var u = require('yap-util')
2
3module.exports = function (apply, gathering) {
4 var attending = {}
5 gathering.value.attendee.forEach(function (attendee) {
6 if(attendee.link) attending[attendee.link] = true
7 if(attendee.remove) delete attending[attendee.link]
8 })
9 var gth = gathering.value
10 var epoch = gth.startDateTime && gth.startDateTime.epoch
11 var tz = epoch && epoch.tz
12 return ['div.Gathering',
13 apply('avatar', {id: gathering.creator, name: true, image: true}),' ',
14 ['h1',
15 ['a',
16 {href: apply.toUrl('gatherings/event', {id:gathering.root, replies: true})},
17 gth.title
18 ]
19 ],
20 ['h2', {title: tz}, new Date(epoch).toString()],
21 u.markdown({text:gth.description, mentions: gth.mentions}),
22 gathering.value.image
23 ? ['img', {href: 'http://localhost:8989/blobs/get/'+encodeURIComponent(gathering.value.image.link)}]
24 : '',
25 ['div.Attending',
26 'attending:',
27 Object.keys(attending).map(function (id) {
28 return apply('avatar', id)
29 })
30 ],
31 ['div.Replies',
32 gathering.replies.map(function (reply) {
33 return apply('messages/post', reply)
34 })
35 ]
36 ]
37}
38
39

Built with git-ssb-web