Remove (est) from cost on items that Lighthouse reports hosted

Also adds "credits" to all prices and tweaks formatting slightly
This commit is contained in:
Alex Liebowitz 2016-08-19 03:15:13 -04:00
parent a98c97fe0f
commit 5d05e10f18
2 changed files with 8 additions and 5 deletions

View file

@ -57,7 +57,7 @@ var creditAmountStyle = {
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '0.8em' fontSize: '0.8em'
}, estimateStyle = { }, estimateStyle = {
marginLeft : '5px', fontSize: '0.8em',
color: '#aaa', color: '#aaa',
}; };
@ -73,8 +73,8 @@ var CreditAmount = React.createClass({
var formattedAmount = lbry.formatCredits(this.props.amount); var formattedAmount = lbry.formatCredits(this.props.amount);
return ( return (
<span className="credit-amount"> <span className="credit-amount">
<span style={creditAmountStyle}>{formattedAmount}</span> <span style={creditAmountStyle}>{formattedAmount} {parseFloat(formattedAmount) == 1.0 ? 'credit' : 'credits'}</span>
{ this.props.isEstimate ? <span style={estimateStyle}>(est)</span> : null } { this.props.isEstimate ? <span style={estimateStyle}> (est)</span> : null }
</span> </span>
); );
} }

View file

@ -91,7 +91,7 @@ var SearchResultRow = React.createClass({
</div> </div>
<div className="span9"> <div className="span9">
<span style={searchRowCostStyle}> <span style={searchRowCostStyle}>
<CreditAmount amount={this.props.cost} isEstimate={true}/> <CreditAmount amount={this.props.cost} isEstimate={!this.props.available}/>
</span> </span>
<div className="meta">lbry://{this.props.name}</div> <div className="meta">lbry://{this.props.name}</div>
<h3 style={searchRowTitleStyle}><a href={'/?show=' + this.props.name}>{this.props.title}</a></h3> <h3 style={searchRowTitleStyle}><a href={'/?show=' + this.props.name}>{this.props.title}</a></h3>
@ -129,6 +129,7 @@ var FeaturedContentItem = React.createClass({
this.setState({ this.setState({
metadata: metadata, metadata: metadata,
amount: result.cost, amount: result.cost,
available: result.available,
title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name), title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name),
}) })
}); });
@ -139,8 +140,10 @@ var FeaturedContentItem = React.createClass({
// Still waiting for metadata // Still waiting for metadata
return null; return null;
} }
return <SearchResultRow name={this.props.name} title={this.state.title} imgUrl={this.state.metadata.thumbnail} return <SearchResultRow name={this.props.name} title={this.state.title} imgUrl={this.state.metadata.thumbnail}
description={this.state.metadata.description} cost={this.state.amount} />; description={this.state.metadata.description} cost={this.state.amount}
available={this.state.available} />;
} }
}); });