git ssb

16+

Dominic / patchbay



Commit 323f8174abcb0c159f8393dcf5cdf41ff6141231

standardise

mix irving committed on 2/7/2018, 9:53:44 AM
Parent: ab8ce1ee60d988f3d1fcc1d1cf158bb841ce93e0

Files changed

about/html/edit.jschanged
app/async/catch-link-click.jschanged
app/html/app.jschanged
app/html/filter.jschanged
app/html/menu.jschanged
app/html/search-bar.jschanged
app/html/tabs.jschanged
app/page/channel.jschanged
app/sync/catch-keyboard-shortcut.jschanged
app/sync/goTo.jschanged
app/sync/initialise/settings.jschanged
background-process.jschanged
config.jschanged
contact/html/relationships.jschanged
index.jschanged
main.jschanged
message/html/compose.jschanged
message/html/like.jschanged
message/html/render/contact.jschanged
about/html/edit.jsView
@@ -83,20 +83,19 @@
8383 if (name.new) return name.new
8484 else return name.current
8585 })
8686
87-
8887 var balances_div = h('div.balances')
8988
9089 mutual.getAccountBalances(id, (error, balances) => {
9190 if (balances == null) return ''
9291
93- var balance_els = [];
94- Object.keys(balances).forEach(function(key) {
92 + var balance_els = []
93 + Object.keys(balances).forEach(function (key) {
9594 balances_div.appendChild(
9695 h('div', `💰 ${balances[key]} ${key}`)
9796 )
98- });
97 + })
9998 })
10099
101100 return h('AboutEditor', [
102101 lightbox,
@@ -227,5 +226,4 @@
227226 })
228227 }
229228 }
230229 }
231-
app/async/catch-link-click.jsView
@@ -5,9 +5,9 @@
@@ -51,5 +51,4 @@
app/html/app.jsView
@@ -24,14 +24,14 @@
2424 exports.create = function (api) {
2525 return nest('app.html.app', app)
2626
2727 function app () {
28- console.log("STARTING app")
28 + console.log('STARTING app')
2929
3030 api.app.sync.initialise()
3131
3232 window = api.app.sync.window(window)
33-
33 +
3434 const css = values(api.styles.css()).join('\n')
3535 insertCss(css)
3636
3737 const initialTabs = ['/public', '/inbox', '/notifications']
@@ -43,9 +43,9 @@
4343 // Catch user actions
4444 api.app.sync.catchKeyboardShortcut(window, { tabs })
4545 api.app.async.catchLinkClick(App)
4646
47- api.history.obs.location()(loc => api.app.sync.goTo(loc || {}) )
47 + api.history.obs.location()(loc => api.app.sync.goTo(loc || {}))
4848
4949 // Catch errors
5050 var { container: errorPage, addError } = api.router.sync.router('/errors')
5151 window.addEventListener('error', ev => {
@@ -53,9 +53,9 @@
5353
5454 addError(ev.error || ev)
5555 })
5656
57- ////// TODO - extract this to keep patch-lite isolated from electron
57 + /// /// TODO - extract this to keep patch-lite isolated from electron
5858 const { getCurrentWebContents, getCurrentWindow } = electron.remote
5959 window.addEventListener('resize', () => {
6060 var wc = getCurrentWebContents()
6161 wc && wc.getZoomFactor((zf) => {
@@ -68,15 +68,13 @@
6868 })
6969 })
7070
7171 var zoomFactor = api.settings.sync.get('electron.zoomFactor')
72- if (zoomFactor)
73- getCurrentWebContents().setZoomFactor(zoomFactor)
72 + if (zoomFactor) { getCurrentWebContents().setZoomFactor(zoomFactor) }
7473
7574 var bounds = api.settings.sync.get('electron.windowBounds')
76- if (bounds)
77- getCurrentWindow().setBounds(bounds)
78- //////
75 + if (bounds) { getCurrentWindow().setBounds(bounds) }
76 + /// ///
7977
8078 return App
8179 }
8280 }
app/html/filter.jsView
@@ -33,23 +33,23 @@
3333
3434 const filterSettings = api.settings.obs.get('filter')
3535
3636 const channelInput = h('input',
37- { value: filterSettings().exclude.channels,
38- 'ev-keyup': (ev) => {
39- var text = ev.target.value
40- if (text.length == 0 || ev.which == 13) {
41- api.settings.sync.set({
42- filter: {
43- exclude: {
44- channels: text
45- }
46- }
47- })
48- draw()
49- }
50- }
51- }
37 + { value: filterSettings().exclude.channels,
38 + 'ev-keyup': (ev) => {
39 + var text = ev.target.value
40 + if (text.length == 0 || ev.which == 13) {
41 + api.settings.sync.set({
42 + filter: {
43 + exclude: {
44 + channels: text
45 + }
46 + }
47 + })
48 + draw()
49 + }
50 + }
51 + }
5252 )
5353
5454 const isFiltered = computed(filterSettings, (filterSettings) => {
5555 const _settings = Object.assign({}, filterSettings)
@@ -97,10 +97,10 @@
9797 const state = computed(filterSettings, settings => get(settings, [filterGroup, type]))
9898 const handleClick = () => {
9999 const currentState = state()
100100
101- //TODO use some lodash tool ?
102- api.settings.sync.set({
101 + // TODO use some lodash tool ?
102 + api.settings.sync.set({
103103 filter: {
104104 [filterGroup]: {
105105 [type]: !currentState
106106 }
app/html/menu.jsView
@@ -3,11 +3,11 @@
33
44 exports.gives = nest('app.html.menu')
55
66 exports.needs = nest({
7- "app.html.menuItem": "map",
8- "app.sync.goTo": "first",
9- "sbot.obs.connection": "first"
7 + 'app.html.menuItem': 'map',
8 + 'app.sync.goTo': 'first',
9 + 'sbot.obs.connection': 'first'
1010 })
1111
1212 exports.create = function (api) {
1313 var _menu
app/html/search-bar.jsView
@@ -6,9 +6,9 @@
66
77 exports.needs = nest({
88 'app.sync.goTo': 'first',
99 'about.async.suggest': 'first',
10- 'channel.async.suggest': 'first',
10 + 'channel.async.suggest': 'first'
1111 // 'app.async.suggest': 'reduce' // TODO add ability to add to this
1212 })
1313
1414 exports.create = function (api) {
@@ -19,13 +19,10 @@
1919
2020 const getProfileSuggestions = api.about.async.suggest()
2121 const getChannelSuggestions = api.channel.async.suggest()
2222
23- function goToLocation(location, ev) {
24- if (location[0] == '?')
25- location = { page: 'search', query: location.substring(1) }
26- else if (!['@', '#', '%', '&', '/'].includes(location[0]))
27- location = { page: 'search', query: location }
23 + function goToLocation (location, ev) {
24 + if (location[0] == '?') { location = { page: 'search', query: location.substring(1) } } else if (!['@', '#', '%', '&', '/'].includes(location[0])) { location = { page: 'search', query: location } }
2825
2926 api.app.sync.goTo(location)
3027 if (!ev.ctrlKey) input.blur()
3128 }
@@ -43,9 +40,9 @@
4340 input.blur()
4441 }
4542 }
4643 })
47-
44 +
4845 input.addEventListener('suggestselect', ev => {
4946 input.value = ev.detail.id // HACK : this over-rides the markdown value
5047 goToLocation(input.value.trim(), ev)
5148 })
@@ -80,14 +77,14 @@
8077 ]
8178
8279 return pages
8380 .filter(page => ~page.indexOf(word))
84- .sort((a, b) => a.indexOf(word) < b.indexOf(word) ? -1 : +1 )
81 + .sort((a, b) => a.indexOf(word) < b.indexOf(word) ? -1 : +1)
8582 .map(page => {
8683 return {
87- title: '/'+page,
88- id: '/'+page,
89- value: '/'+page,
84 + title: '/' + page,
85 + id: '/' + page,
86 + value: '/' + page
9087 }
9188 })
9289 }
9390
app/html/tabs.jsView
@@ -42,9 +42,9 @@
4242 return JSON.stringify(loc) != page.id
4343 })
4444 history.set(prunedHistory)
4545 }
46-
46 +
4747 const search = api.app.html.searchBar()
4848 const menu = api.app.html.menu()
4949
5050 _tabs = Tabs({
@@ -73,5 +73,4 @@
7373 return keys
7474 .map(k => location[k])
7575 .join(', ')
7676 }
77-
app/page/channel.jsView
@@ -63,12 +63,12 @@
6363 )
6464 }
6565 draw()
6666
67- var page = h('Page -channel', {title: channel}, [
67 + var page = h('Page -channel', {title: channel}, [
6868 // filterMenu, // TODO - extract non-scroller els like filterMenu here
6969 container
70- ])
70 + ])
7171
7272 // TODO better scroll hack for keyboard shortcuts
7373 page.scroll = container.scroll
7474
app/sync/catch-keyboard-shortcut.jsView
@@ -4,9 +4,9 @@
44
55 exports.needs = nest({
66 'app.html.searchBar': 'first',
77 'app.html.tabs': 'first',
8- 'app.sync.goTo': 'first',
8 + 'app.sync.goTo': 'first'
99 })
1010
1111 var gPressed = false
1212
@@ -130,5 +130,4 @@
130130
131131 // this uses a crudely exported nav api
132132 msg.querySelector('.meta .toggle-raw-msg').click()
133133 }
134-
app/sync/goTo.jsView
@@ -6,9 +6,9 @@
66 'app.html.tabs': 'first',
77 'history.obs.store': 'first',
88 'history.sync.push': 'first',
99 'router.sync.normalise': 'first',
10- 'router.sync.router': 'first',
10 + 'router.sync.router': 'first'
1111 })
1212
1313 exports.create = function (api) {
1414 return nest('app.sync.goTo', goTo)
app/sync/initialise/settings.jsView
@@ -4,15 +4,15 @@
44 exports.gives = nest('app.sync.initialise')
55
66 exports.needs = nest({
77 'settings.sync.set': 'first',
8- 'settings.sync.get': 'first',
8 + 'settings.sync.get': 'first'
99 })
1010
1111 const defaults = {
1212 filter: {
1313 exclude: {
14- channels: ""
14 + channels: ''
1515 },
1616 only: {
1717 peopleIFollow: false
1818 },
@@ -38,5 +38,4 @@
3838
3939 set(settings)
4040 }
4141 }
42-
background-process.jsView
@@ -19,9 +19,9 @@
1919 .use(require('ssb-about'))
2020 .use(require('ssb-fulltext'))
2121 // .use(require('ssb-ebt'))
2222 .use(require('ssb-ws'))
23- .use(require('ssb-chess-db'));
23 + .use(require('ssb-chess-db'))
2424
2525 // pull config options out of depject
2626 var config = require('./config').create().config.sync.load()
2727
config.jsView
@@ -22,5 +22,4 @@
2222 }
2323 return config
2424 })
2525 }
26-
contact/html/relationships.jsView
@@ -72,9 +72,9 @@
7272 h('button', { 'ev-click': () => follow(id) }, 'Follow')
7373 ),
7474 h('button', { disabled: 'disabled' }, 'Loading...')
7575 ),
76- when(ImFollowing.sync, h('div.relationship-status', relationshipStatus)),
76 + when(ImFollowing.sync, h('div.relationship-status', relationshipStatus))
7777 ]),
7878 h('section -blocking', [
7979 when(ImBlockingThem,
8080 h('button', { 'ev-click': () => unblock(id, console.log) }, 'unblock'),
@@ -84,9 +84,9 @@
8484 "Blocking tells everyone you don't want to communicate with a person.",
8585 h('ul', [
8686 h('li', 'You will no longer receive messages from this person'),
8787 h('li', "This person won't get any new information about you (including this block)"),
88- h('li', "Your followers will see you have blocked this person - their apps need to know so that they don't pass your information on."),
88 + h('li', "Your followers will see you have blocked this person - their apps need to know so that they don't pass your information on.")
8989 ])
9090 ])
9191 ])
9292 ])
index.jsView
@@ -134,5 +134,4 @@
134134
135135 window.loadURL('file://' + Path.join(__dirname, 'assets', 'base.html'))
136136 return window
137137 }
138-
main.jsView
@@ -5,9 +5,9 @@
55
66 // polyfills
77 require('setimmediate')
88
9-const patchbay = {
9 +const patchbay = {
1010 patchbay: {
1111 about: bulk(__dirname, [ 'about/**/*.js' ]),
1212 app: bulk(__dirname, [ 'app/**/*.js' ]),
1313 blob: bulk(__dirname, [ 'blob/**/*.js' ]),
@@ -22,17 +22,16 @@
2222 suggestions: require('patch-suggest'),
2323 settings: require('patch-settings'),
2424 drafts: require('patch-drafts'),
2525 inbox: require('patch-inbox'), // TODO - ideally this would be a standalone patch-* module
26- history: require('patch-history'),
26 + history: require('patch-history')
2727 }
2828 }
2929
30-
3130 // from more specialized to more general
3231 const sockets = combine(
33- //require('ssb-horcrux'),
34- //require('patch-hub'),
32 + // require('ssb-horcrux'),
33 + // require('patch-hub'),
3534
3635 require('ssb-chess'),
3736 require('patchbay-gatherings'),
3837 require('patchbay-book'),
@@ -49,5 +48,4 @@
4948 // for electro[n]
5049 if (typeof window !== 'undefined') {
5150 document.body.appendChild(app())
5251 }
53-
message/html/compose.jsView
@@ -20,13 +20,13 @@
2020 exports.create = function (api) {
2121 return nest({ 'message.html.compose': compose })
2222
2323 function compose (options, cb) {
24- const {
24 + const {
2525 meta,
26- location,
26 + location,
2727 feedIdsInThread = [],
28- prepublish,
28 + prepublish,
2929 placeholder = 'Write a message',
3030 shrink = true
3131 } = options
3232
@@ -104,9 +104,9 @@
104104 )
105105 var fileInput = api.blob.html.input(file => {
106106 const megabytes = file.size / 1024 / 1024
107107 if (megabytes >= 5) {
108- const rounded = Math.floor(megabytes*100)/100
108 + const rounded = Math.floor(megabytes * 100) / 100
109109 warningMessage.set([
110110 h('i.fa.fa-exclamation-triangle'),
111111 h('strong', file.name),
112112 ` is ${rounded}MB - the current limit is 5MB`
message/html/like.jsView
@@ -47,5 +47,4 @@
4747
4848 function doesLike (likes, userId) {
4949 return likes.includes(userId)
5050 }
51-
message/html/render/contact.jsView
@@ -30,14 +30,18 @@
3030
3131 function renderContent ({ contact, following, blocking }) {
3232 const name = api.about.html.link(contact)
3333
34- if (blocking != undefined) return [
35- blocking ? 'blocked ' : 'unblocked ',
36- name
37- ]
38- if (following != undefined) return [
39- following ? 'followed ' : 'unfollowed ',
40- name
41- ]
34 + if (blocking != undefined) {
35 + return [
36 + blocking ? 'blocked ' : 'unblocked ',
37 + name
38 + ]
39 + }
40 + if (following != undefined) {
41 + return [
42 + following ? 'followed ' : 'unfollowed ',
43 + name
44 + ]
45 + }
4246 }
4347 }

Built with git-ssb-web