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

View file

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