From 839e6293624e8d590d5d74e5e4450b5b425142cd Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:18:37 -0400 Subject: [PATCH 1/8] Fix bid position and claim sequence regexes --- ui/js/uri.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/js/uri.js b/ui/js/uri.js index 98883c6be..1eb86ada0 100644 --- a/ui/js/uri.js +++ b/ui/js/uri.js @@ -74,12 +74,12 @@ uri.parseLbryUri = function(lbryUri, requireProto=false) { throw new Error(`Invalid claim ID ${claimId}.`); } - if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]+$/)) { - throw new Error('Bid position must be a number.'); + if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { + throw new Error('Claim sequence must be a number.'); } - if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]+$/)) { - throw new Error('Claim sequence must be a number.'); + if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]*$/)) { + throw new Error('Bid position must be a number.'); } // Validate path -- 2.45.2 From af32951d1fb4ffaec41730f8e0eead89cab51572 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:18:58 -0400 Subject: [PATCH 2/8] Add uri.normalizeLbryUri() --- ui/js/uri.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/js/uri.js b/ui/js/uri.js index 1eb86ada0..67615f7b5 100644 --- a/ui/js/uri.js +++ b/ui/js/uri.js @@ -115,4 +115,10 @@ uri.buildLbryUri = function(uriObj, includeProto=true) { (path ? `/${path}` : ''); } +/* Takes a parseable LBRY URI and converts it to standard, canonical format (currently this just + * consists of making sure it has a lbry:// prefix) */ +uri.normalizeLbryUri = function(lbryUri) { + return uri.buildLbryUri(uri.parseLbryUri(lbryUri)); +} + export default uri; -- 2.45.2 From 3b72938b74490f76c0f4ed00edb046632eaa4505 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:24:35 -0400 Subject: [PATCH 3/8] Refactor file tiles to be compatible with channels --- ui/js/component/channel-indicator.js | 8 ++--- ui/js/component/file-actions.js | 23 +++++++------ ui/js/component/file-tile.js | 50 ++++++++++++++++------------ ui/js/lbry.js | 36 +++++--------------- 4 files changed, 52 insertions(+), 65 deletions(-) diff --git a/ui/js/component/channel-indicator.js b/ui/js/component/channel-indicator.js index 674484200..37897cbcd 100644 --- a/ui/js/component/channel-indicator.js +++ b/ui/js/component/channel-indicator.js @@ -6,11 +6,11 @@ import {Icon} from './common.js'; const ChannelIndicator = React.createClass({ propTypes: { uri: React.PropTypes.string.isRequired, - claimInfo: React.PropTypes.object.isRequired, + hasSignature: React.PropTypes.bool.isRequired, + signatureIsValid: React.PropTypes.bool, }, render: function() { - const {name, has_signature, signature_is_valid} = this.props.claimInfo; - if (!has_signature) { + if (!this.props.hasSignature) { return null; } @@ -24,7 +24,7 @@ const ChannelIndicator = React.createClass({ const channelUri = uri.buildLbryUri(channelUriObj, false); let icon, modifier; - if (!signature_is_valid) { + if (this.props.signatureIsValid) { icon = 'icon-check-circle'; modifier = 'valid'; } else { diff --git a/ui/js/component/file-actions.js b/ui/js/component/file-actions.js index 863c9b9f2..314b2353b 100644 --- a/ui/js/component/file-actions.js +++ b/ui/js/component/file-actions.js @@ -11,11 +11,11 @@ const {shell} = require('electron'); let WatchLink = React.createClass({ propTypes: { - streamName: React.PropTypes.string, + uri: React.PropTypes.string, downloadStarted: React.PropTypes.bool, }, startVideo: function() { - window.location = '?watch=' + this.props.streamName; + window.location = '?watch=' + this.props.uri; }, handleClick: function() { this.setState({ @@ -25,7 +25,7 @@ let WatchLink = React.createClass({ if (this.props.downloadStarted) { this.startVideo(); } else { - lbry.getCostInfoForName(this.props.streamName, ({cost}) => { + lbry.getCostInfo(this.props.uri, ({cost}) => { lbry.getBalance((balance) => { if (cost > balance) { this.setState({ @@ -67,10 +67,10 @@ let FileActionsRow = React.createClass({ _fileInfoSubscribeId: null, propTypes: { - streamName: React.PropTypes.string, + uri: React.PropTypes.string, outpoint: React.PropTypes.string.isRequired, metadata: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.string]), - contentType: React.PropTypes.string, + contentType: React.PropTypes.string.isRequired, }, getInitialState: function() { return { @@ -95,7 +95,7 @@ let FileActionsRow = React.createClass({ attemptingDownload: true, attemptingRemove: false }); - lbry.getCostInfoForName(this.props.streamName, ({cost}) => { + lbry.getCostInfo(this.props.uri, ({cost}) => { lbry.getBalance((balance) => { if (cost > balance) { this.setState({ @@ -103,7 +103,7 @@ let FileActionsRow = React.createClass({ attemptingDownload: false, }); } else { - lbry.getStream(this.props.streamName, (streamInfo) => { + lbry.get({uri: this.props.uri}).then((streamInfo) => { if (streamInfo === null || typeof streamInfo !== 'object') { this.setState({ modal: 'timedOut', @@ -199,7 +199,7 @@ let FileActionsRow = React.createClass({ return (
{this.props.contentType && this.props.contentType.startsWith('video/') - ? + ? : null} {this.state.fileInfo !== null || this.state.fileInfo.isMine ? linkBlock @@ -215,7 +215,7 @@ let FileActionsRow = React.createClass({ - LBRY was unable to download the stream lbry://{this.props.streamName}. + LBRY was unable to download the stream lbry://{this.props.uri}. { + lbry.get_availability({uri: this.props.uri}, (availability) => { if (this._isMounted) { this.setState({ available: availability > 0, @@ -291,7 +292,7 @@ export let FileActions = React.createClass({ return (
{ fileInfo || this.state.available || this.state.forceShowActions - ? :
This file is not currently available.
diff --git a/ui/js/component/file-tile.js b/ui/js/component/file-tile.js index bb8438939..b65434bac 100644 --- a/ui/js/component/file-tile.js +++ b/ui/js/component/file-tile.js @@ -1,5 +1,6 @@ import React from 'react'; import lbry from '../lbry.js'; +import uri from '../uri.js'; import {Link} from '../component/link.js'; import {FileActions} from '../component/file-actions.js'; import {Thumbnail, TruncatedText, CreditAmount} from '../component/common.js'; @@ -22,14 +23,15 @@ let FilePrice = React.createClass({ componentDidMount: function() { this._isMounted = true; - lbry.getCostInfoForName(this.props.uri, ({cost, includesData}) => { + lbry.getCostInfo(this.props.uri, ({cost, includesData}) => { if (this._isMounted) { this.setState({ cost: cost, costIncludesData: includesData, }); } - }, () => { + }, (err) => { + console.log('error from getCostInfo callback:', err) // If we get an error looking up cost information, do nothing }); }, @@ -56,12 +58,14 @@ let FilePrice = React.createClass({ export let FileTileStream = React.createClass({ _fileInfoSubscribeId: null, _isMounted: null, - _metadata: null, propTypes: { uri: React.PropTypes.string, - claimInfo: React.PropTypes.object, + metadata: React.PropTypes.object.isRequired, + contentType: React.PropTypes.string.isRequired, outpoint: React.PropTypes.string, + hasSignature: React.PropTypes.bool, + signatureIsValid: React.PropTypes.bool, hideOnRemove: React.PropTypes.bool, hidePrice: React.PropTypes.bool, obscureNsfw: React.PropTypes.bool @@ -76,14 +80,10 @@ export let FileTileStream = React.createClass({ getDefaultProps: function() { return { obscureNsfw: !lbry.getClientSetting('showNsfw'), - hidePrice: false + hidePrice: false, + hasSignature: false, } }, - componentWillMount: function() { - const {value: {stream: {metadata, source: {contentType}}}} = this.props.claimInfo; - this._metadata = metadata; - this._contentType = contentType; - }, componentDidMount: function() { this._isMounted = true; if (this.props.hideOnRemove) { @@ -103,7 +103,7 @@ export let FileTileStream = React.createClass({ } }, handleMouseOver: function() { - if (this.props.obscureNsfw && this.props.metadata && this._metadata.nsfw) { + if (this.props.obscureNsfw && this.props.metadata && this.props.metadata.nsfw) { this.setState({ showNsfwHelp: true, }); @@ -117,25 +117,30 @@ export let FileTileStream = React.createClass({ } }, render: function() { + console.log('rendering.') if (this.state.isHidden) { + console.log('hidden, so returning null') return null; } - const metadata = this._metadata; + console.log("inside FileTileStream. metadata is", this.props.metadata) + + const lbryUri = uri.normalizeLbryUri(this.props.uri); + const metadata = this.props.metadata; const isConfirmed = typeof metadata == 'object'; - const title = isConfirmed ? metadata.title : ('lbry://' + this.props.uri); + const title = isConfirmed ? metadata.title : lbryUri; const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw; return (
- +
{ !this.props.hidePrice ? : null} - +

@@ -143,8 +148,9 @@ export let FileTileStream = React.createClass({

- - + +

{isConfirmed @@ -186,11 +192,9 @@ export let FileTile = React.createClass({ this._isMounted = true; lbry.resolve({uri: this.props.uri}).then(({claim: claimInfo}) => { - const {value: {stream: {metadata}}, txid, nout} = claimInfo; if (this._isMounted && claimInfo.value.stream.metadata) { // In case of a failed lookup, metadata will be null, in which case the component will never display this.setState({ - outpoint: txid + ':' + nout, claimInfo: claimInfo, }); } @@ -200,11 +204,13 @@ export let FileTile = React.createClass({ this._isMounted = false; }, render: function() { - if (!this.state.claimInfo || !this.state.outpoint) { + if (!this.state.claimInfo) { return null; } - return ; + const {txid, nout, has_signature, signature_is_valid, + value: {stream: {metadata, source: {contentType}}}} = this.state.claimInfo; + return ; } }); diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 2105abfb4..029a984d5 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -1,5 +1,6 @@ import lighthouse from './lighthouse.js'; import jsonrpc from './jsonrpc.js'; +import uri from './uri.js'; import {getLocal, setLocal} from './utils.js'; const {remote} = require('electron'); @@ -219,23 +220,6 @@ lbry.getMyClaim = function(name, callback) { }); } -lbry.getKeyFee = function(name, callback, errorCallback) { - if (!name) { - throw new Error(`Name required.`); - } - lbry.call('stream_cost_estimate', { name: name }, callback, errorCallback); -} - -lbry.getTotalCost = function(name, size, callback, errorCallback) { - if (!name) { - throw new Error(`Name required.`); - } - lbry.call('stream_cost_estimate', { - name: name, - size: size, - }, callback, errorCallback); -} - lbry.getPeersForBlobHash = function(blobHash, callback) { let timedOut = false; const timeout = setTimeout(() => { @@ -251,16 +235,9 @@ lbry.getPeersForBlobHash = function(blobHash, callback) { }); } -lbry.getStreamAvailability = function(name, callback, errorCallback) { - if (!name) { - throw new Error(`Name required.`); - } - lbry.call('get_availability', {name: name}, callback, errorCallback); -} - -lbry.getCostInfoForName = function(name, callback, errorCallback) { +lbry.getCostInfo = function(lbryUri, callback, errorCallback) { /** - * Takes a LBRY name; will first try and calculate a total cost using + * Takes a LBRY URI; will first try and calculate a total cost using * Lighthouse. If Lighthouse can't be reached, it just retrives the * key fee. * @@ -274,7 +251,7 @@ lbry.getCostInfoForName = function(name, callback, errorCallback) { } function getCostWithData(name, size, callback, errorCallback) { - lbry.getTotalCost(name, size, (cost) => { + lbry.stream_cost_estimate({name, size}).then((cost) => { callback({ cost: cost, includesData: true, @@ -283,7 +260,7 @@ lbry.getCostInfoForName = function(name, callback, errorCallback) { } function getCostNoData(name, callback, errorCallback) { - lbry.getKeyFee(name, (cost) => { + lbry.stream_cost_estimate({name}).then((cost) => { callback({ cost: cost, includesData: false, @@ -291,6 +268,9 @@ lbry.getCostInfoForName = function(name, callback, errorCallback) { }, errorCallback); } + const uriObj = uri.parseLbryUri(lbryUri); + const name = uriObj.path || uriObj.name; + lighthouse.get_size_for_name(name).then((size) => { getCostWithData(name, size, callback, errorCallback); }, () => { -- 2.45.2 From f8e3eff3789180cf8c90cf2fa7012b3d4074a592 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:26:05 -0400 Subject: [PATCH 4/8] Update My Files for channel compatibility --- ui/js/page/file-list.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/js/page/file-list.js b/ui/js/page/file-list.js index 8134be11f..561cc6106 100644 --- a/ui/js/page/file-list.js +++ b/ui/js/page/file-list.js @@ -1,5 +1,6 @@ import React from 'react'; import lbry from '../lbry.js'; +import uri from '../uri.js'; import {Link} from '../component/link.js'; import FormField from '../component/form.js'; import {FileTileStream} from '../component/file-tile.js'; @@ -160,14 +161,14 @@ export let FileList = React.createClass({ seenUris = {}; const fileInfosSorted = this._sortFunctions[this.state.sortBy](this.props.fileInfos); - for (let {name, outpoint, metadata} of fileInfosSorted) { + for (let {name, outpoint, metadata: {stream: {metadata}}, mime_type, claim_id} of fileInfosSorted) { if (!metadata || seenUris[name]) { continue; } seenUris[name] = true; - content.push(); + content.push(); } return ( -- 2.45.2 From a80b2da5c2c1260915a7211185ffb8b67eabdb55 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:29:07 -0400 Subject: [PATCH 5/8] Update Show page for channels --- ui/js/app.js | 4 +-- ui/js/page/show.js | 76 +++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 44 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index 76ee648bd..735eefea6 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -10,7 +10,7 @@ import StartPage from './page/start.js'; import ClaimCodePage from './page/claim_code.js'; import ReferralPage from './page/referral.js'; import WalletPage from './page/wallet.js'; -import DetailPage from './page/show.js'; +import ShowPage from './page/show.js'; import PublishPage from './page/publish.js'; import DiscoverPage from './page/discover.js'; import SplashScreen from './component/splash.js'; @@ -277,7 +277,7 @@ var App = React.createClass({ case 'receive': return ; case 'show': - return ; + return ; case 'publish': return ; case 'developer': diff --git a/ui/js/page/show.js b/ui/js/page/show.js index 8f4d450c9..49aff7569 100644 --- a/ui/js/page/show.js +++ b/ui/js/page/show.js @@ -1,6 +1,7 @@ import React from 'react'; import lbry from '../lbry.js'; import lighthouse from '../lighthouse.js'; +import uri from '../uri.js'; import {CreditAmount, Thumbnail} from '../component/common.js'; import {FileActions} from '../component/file-actions.js'; import {Link} from '../component/link.js'; @@ -16,22 +17,16 @@ var formatItemImgStyle = { var FormatItem = React.createClass({ propTypes: { - claimInfo: React.PropTypes.object, + metadata: React.PropTypes.object, + contentType: React.PropTypes.string, cost: React.PropTypes.number, - name: React.PropTypes.string, + uri: React.PropTypes.string, outpoint: React.PropTypes.string, costIncludesData: React.PropTypes.bool, }, render: function() { - var claimInfo = this.props.claimInfo; - var thumbnail = claimInfo.thumbnail; - var title = claimInfo.title; - var description = claimInfo.description; - var author = claimInfo.author; - var language = claimInfo.language; - var license = claimInfo.license; - var fileContentType = (claimInfo.content_type || claimInfo['content-type']); - var mediaType = lbry.getMediaType(fileContentType); + const {thumbnail, author, title, description, language, license} = this.props.metadata; + const mediaType = lbry.getMediaType(this.props.contentType); var costIncludesData = this.props.costIncludesData; var cost = this.props.cost || 0.0; @@ -46,7 +41,7 @@ var FormatItem = React.createClass({ - + @@ -63,7 +58,7 @@ var FormatItem = React.createClass({
Content-Type{fileContentType}Content-Type{this.props.contentType}
Cost

- +
@@ -75,17 +70,15 @@ var FormatItem = React.createClass({ var FormatsSection = React.createClass({ propTypes: { - claimInfo: React.PropTypes.object, + uri: React.PropTypes.string, + outpoint: React.PropTypes.string, + metadata: React.PropTypes.object, + contentType: React.PropTypes.string, cost: React.PropTypes.number, - name: React.PropTypes.string, costIncludesData: React.PropTypes.bool, }, render: function() { - var name = this.props.name; - var format = this.props.claimInfo; - var title = format.title; - - if(format == null) + if(this.props.metadata == null) { return (
@@ -95,41 +88,46 @@ var FormatsSection = React.createClass({ return (
-
lbry://{name}
-

{title}

+
{this.props.uri}
+

{this.props.metadata.title}

{/* In future, anticipate multiple formats, just a guess at what it could look like - // var formats = this.props.claimInfo.formats + // var formats = this.props.metadata.formats // return ({formats.map(function(format,i){ */} - + {/* })}); */}
); } }); -var DetailPage = React.createClass({ +var ShowPage = React.createClass({ + _uri: null, + propTypes: { - name: React.PropTypes.string, + uri: React.PropTypes.string, }, getInitialState: function() { return { metadata: null, + contentType: null, cost: null, costIncludesData: null, - nameLookupComplete: null, + uriLookupComplete: null, }; }, componentWillMount: function() { - document.title = 'lbry://' + this.props.name; + this._uri = uri.normalizeLbryUri(this.props.uri); + document.title = this._uri; - lbry.claim_show({name: this.props.name}, ({name, txid, nout, value}) => { + lbry.resolve({uri: this._uri}).then(({txid, nout, claim: {value: {stream: {metadata, source: {contentType}}}}}) => { this.setState({ outpoint: txid + ':' + nout, - metadata: value, - nameLookupComplete: true, + metadata: metadata, + contentType: contentType, + uriLookupComplete: true, }); }); - lbry.getCostInfoForName(this.props.name, ({cost, includesData}) => { + lbry.getCostInfo(this._uri, ({cost, includesData}) => { this.setState({ cost: cost, costIncludesData: includesData, @@ -141,21 +139,15 @@ var DetailPage = React.createClass({ return null; } - const name = this.props.name; - const costIncludesData = this.state.costIncludesData; - const metadata = this.state.metadata; - const cost = this.state.cost; - const outpoint = this.state.outpoint; - return (
- {this.state.nameLookupComplete ? ( - + {this.state.uriLookupComplete ? ( + ) : (

No content

- There is no content available at the name lbry://{this.props.name}. If you reached this page from a link within the LBRY interface, please . Thanks! + There is no content available at {this._uri}. If you reached this page from a link within the LBRY interface, please . Thanks!
)}
@@ -163,4 +155,4 @@ var DetailPage = React.createClass({ } }); -export default DetailPage; +export default ShowPage; -- 2.45.2 From 562f7dd399cca5b7bb5bdbcd81ecf89c830de1a7 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:30:02 -0400 Subject: [PATCH 6/8] Update Watch page for channels --- ui/js/app.js | 2 +- ui/js/page/watch.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index 735eefea6..7e8559be7 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -259,7 +259,7 @@ var App = React.createClass({ case 'help': return ; case 'watch': - return ; + return ; case 'report': return ; case 'downloaded': diff --git a/ui/js/page/watch.js b/ui/js/page/watch.js index 9d7bdb75b..ac270d77a 100644 --- a/ui/js/page/watch.js +++ b/ui/js/page/watch.js @@ -15,7 +15,7 @@ var WatchPage = React.createClass({ _outpoint: null, propTypes: { - name: React.PropTypes.string, + uri: React.PropTypes.string, }, getInitialState: function() { return { @@ -27,7 +27,7 @@ var WatchPage = React.createClass({ }; }, componentDidMount: function() { - lbry.get({name: this.props.name}).then((fileInfo) => { + lbry.get({uri: this.props.uri}).then((fileInfo) => { this._outpoint = fileInfo.outpoint; this.updateLoadStatus(); }); -- 2.45.2 From 326493c0b72cd536033953cd6666be08de17893e Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:45:41 -0400 Subject: [PATCH 7/8] Publish: use new discover() RPC method --- ui/js/page/publish.js | 71 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/ui/js/page/publish.js b/ui/js/page/publish.js index 019783587..74bc623b4 100644 --- a/ui/js/page/publish.js +++ b/ui/js/page/publish.js @@ -1,5 +1,6 @@ import React from 'react'; import lbry from '../lbry.js'; +import uri from '../uri.js'; import FormField from '../component/form.js'; import {Link} from '../component/link.js'; import Modal from '../component/modal.js'; @@ -169,49 +170,45 @@ var PublishPage = React.createClass({ rawName: rawName, }); - var name = rawName.toLowerCase(); - - lbry.resolveName(name, (info) => { + const name = rawName.toLowerCase(); + lbry.resolve({uri: name}).then((info) => { if (name != this.refs.name.getValue().toLowerCase()) { // A new name has been typed already, so bail return; } + lbry.getMyClaim(name, (myClaimInfo) => { + lbry.getClaimInfo(name, (claimInfo) => { + if (name != this.refs.name.getValue()) { + return; + } - if (!info) { - this.setState({ - name: name, - nameResolved: false, - myClaimExists: false, + const topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount); + const newState = { + name: name, + nameResolved: true, + topClaimValue: parseFloat(claimInfo.amount), + myClaimExists: !!myClaimInfo, + myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null, + myClaimMetadata: myClaimInfo ? myClaimInfo.value : null, + topClaimIsMine: topClaimIsMine, + }; + + if (topClaimIsMine) { + newState.bid = myClaimInfo.amount; + } else if (this.state.myClaimMetadata) { + // Just changed away from a name we have a claim on, so clear pre-fill + newState.bid = ''; + } + + this.setState(newState); }); - } else { - lbry.getMyClaim(name, (myClaimInfo) => { - lbry.getClaimInfo(name, (claimInfo) => { - if (name != this.refs.name.getValue()) { - return; - } - - const topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount); - const newState = { - name: name, - nameResolved: true, - topClaimValue: parseFloat(claimInfo.amount), - myClaimExists: !!myClaimInfo, - myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null, - myClaimMetadata: myClaimInfo ? myClaimInfo.value : null, - topClaimIsMine: topClaimIsMine, - }; - - if (topClaimIsMine) { - newState.bid = myClaimInfo.amount; - } else if (this.state.myClaimMetadata) { - // Just changed away from a name we have a claim on, so clear pre-fill - newState.bid = ''; - } - - this.setState(newState); - }); - }); - } + }); + }, () => { // Assume an error means the name is available + this.setState({ + name: name, + nameResolved: false, + myClaimExists: false, + }); }); }, handleBidChange: function(event) { -- 2.45.2 From 7e8fdf625f6683f82130c575637d89fc09ca6190 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 10 Apr 2017 21:48:10 -0400 Subject: [PATCH 8/8] Style fixes and cleanup - Remove a couple of unused files from lbry.js - Couple of style fixes --- ui/js/lbry.js | 8 -------- ui/js/page/discover.js | 2 +- ui/js/page/publish.js | 13 ++++++++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 029a984d5..f2f201de6 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -305,14 +305,6 @@ lbry.getMyClaims = function(callback) { lbry.call('get_name_claims', {}, callback); } -lbry.startFile = function(name, callback) { - lbry.call('start_lbry_file', { name: name }, callback); -} - -lbry.stopFile = function(name, callback) { - lbry.call('stop_lbry_file', { name: name }, callback); -} - lbry.removeFile = function(outpoint, deleteTargetFile=true, callback) { this._removedFiles.push(outpoint); this._updateFileInfoSubscribers(outpoint); diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js index 762c55d3c..678310338 100644 --- a/ui/js/page/discover.js +++ b/ui/js/page/discover.js @@ -84,7 +84,7 @@ var FeaturedContent = React.createClass({

Featured Content

- { this.state.featuredNames.map((name) => { return }) } + { this.state.featuredNames.map(name => ) }

diff --git a/ui/js/page/publish.js b/ui/js/page/publish.js index 74bc623b4..8493dae1a 100644 --- a/ui/js/page/publish.js +++ b/ui/js/page/publish.js @@ -340,12 +340,15 @@ var PublishPage = React.createClass({

LBRY Name

- lbry:// + { - (!this.state.name ? '' : - (! this.state.nameResolved ? The name {this.state.name} is available. - : (this.state.myClaimExists ? You already have a claim on the name {this.state.name}. You can use this page to update your claim. - : The name {this.state.name} is currently claimed for {this.state.topClaimValue} {this.state.topClaimValue == 1 ? 'credit' : 'credits'}.))) + (!this.state.name + ? null + : (!this.state.nameResolved + ? The name {this.state.name} is available. + : (this.state.myClaimExists + ? You already have a claim on the name {this.state.name}. You can use this page to update your claim. + : The name {this.state.name} is currently claimed for {this.state.topClaimValue} {this.state.topClaimValue == 1 ? 'credit' : 'credits'}.))) }
What LBRY name would you like to claim for this file?
-- 2.45.2