From 0936d28e5d0ba00c181a8e0623305ed250af587d Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Sun, 21 May 2017 12:15:41 -0400 Subject: [PATCH] minor bug fixes --- ui/js/component/snack-bar.js | 1 - ui/js/component/transactionList/view.jsx | 2 +- ui/js/component/uriIndicator/view.jsx | 4 ---- ui/js/lbry.js | 29 ------------------------ ui/js/main.js | 20 ++++++++++++++-- ui/js/page/publish/index.js | 2 ++ ui/js/page/publish/view.jsx | 2 +- ui/js/rewards.js | 2 +- 8 files changed, 23 insertions(+), 39 deletions(-) diff --git a/ui/js/component/snack-bar.js b/ui/js/component/snack-bar.js index 68a562393..46dc3bd98 100644 --- a/ui/js/component/snack-bar.js +++ b/ui/js/component/snack-bar.js @@ -1,5 +1,4 @@ import React from 'react'; -import lbry from '../lbry.js'; export class SnackBar extends React.Component { constructor(props) { diff --git a/ui/js/component/transactionList/view.jsx b/ui/js/component/transactionList/view.jsx index 49cbf2908..5d92e2b68 100644 --- a/ui/js/component/transactionList/view.jsx +++ b/ui/js/component/transactionList/view.jsx @@ -25,7 +25,7 @@ class TransactionList extends React.Component{ { item.date ? item.date.toLocaleDateString() : (Transaction pending) } { item.date ? item.date.toLocaleTimeString() : (Transaction pending) } - {item.id.substr(0, 7)} + {item.id.substr(0, 7)} ); diff --git a/ui/js/component/uriIndicator/view.jsx b/ui/js/component/uriIndicator/view.jsx index 613ffec43..f939569f1 100644 --- a/ui/js/component/uriIndicator/view.jsx +++ b/ui/js/component/uriIndicator/view.jsx @@ -44,10 +44,6 @@ class UriIndicator extends React.Component{ signature_is_valid: signatureIsValid, } = claim - console.log('uri indicator render') - console.log(uri) - console.log(claim) - if (!hasSignature || !channelName) { return Anonymous; } diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 6e9f8e691..d1fd125e4 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -10,12 +10,7 @@ const menu = remote.require('./menu/main-menu'); let lbry = { isConnected: false, daemonConnectionString: 'http://localhost:5279/lbryapi', - webUiUri: 'http://localhost:5279', - peerListTimeout: 6000, pendingPublishTimeout: 20 * 60 * 1000, - colors: { - primary: '#155B4A' - }, defaultClientSettings: { showNsfw: false, showUnavailable: true, @@ -91,7 +86,6 @@ function pendingPublishToDummyClaim({channel_name, name, outpoint, claim_id, txi function pendingPublishToDummyFileInfo({name, outpoint, claim_id}) { return {name, outpoint, claim_id, metadata: null}; } -window.pptdfi = pendingPublishToDummyFileInfo; lbry.call = function (method, params, callback, errorCallback, connectFailedCallback) { return jsonrpc.call(lbry.daemonConnectionString, method, params, callback, errorCallback, connectFailedCallback); @@ -130,21 +124,6 @@ lbry.connect = function() { return lbry._connectPromise; } - -//kill this but still better than document.title =, which this replaced -lbry.setTitle = function(title) { - document.title = title + " - LBRY"; -} - -//kill this with proper routing -lbry.back = function() { - if (window.history.length > 1) { - window.history.back(); - } else { - window.location.href = "?discover"; - } -} - lbry.isDaemonAcceptingConnections = function (callback) { // Returns true/false whether the daemon is at a point it will start returning status lbry.call('status', {}, () => callback(true), null, () => callback(false)) @@ -466,14 +445,6 @@ lbry.cancelResolve = function(params={}) { } } -// lbry.get = function(params={}) { -// return function(params={}) { -// return new Promise((resolve, reject) => { -// jsonrpc.call(lbry.daemonConnectionString, "get", params, resolve, reject, reject); -// }); -// }; -// } - lbry = new Proxy(lbry, { get: function(target, name) { if (name in target) { diff --git a/ui/js/main.js b/ui/js/main.js index 96cb02f13..a0fb64fab 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -22,7 +22,7 @@ import { } from 'actions/file_info' import parseQueryParams from 'util/query_params' -const {remote, ipcRenderer} = require('electron'); +const {remote, ipcRenderer, shell} = require('electron'); const contextMenu = remote.require('./menu/context-menu'); const app = require('./app') @@ -47,11 +47,26 @@ window.addEventListener('popstate', (event, param) => { }) ipcRenderer.on('open-uri-requested', (event, uri) => { + console.log('open uri') + console.log(event) + console.log(uri) if (uri) { console.log('FIX ME do magic dispatch: ' + uri); } }); +document.addEventListener('click', (event) => { + var target = event.target; + while (target && target !== document) { + if (target.matches('a[href^="http"]')) { + event.preventDefault(); + shell.openExternal(target.href); + return; + } + target = target.parentNode; + } +}); + const initialState = app.store.getState(); var init = function() { @@ -59,7 +74,8 @@ var init = function() { function onDaemonReady() { app.store.dispatch(doDaemonReady()) window.sessionStorage.setItem('loaded', 'y'); //once we've made it here once per session, we don't need to show splash again - app.store.dispatch(doHistoryPush({}, "Discover", "/discover")) + app.store.dispatch(doHistoryPush({}, "" + + "Discover", "/discover")) app.store.dispatch(doFetchDaemonSettings()) app.store.dispatch(doFileList()) ReactDOM.render(
{ lbryio.enabled ? : '' }
, canvas) diff --git a/ui/js/page/publish/index.js b/ui/js/page/publish/index.js index d083fd118..783a0e0a8 100644 --- a/ui/js/page/publish/index.js +++ b/ui/js/page/publish/index.js @@ -4,6 +4,7 @@ import { } from 'react-redux' import { doNavigate, + doHistoryBack, } from 'actions/app' import { selectMyClaims @@ -15,6 +16,7 @@ const select = (state) => ({ }) const perform = (dispatch) => ({ + back: () => dispatch(doHistoryBack()), navigate: (path) => dispatch(doNavigate(path)), }) diff --git a/ui/js/page/publish/view.jsx b/ui/js/page/publish/view.jsx index 354324862..e3c13b820 100644 --- a/ui/js/page/publish/view.jsx +++ b/ui/js/page/publish/view.jsx @@ -568,7 +568,7 @@ class PublishPage extends React.Component {
{ this.handleSubmit(event) }} disabled={this.state.submitting} /> - +
diff --git a/ui/js/rewards.js b/ui/js/rewards.js index 840c22c81..9a2235130 100644 --- a/ui/js/rewards.js +++ b/ui/js/rewards.js @@ -44,7 +44,7 @@ rewards.claimReward = function (type) { detail: { message: message, linkText: "Show All", - linkTarget: "?rewards", + linkTarget: "/rewards", isError: false, }, }));