mark pending claims; move them to front of list; show proper notification

This commit is contained in:
Travis Eden 2018-11-12 08:25:48 -05:00 committed by Shawn
parent 959c06746d
commit b49cb4484c
3 changed files with 24 additions and 11 deletions

View file

@ -46,7 +46,7 @@ class AssetDisplay extends React.Component {
}
render () {
const { status, error, asset } = this.props;
const { name, claimData: { claimId, contentType, thumbnail, outpoint } } = asset;
const { name, claimData: { claimId, contentType, thumbnail, outpoint, pending } } = asset;
// the outpoint is added to force the browser to re-download the asset after an update
// issue: https://github.com/lbryio/spee.ch/issues/607
let fileExt;
@ -68,16 +68,22 @@ class AssetDisplay extends React.Component {
<p>Curious what magic is happening here? <a className='link--primary' target='blank' href='https://lbry.io/faq/what-is-lbry'>Learn more.</a></p>
</div>
}
{(status === ERROR) &&
<div>
<Row>
<p>Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the following error message in the <a className='link--primary' href='https://chat.lbry.io' target='_blank'>LBRY discord</a>.</p>
</Row>
<Row>
<p id='error-message'><i>{error}</i></p>
</Row>
</div>
}
{(status === ERROR) && (
pending ? (
<div>
<p>This content is pending confirmation on the LBRY blockchain. It should be available in the next few minutes, please check back or refresh.</p>
</div>
) : (
<div>
<Row>
<p>Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the following error message in the <a className='link--primary' href='https://chat.lbry.io' target='_blank'>LBRY discord</a>.</p>
</Row>
<Row>
<p id='error-message'><i>{error}</i></p>
</Row>
</div>
)
)}
{(status === AVAILABLE) &&
<AvailableContent
contentType={contentType}

View file

@ -17,6 +17,12 @@ const getChannelClaims = async (channelName, channelShortId, page) => {
channelClaims = await chainquery.claim.queries.getAllChannelClaims(channelId, params);
}
const split = channelClaims.reduce(
(acc, val) => val.dataValues.height === 0 ? { ...acc, zero: acc.zero.concat(val) } : { ...acc, nonzero: acc.nonzero.concat(val) },
{ zero: [], nonzero: [] }
);
channelClaims = split.zero.concat(split.nonzero);
const processingChannelClaims = channelClaims ? channelClaims.map((claim) => getClaimData(claim)) : [];
const processedChannelClaims = await Promise.all(processingChannelClaims);

View file

@ -28,5 +28,6 @@ module.exports = async (data) => {
thumbnail : data.generated_thumbnail || data.thumbnail_url || data.thumbnail,
outpoint : data.transaction_hash_id || data.outpoint,
host,
pending: Boolean(data.height === 0),
});
};