git ssb

16+

Dominic / patchbay



Commit ca490d878aac9b2af156d85f1eece0bb9c20f1d6

minor refactor

- move `profile` function into scope with `api`, rather than pass `api` as an argument.
- change `h('div', { className: 'About' })` to `h('About')` which works with `micro-css/h` wrapping.
- add code for where we would default `aboutId` to `authorId`, awaiting feedback from %ueXnRVeqvd2LZmq1HnYETwRxY3jfOdxHWrJhVApLBK4=.sha256
Michael Williams committed on 12/20/2016, 9:50:41 AM
Parent: 40f0cb94a46d262deff9570160cc8b204c9b9f78

Files changed

modules_basic/about.jschanged
modules_basic/about.jsView
@@ -1,8 +1,6 @@
11 var h = require('../h')
22
3-//var blob_url = require('../plugs').first(exports.blob_url = [])
4-
53 exports.needs = {
64 blob_url: 'first'
75 }
86
@@ -30,18 +28,31 @@
3028
3129 function message_content (msg) {
3230 if(msg.value.content.type !== 'about') return
3331
34- var about = msg.value.content
32 + var { value } = msg
33 + var { content: about, author: authorId } = value
3534 var { about: aboutId, name, image, description } = about
35 + // TODO does about default to the message author?
36 + // var { about: aboutId = authorId, name, image, description } = about
3637
37- // if(!image && !name) return
38-
39- return h('div', {className: 'About'}, [
38 + return h('About', [
4039 verb({ aboutId, authorId: msg.value.author }),
41- profile({ aboutId, name, image, description, api })
40 + profile({ aboutId, name, image, description })
4241 ])
4342 }
43 +
44 + function profile ({ aboutId, name, image, description }) {
45 + return h('div', [
46 + name
47 + ? h('a', {href:'#'+aboutId}, name)
48 + : null,
49 + image
50 + ? h('a', {href:'#'+aboutId}, h('img.avatar--fullsize', {src: api.blob_url(image)}))
51 + : null,
52 + description || null
53 + ])
54 + }
4455 }
4556
4657
4758 function verb ({ aboutId, authorId }) {
@@ -51,20 +62,8 @@
5162
5263 return h('header', content)
5364 }
5465
55-function profile ({ aboutId, name, image, description, api }) {
56- return h('div', [
57- name
58- ? h('a', {href:'#'+aboutId}, name)
59- : null,
60- image
61- ? h('a', {href:'#'+aboutId}, h('img.avatar--fullsize', {src: api.blob_url(image)}))
62- : null,
63- description || null
64- ])
65-}
66-
6766 function idLink (id) {
6867 if (!id) return null
6968
7069 return h('a', {href:'#'+id}, id.slice(0,9) + '...')

Built with git-ssb-web