git ssb

16+

Dominic / patchbay



Commit b5cf9912e3e6845bf8f4aeeebea6559069eeb23d

show all the profile names

mix irving committed on 1/25/2017, 8:07:55 AM
Parent: c14e98624b1ae5d90235af8556d3f3d82510130d

Files changed

modules_basic/avatar/edit.jschanged
modules_basic/avatar/edit.mcsschanged
modules_basic/avatar/edit.jsView
@@ -6,9 +6,9 @@
66 const hyperlightbox = require('hyperlightbox')
77 const h = require('../../h')
88 const {
99 Value, Array: MutantArray, Dict: MutantObject,
10- map, computed, when
10 + map, computed, when, dictToCollection
1111 } = require('@mmckegg/mutant')
1212 const pull = require('pull-stream')
1313 const getAvatar = require('ssb-avatar')
1414 const ref = require('ssb-ref')
@@ -64,15 +64,25 @@
6464 api.sbot_links({dest: id, rel: 'about', values: true}),
6565 pull.map(e => e.value.content.image),
6666 pull.filter(e => e && 'string' == typeof e.link),
6767 pull.unique('link'),
68- pull.drain(image => images.push(image) )
68 + pull.drain(image => images.push(image) )
6969 )
70 + var namesRecord = MutantObject()
71 + pull(
72 + api.sbot_links({dest: id, rel: 'about', values: true}),
73 + pull.map(e => e.value.content.name),
74 + pull.filter(Boolean),
75 + pull.drain(name => {
76 + var n = namesRecord.get('name') || 0
77 + namesRecord.put(name, n+1)
78 + })
79 + )
80 + var names = dictToCollection(namesRecord)
7081
7182 var lb = hyperlightbox()
7283 var name = Value(api.avatar_name(id))
7384 var proposedName = Value()
74- var names = [] //TODO load in name aliases
7585 var name_input = h('input', {placeholder: ' + another name', 'ev-keyup': (e) => proposedName.set(e.target.value) })
7686 var description = '' //TODO load this in, make this editable
7787
7888 var isPossibleUpdate = computed([proposedName, proposedAvatar], (name, image) => {
@@ -99,10 +109,15 @@
99109 ])
100110 ]),
101111 h('section.names', [
102112 h('header', 'Names'),
103- names,
104- name_input
113 + h('section', [
114 + map(names, name => h('div', [
115 + h('div.name', name.key),
116 + h('div.count', name.value)
117 + ])),
118 + name_input
119 + ])
105120 ]),
106121 when(isPossibleUpdate, h('button.confirm', { 'ev-click': handleUpdateClick }, 'Confirm changes'))
107122 ])
108123 ])
modules_basic/avatar/edit.mcssView
@@ -40,9 +40,8 @@
4040
4141 section {
4242 display: flex
4343 flex-wrap: wrap
44- justify-content: space-between
4544 align-content: flex-start
4645
4746 margin-bottom: 1rem
4847
@@ -90,8 +89,9 @@
9089
9190 margin: 0
9291 padding: 10% 20%
9392 top: 12%
93 + left: 18%
9494
9595 content: '+'
9696 font-size: 1.4rem
9797
@@ -108,12 +108,40 @@
108108 }
109109 }
110110
111111 section.names {
112- input {
113- border: 1px gainsboro solid
114- font-size: 1rem
112 + header {
115113 }
114 +
115 + section {
116 + display: flex
117 + flex-wrap: wrap
118 +
119 + div {
120 + display: flex
121 +
122 + border: 1px gainsboro solid
123 + margin: 0 .4rem .5rem 0
124 +
125 + div { padding: .3rem }
126 +
127 + div.name {
128 + border-right: 1px gainsboro solid
129 + }
130 +
131 + div.count {
132 + font-size: .9rem
133 + background-color: #eeeeee
134 + }
135 + }
136 +
137 + input {
138 + border: 1px gainsboro solid
139 + font-size: 1rem
140 + height: 1.7rem
141 + }
142 + }
143 +
116144 }
117145
118146 button.confirm {
119147 margin-left: 0

Built with git-ssb-web