minor bug fixes

This commit is contained in:
Jeremy Kauffman 2017-05-21 12:15:41 -04:00
parent 582b479a3e
commit 0936d28e5d
8 changed files with 23 additions and 39 deletions

View file

@ -1,5 +1,4 @@
import React from 'react';
import lbry from '../lbry.js';
export class SnackBar extends React.Component {
constructor(props) {

View file

@ -25,7 +25,7 @@ class TransactionList extends React.Component{
<td>{ item.date ? item.date.toLocaleDateString() : <span className="empty">(Transaction pending)</span> }</td>
<td>{ item.date ? item.date.toLocaleTimeString() : <span className="empty">(Transaction pending)</span> }</td>
<td>
<a className="button-text" href={"https://explorer.lbry.io/tx/"+item.id} target="_blank">{item.id.substr(0, 7)}</a>
<a className="button-text" href={"https://explorer.lbry.io/#!/transaction?id="+item.id}>{item.id.substr(0, 7)}</a>
</td>
</tr>
);

View file

@ -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 <span className="empty">Anonymous</span>;
}

View file

@ -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) {

View file

@ -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(<Provider store={store}><div>{ lbryio.enabled ? <AuthOverlay/> : '' }<App /><SnackBar /></div></Provider>, canvas)

View file

@ -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)),
})

View file

@ -568,7 +568,7 @@ class PublishPage extends React.Component {
<div className="card-series-submit">
<Link button="primary" label={!this.state.submitting ? 'Publish' : 'Publishing...'} onClick={(event) => { this.handleSubmit(event) }} disabled={this.state.submitting} />
<Link button="cancel" onClick={lbry.back} label="Cancel" />
<Link button="cancel" onClick={this.props.back} label="Cancel" />
<input type="submit" className="hidden" />
</div>
</form>

View file

@ -44,7 +44,7 @@ rewards.claimReward = function (type) {
detail: {
message: message,
linkText: "Show All",
linkTarget: "?rewards",
linkTarget: "/rewards",
isError: false,
},
}));