git ssb

0+

ev / microbay



forked from Dominic / patchbay

Tree: da1367d2d8ed6401096f0f474ba0df556e8cc6d2

Files: da1367d2d8ed6401096f0f474ba0df556e8cc6d2 / modules / avatar-profile.js

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

Built with git-ssb-web