git ssb

16+

Dominic / patchbay



Commit 6e80a5dbc23e3ffb51c1f23aa7d8d8dbd9210393

profile refactor to use new about.obs.images

mix irving committed on 7/16/2017, 6:34:20 AM
Parent: 75e7d09a4f53e09195dca52ad820da44d54eaa93

Files changed

about/html/edit.jschanged
about/html/edit.jsView
@@ -16,8 +16,9 @@
1616 name: 'first',
1717 imageUrl: 'first',
1818 description: 'first'
1919 },
20 + 'about.obs.groupedValues': 'first',
2021 'blob.sync.url': 'first',
2122 'keys.sync.id': 'first',
2223 'message.html.confirm': 'first',
2324 'message.html.markdown': 'first',
@@ -45,17 +46,9 @@
4546 current: api.about.obs.name(id),
4647 new: Value()
4748 })
4849
49- // TODO use patchcores observable images + names
50- var images = MutantArray()
51- pull(
52- links({dest: id, rel: 'about', values: true}),
53- pull.map(e => e.value.content.image),
54- pull.filter(e => e && typeof e.link === 'string'),
55- pull.unique('link'),
56- pull.drain(image => images.push(image))
57- )
50 + const images = computed(api.about.obs.groupedValues(id, 'image'), Object.keys)
5851
5952 var namesRecord = MutantObject()
6053 // TODO constrain query to one name per peer?
6154 pull(
@@ -76,9 +69,9 @@
7669 })
7770
7871 var avatarSrc = computed([avatar], avatar => {
7972 if (avatar.new.link) return api.blob.sync.url(avatar.new.link)
80- else return avatar.current
73 + return avatar.current
8174 })
8275
8376 var displayedName = computed([name], name => {
8477 if (name.new) return name.new
@@ -101,10 +94,10 @@
10194 h('header', 'Aliases'),
10295 h('section.avatars', [
10396 h('header', 'Avatars'),
10497 map(images, image => h('img', {
105- 'src': api.blob.sync.url(image.link),
106- 'ev-click': () => avatar.new.set(image)
98 + 'src': api.blob.sync.url(image),
99 + 'ev-click': () => avatar.new.set({ link: image })
107100 })),
108101 h('div.file-upload', [
109102 hyperfile.asDataURL(dataUrlCallback)
110103 ])

Built with git-ssb-web