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 React from 'react';
import lbry from '../lbry.js';
export class SnackBar extends React.Component { export class SnackBar extends React.Component {
constructor(props) { 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.toLocaleDateString() : <span className="empty">(Transaction pending)</span> }</td>
<td>{ item.date ? item.date.toLocaleTimeString() : <span className="empty">(Transaction pending)</span> }</td> <td>{ item.date ? item.date.toLocaleTimeString() : <span className="empty">(Transaction pending)</span> }</td>
<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> </td>
</tr> </tr>
); );

View file

@ -44,10 +44,6 @@ class UriIndicator extends React.Component{
signature_is_valid: signatureIsValid, signature_is_valid: signatureIsValid,
} = claim } = claim
console.log('uri indicator render')
console.log(uri)
console.log(claim)
if (!hasSignature || !channelName) { if (!hasSignature || !channelName) {
return <span className="empty">Anonymous</span>; return <span className="empty">Anonymous</span>;
} }

View file

@ -10,12 +10,7 @@ const menu = remote.require('./menu/main-menu');
let lbry = { let lbry = {
isConnected: false, isConnected: false,
daemonConnectionString: 'http://localhost:5279/lbryapi', daemonConnectionString: 'http://localhost:5279/lbryapi',
webUiUri: 'http://localhost:5279',
peerListTimeout: 6000,
pendingPublishTimeout: 20 * 60 * 1000, pendingPublishTimeout: 20 * 60 * 1000,
colors: {
primary: '#155B4A'
},
defaultClientSettings: { defaultClientSettings: {
showNsfw: false, showNsfw: false,
showUnavailable: true, showUnavailable: true,
@ -91,7 +86,6 @@ function pendingPublishToDummyClaim({channel_name, name, outpoint, claim_id, txi
function pendingPublishToDummyFileInfo({name, outpoint, claim_id}) { function pendingPublishToDummyFileInfo({name, outpoint, claim_id}) {
return {name, outpoint, claim_id, metadata: null}; return {name, outpoint, claim_id, metadata: null};
} }
window.pptdfi = pendingPublishToDummyFileInfo;
lbry.call = function (method, params, callback, errorCallback, connectFailedCallback) { lbry.call = function (method, params, callback, errorCallback, connectFailedCallback) {
return jsonrpc.call(lbry.daemonConnectionString, 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; 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) { lbry.isDaemonAcceptingConnections = function (callback) {
// Returns true/false whether the daemon is at a point it will start returning status // Returns true/false whether the daemon is at a point it will start returning status
lbry.call('status', {}, () => callback(true), null, () => callback(false)) 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, { lbry = new Proxy(lbry, {
get: function(target, name) { get: function(target, name) {
if (name in target) { if (name in target) {

View file

@ -22,7 +22,7 @@ import {
} from 'actions/file_info' } from 'actions/file_info'
import parseQueryParams from 'util/query_params' 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 contextMenu = remote.require('./menu/context-menu');
const app = require('./app') const app = require('./app')
@ -47,11 +47,26 @@ window.addEventListener('popstate', (event, param) => {
}) })
ipcRenderer.on('open-uri-requested', (event, uri) => { ipcRenderer.on('open-uri-requested', (event, uri) => {
console.log('open uri')
console.log(event)
console.log(uri)
if (uri) { if (uri) {
console.log('FIX ME do magic dispatch: ' + 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(); const initialState = app.store.getState();
var init = function() { var init = function() {
@ -59,7 +74,8 @@ var init = function() {
function onDaemonReady() { function onDaemonReady() {
app.store.dispatch(doDaemonReady()) 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 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(doFetchDaemonSettings())
app.store.dispatch(doFileList()) app.store.dispatch(doFileList())
ReactDOM.render(<Provider store={store}><div>{ lbryio.enabled ? <AuthOverlay/> : '' }<App /><SnackBar /></div></Provider>, canvas) ReactDOM.render(<Provider store={store}><div>{ lbryio.enabled ? <AuthOverlay/> : '' }<App /><SnackBar /></div></Provider>, canvas)

View file

@ -4,6 +4,7 @@ import {
} from 'react-redux' } from 'react-redux'
import { import {
doNavigate, doNavigate,
doHistoryBack,
} from 'actions/app' } from 'actions/app'
import { import {
selectMyClaims selectMyClaims
@ -15,6 +16,7 @@ const select = (state) => ({
}) })
const perform = (dispatch) => ({ const perform = (dispatch) => ({
back: () => dispatch(doHistoryBack()),
navigate: (path) => dispatch(doNavigate(path)), navigate: (path) => dispatch(doNavigate(path)),
}) })

View file

@ -568,7 +568,7 @@ class PublishPage extends React.Component {
<div className="card-series-submit"> <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="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" /> <input type="submit" className="hidden" />
</div> </div>
</form> </form>

View file

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