c5c67a0de5
Add doResolveUris() Always call resolveUri() in FileTile and FileCard Before, these components would only try and resolve if claim info wasn't provided. Don't require uri param in lbry.resolve() It can now be "uris" instead, plus the error message about caching doesn't really apply anymore. Don't cache/cancel open resolve requests No longer needed because we're not doing resolve requests in bulk Add support for multiple URI resolution in lbry.resolve() Handle multi URL resolves with one action Update CHANGELOG.md
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import React from "react";
|
|
import lbryuri from "lbryuri";
|
|
import { BusyMessage } from "component/common";
|
|
import ChannelPage from "page/channel";
|
|
import FilePage from "page/file";
|
|
|
|
class ShowPage extends React.PureComponent {
|
|
componentWillMount() {
|
|
const { resolveUri, uri } = this.props;
|
|
|
|
resolveUri(uri);
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
const { resolveUri, uri } = nextProps;
|
|
|
|
resolveUri(uri);
|
|
}
|
|
|
|
render() {
|
|
const { claim, isResolvingUri, uri } = this.props;
|
|
|
|
let innerContent = "";
|
|
|
|
if ((isResolvingUri && !claim) || !claim) {
|
|
innerContent = (
|
|
<section className="card">
|
|
<div className="card__inner">
|
|
<div className="card__title-identity"><h1>{uri}</h1></div>
|
|
</div>
|
|
<div className="card__content">
|
|
{isResolvingUri &&
|
|
<BusyMessage
|
|
message={__("Loading magic decentralized data...")}
|
|
/>}
|
|
{claim === null &&
|
|
!isResolvingUri &&
|
|
<span className="empty">
|
|
{__("There's nothing at this location.")}
|
|
</span>}
|
|
</div>
|
|
</section>
|
|
);
|
|
} else if (claim && claim.name.length && claim.name[0] === "@") {
|
|
innerContent = <ChannelPage uri={uri} />;
|
|
} else if (claim) {
|
|
innerContent = <FilePage uri={uri} />;
|
|
}
|
|
|
|
return <main className="main--single-column">{innerContent}</main>;
|
|
}
|
|
}
|
|
|
|
export default ShowPage;
|