git ssb

16+

Dominic / patchbay



Commit 108d820b09fd85d159865f851eac43f82f21766f

refactor about to display name/ img/ description

mix irving authored on 12/20/2016, 5:28:20 AM
Michael Williams committed on 12/23/2016, 7:27:15 AM
Parent: a5445e6bcd23a22f2da4671b84e81eedc42d81a6

Files changed

modules_basic/about.jschanged
package.jsonchanged
h.jsadded
modules_basic/about.jsView
@@ -1,15 +1,6 @@
1 +var h = require('../h')
12
2-var h = require('hyperscript')
3-
4-function idLink (id) {
5- return h('a', {href:'#'+id}, id)
6-}
7-
8-function asLink (ln) {
9- return 'string' === typeof ln ? ln : ln.link
10-}
11-
123 //var blob_url = require('../plugs').first(exports.blob_url = [])
134
145 exports.needs = {
156 blob_url: 'first'
@@ -17,32 +8,46 @@
178
189 exports.gives = 'message_content'
1910
2011 exports.create = function (api) {
21-
2212 return function (msg) {
2313 if(msg.value.content.type !== 'about') return
2414
25- if(!msg.value.content.image && !msg.value.content.name)
26- return
27-
2815 var about = msg.value.content
29- var id = msg.value.content.about
30- return h('p',
31- about.about === msg.value.author
32- ? h('span', 'self-identifies ')
33- : h('span', 'identifies ', idLink(id)),
34- ' as ',
35- h('a', {href:"#"+about.about},
36- about.name || null,
37- about.image
38- ? h('img.avatar--fullsize', {src: api.blob_url(about.image)})
39- : null
40- )
41- )
16 + var { about: aboutId, name, image, description } = about
4217
18 + // if(!image && !name) return
19 +
20 + return h('.About', {}, [
21 + verb({ aboutId, authorId: msg.value.author }),
22 + profile({ aboutId, name, image, description })
23 + ])
4324 }
25 +}
4426
27 +
28 +function verb ({ aboutId, authorId }) {
29 + return authorId === aboutId
30 + ? h('span', 'self-identifies as')
31 + : h('span', ['identifies ', idLink(aboutId), ' as '])
4532 }
4633
34 +function profile ({ aboutId, name, image, description }) {
35 + return h('div', [
36 + name
37 + ? h('a', {href:'#'+aboutId}, name)
38 + : null,
39 + image
40 + ? h('a', {href:'#'+aboutId}, h('img.avatar--fullsize', {src: api.blob_url(image)}))
41 + : null,
42 + description || null
43 + ])
44 +}
4745
46 +function idLink (id) {
47 + return h('a', {href:'#'+id}, id)
48 +}
4849
50 +function asLink (ln) {
51 + return typeof ln === 'string' ? ln : ln.link
52 +}
53 +
package.jsonView
@@ -7,8 +7,9 @@
77 "type": "git",
88 "url": "git://github.com/dominictarr/patchbay.git"
99 },
1010 "dependencies": {
11 + "@mmckegg/mutant": "^3.10.1",
1112 "cont": "^1.0.3",
1213 "dataurl-": "^0.1.0",
1314 "depject": "^3.0.0",
1415 "hjson": "^2.0.3",
@@ -22,8 +23,9 @@
2223 "hypertabs": "^3.0.0",
2324 "is-visible": "^2.0.4",
2425 "kvgraph": "^0.1.0",
2526 "map-filter-reduce": "^3.0.1",
27 + "micro-css": "^0.6.2",
2628 "mime-types": "^2.1.11",
2729 "moment": "^2.13.0",
2830 "open-external": "^0.1.1",
2931 "peaks.js": "^0.4.7",
h.jsView
@@ -1,0 +1,1 @@
1 +module.exports = require('micro-css/h')(require('@mmckegg/mutant/html-element'))

Built with git-ssb-web