Commit a4b0a6f9c734c9e1b63226cf6c9babf790be3048
Merge branch 'master' of github.com:ssbc/patchbay into posts_rollup
mixmix committed on 7/9/2018, 2:07:46 AMParent: 920f29c78bb0076a529cda4bbc4f01b19cabd924
Parent: 625f7819b686f7a94242c8ea945e8b013dbbed7b
Files changed
about/html/edit.js | changed |
background-process.js | changed |
index.js | changed |
package.json | changed |
about/html/edit.js | ||
---|---|---|
@@ -2,15 +2,14 @@ | ||
2 | 2 … | const dataurl = require('dataurl-') |
3 | 3 … | const hyperfile = require('hyperfile') |
4 | 4 … | const hypercrop = require('hypercrop') |
5 | 5 … | const hyperlightbox = require('hyperlightbox') |
6 | -const Mutual = require('ssb-mutual') | |
7 | - | |
8 | 6 … | const { |
9 | - h, Value, Dict: MutantObject, Struct, | |
10 | - map, computed, when, dictToCollection | |
7 … | + h, Value, Dict, Struct, | |
8 … | + map, computed, when, dictToCollection, onceTrue | |
11 | 9 … | } = require('mutant') |
12 | 10 … | const pull = require('pull-stream') |
11 … | +const Mutual = require('ssb-mutual') | |
13 | 12 … | |
14 | 13 … | exports.gives = nest('about.html.edit') |
15 | 14 … | |
16 | 15 … | exports.needs = nest({ |
@@ -38,13 +37,12 @@ | ||
38 | 37 … | |
39 | 38 … | // TODO refactor this to use obs better |
40 | 39 … | function edit (id) { |
41 | 40 … | // TODO - get this to wait till the connection is present ! |
42 | - var mutual = Mutual.init(api.sbot.obs.connection()) | |
43 | 41 … | |
44 | 42 … | var avatar = Struct({ |
45 | 43 … | current: api.about.obs.imageUrl(id), |
46 | - new: MutantObject() | |
44 … | + new: Dict() | |
47 | 45 … | }) |
48 | 46 … | |
49 | 47 … | const links = api.sbot.pull.links |
50 | 48 … | |
@@ -54,9 +52,9 @@ | ||
54 | 52 … | }) |
55 | 53 … | |
56 | 54 … | const images = computed(api.about.obs.groupedValues(id, 'image'), Object.keys) |
57 | 55 … | |
58 | - var namesRecord = MutantObject() | |
56 … | + var namesRecord = Dict() | |
59 | 57 … | // TODO constrain query to one name per peer? |
60 | 58 … | pull( |
61 | 59 … | links({dest: id, rel: 'about', values: true}), |
62 | 60 … | pull.map(e => e.value.content.name), |
@@ -83,18 +81,17 @@ | ||
83 | 81 … | if (name.new) return name.new |
84 | 82 … | else return name.current |
85 | 83 … | }) |
86 | 84 … | |
87 | - var balances_div = h('div.balances') | |
85 … | + var balances = Dict() | |
86 … | + onceTrue(api.sbot.obs.connection, sbot => { | |
87 … | + if (!sbot.links) throw new Error('where ma sbot.links at?!') | |
88 … | + var mutual = Mutual.init(sbot) | |
89 … | + mutual.getAccountBalances(id, (err, data) => { | |
90 … | + if (err) console.log(err) | |
91 … | + if (data == null) return | |
88 | 92 … | |
89 | - mutual.getAccountBalances(id, (error, balances) => { | |
90 | - if (balances == null) return '' | |
91 | - | |
92 | - var balance_els = [] | |
93 | - Object.keys(balances).forEach(function (key) { | |
94 | - balances_div.appendChild( | |
95 | - h('div', `💰 ${balances[key]} ${key}`) | |
96 | - ) | |
93 … | + balances.set(data) | |
97 | 94 … | }) |
98 | 95 … | }) |
99 | 96 … | |
100 | 97 … | return h('AboutEditor', [ |
@@ -108,9 +105,11 @@ | ||
108 | 105 … | h('section.description', computed(api.about.obs.description(id), (descr) => { |
109 | 106 … | if (descr == null) return '' // TODO: should be in patchcore, I think... |
110 | 107 … | return api.message.html.markdown(descr) |
111 | 108 … | })), |
112 | - h('section.credit', balances_div), | |
109 … | + h('section.credit', map(dictToCollection(balances), balance => { | |
110 … | + return h('div', ['💰 ', balance.value, ' ', balance.key]) | |
111 … | + })), | |
113 | 112 … | h('section.aliases', [ |
114 | 113 … | h('header', 'Aliases'), |
115 | 114 … | h('section.avatars', [ |
116 | 115 … | h('header', 'Avatars'), |
background-process.js | ||
---|---|---|
@@ -12,17 +12,18 @@ | ||
12 | 12 … | .use(require('scuttlebot/plugins/local')) |
13 | 13 … | .use(require('scuttlebot/plugins/logging')) |
14 | 14 … | .use(require('ssb-about')) |
15 | 15 … | .use(require('ssb-backlinks')) |
16 … | + .use(require('ssb-blobs')) | |
17 … | + .use(require('ssb-chess-db')) | |
18 … | + .use(require('ssb-ebt')) | |
16 | 19 … | .use(require('ssb-friends')) |
20 … | + .use(require('ssb-meme')) | |
17 | 21 … | .use(require('ssb-private')) |
18 | - .use(require('ssb-blobs')) | |
22 … | + .use(require('ssb-query')) | |
19 | 23 … | .use(require('ssb-search')) |
20 | - .use(require('ssb-meme')) | |
21 | - .use(require('ssb-ebt')) | |
22 | - .use(require('ssb-chess-db')) | |
23 | - .use(require('ssb-query')) | |
24 | 24 … | .use(require('ssb-ws')) |
25 … | + // .use(require('ssb-mutual')) // this is has recursion problems atm | |
25 | 26 … | |
26 | 27 … | // pull config options out of depject |
27 | 28 … | var config = require('./config').create().config.sync.load() |
28 | 29 … |
index.js | ||
---|---|---|
@@ -107,8 +107,10 @@ | ||
107 | 107 … | width: windowState.width, |
108 | 108 … | height: windowState.height, |
109 | 109 … | autoHideMenuBar: true, |
110 | 110 … | title: 'Patchbay', |
111 … | + frame: !process.env.FRAME, | |
112 … | + // titleBarStyle: 'hidden', | |
111 | 113 … | show: true, |
112 | 114 … | backgroundColor: '#FFF', |
113 | 115 … | icon: './assets/icon.png' |
114 | 116 … | }) |
package.json | ||
---|---|---|
@@ -6,8 +6,9 @@ | ||
6 | 6 … | "scripts": { |
7 | 7 … | "lint": "standard", |
8 | 8 … | "rebuild": "cross-script npm rebuild --runtime=electron \"--target=$(electron -v)\" \"--abi=$(electron --abi)\" --disturl=https://atom.io/download/atom-shell", |
9 | 9 … | "start": "electron index.js -- --title patchbay", |
10 … | + "start-frameless": "FRAME=false npm start", | |
10 | 11 … | "dev": "echo 'run your own sbot!' && electro main.js -- --title patchbay --icon ./assets/icon.png" |
11 | 12 … | }, |
12 | 13 … | "browserify": { |
13 | 14 … | "transform": [ |
@@ -22,8 +23,9 @@ | ||
22 | 23 … | "url": "git+https://github.com/ssbc/patchbay.git" |
23 | 24 … | }, |
24 | 25 … | "author": "mixmix", |
25 | 26 … | "maintainers": [ |
27 … | + "arj03", | |
26 | 28 … | "ahdinosaur", |
27 | 29 … | "cel", |
28 | 30 … | "dominictarr", |
29 | 31 … | "mmckegg" |
Built with git-ssb-web