git ssb

16+

Dominic / patchbay



Tree: 722cbe26ce4fde5590323faa3abb3fc2b1db248a

Files: 722cbe26ce4fde5590323faa3abb3fc2b1db248a / modules / avatar-profile.js

1220 bytesRaw
1var h = require('hyperscript')
2var plugs = require('../plugs')
3var pull = require('pull-stream')
4
5var avatar_image = plugs.first(exports.avatar_image = [])
6var avatar_name = plugs.first(exports.avatar_name = [])
7var avatar_action = plugs.map(exports.avatar_action = [])
8var avatar_edit = plugs.first(exports.avatar_edit = [])
9
10var follows = plugs.first(exports.follows = [])
11var followers = plugs.first(exports.followers = [])
12
13function streamToList(stream, el) {
14 pull(
15 stream,
16 pull.drain(function (item) {
17 if(item) el.appendChild(item)
18 })
19 )
20 return el
21}
22
23function image_link (id) {
24 return h('a', {href:'#'+id}, avatar_image(id, 'thumbnail'))
25}
26
27exports.avatar_profile = function (id) {
28 return h('div.column.profile',
29 avatar_edit(id),
30 avatar_action(id),
31
32 h('div.profile__relationships.column',
33
34 h('strong', 'follows'),
35 streamToList(pull(
36 follows(id),
37 pull.unique(),
38 pull.map(image_link)
39 ), h('div.profile__follows.wrap')),
40
41 h('strong', 'followers'),
42 streamToList(pull(
43 followers(id),
44 pull.unique(),
45 pull.map(image_link)
46 ), h('div.profile__followers.wrap'))
47 )
48 )
49}
50
51

Built with git-ssb-web