Seed Support #56
4 changed files with 34 additions and 22 deletions
|
@ -261,7 +261,6 @@ export let FileActions = React.createClass({
|
|||
componentDidMount: function() {
|
||||
this._isMounted = true;
|
||||
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.outpoint, this.onFileInfoUpdate);
|
||||
lbry.getStreamAvailability(this.props.uri, (availability) => {
|
||||
lbry.get_availability({uri: this.props.uri}, (availability) => {
|
||||
if (this._isMounted) {
|
||||
this.setState({
|
||||
|
|
|
@ -27,8 +27,8 @@ var SplashScreen = React.createClass({
|
|||
isLagging: false
|
||||
});
|
||||
|
||||
lbry.resolveName('one', () => {
|
||||
window.sessionStorage.setItem('loaded', 'y')
|
||||
lbry.resolve({uri: 'lbry://one'}).then(() => {
|
||||
window.sessionStorage.setItem('loaded', 'y')
|
||||
this.props.onLoadDone();
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -161,14 +161,21 @@ export let FileList = React.createClass({
|
|||
seenUris = {};
|
||||
|
||||
const fileInfosSorted = this._sortFunctions[this.state.sortBy](this.props.fileInfos);
|
||||
for (let {name, outpoint, metadata: {stream: {metadata}}, mime_type, claim_id} of fileInfosSorted) {
|
||||
for (let {outpoint, name, channel_name, metadata: {stream: {metadata}}, mime_type, claim_id, has_signature, signature_is_valid} of fileInfosSorted) {
|
||||
if (!metadata || seenUris[name]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let fileUri;
|
||||
if (channel_name === undefined) {
|
||||
fileUri = uri.buildLbryUri({name});
|
||||
} else {
|
||||
fileUri = uri.buildLbryUri({name: channel_name, path: name});
|
||||
}
|
||||
seenUris[name] = true;
|
||||
content.push(<FileTileStream key={outpoint} outpoint={outpoint} uri={uri.buildLbryUri({name, claimId: claim_id})} hideOnRemove={true}
|
||||
hidePrice={this.props.hidePrices} metadata={metadata} contentType={mime_type} />);
|
||||
content.push(<FileTileStream key={outpoint} outpoint={outpoint} uri={fileUri} hideOnRemove={true}
|
||||
hidePrice={this.props.hidePrices} metadata={metadata} contentType={mime_type}
|
||||
hasSignature={has_signature} signatureIsValid={signature_is_valid} />);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -171,44 +171,50 @@ var PublishPage = React.createClass({
|
|||
});
|
||||
|
||||
const name = rawName.toLowerCase();
|
||||
lbry.resolve({uri: name}).then((info) => {
|
||||
lbry.getMyClaim(name, (myClaimInfo) => {
|
||||
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;
|
||||
}
|
||||
lbry.resolve({uri: name}).then((claimInfo) => {
|
||||
if (name != this.refs.name.getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const topClaimIsMine = (myClaimInfo && myClaimInfo.amount >= claimInfo.amount);
|
||||
if (!claimInfo) {
|
||||
this.setState({
|
||||
name: name,
|
||||
nameResolved: false,
|
||||
myClaimExists: false,
|
||||
});
|
||||
} else {
|
||||
const topClaimIsMine = (myClaimInfo && myClaimInfo.claim.amount >= claimInfo.claim.amount);
|
||||
const newState = {
|
||||
name: name,
|
||||
nameResolved: true,
|
||||
topClaimValue: parseFloat(claimInfo.amount),
|
||||
topClaimValue: parseFloat(claimInfo.claim.amount),
|
||||
myClaimExists: !!myClaimInfo,
|
||||
myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null,
|
||||
myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.claim.amount) : null,
|
||||
myClaimMetadata: myClaimInfo ? myClaimInfo.value : null,
|
||||
topClaimIsMine: topClaimIsMine,
|
||||
};
|
||||
|
||||
if (topClaimIsMine) {
|
||||
newState.bid = myClaimInfo.amount;
|
||||
newState.bid = myClaimInfo.claim.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,
|
||||
});
|
||||
});
|
||||
}, () => { // Assume an error means the name is available
|
||||
this.setState({
|
||||
name: name,
|
||||
nameResolved: false,
|
||||
myClaimExists: false,
|
||||
});
|
||||
});
|
||||
},
|
||||
handleBidChange: function(event) {
|
||||
|
|
Loading…
Reference in a new issue