lbry-desktop/ui/component/claimPreviewSubtitle/view.jsx
DispatchCommit 6819798ebe Revert "Merge pull request #5691 from lbryio/feat/go-live"
This reverts commit a258fcb039, reversing
changes made to b261763402.
2021-03-23 09:20:35 -07:00

51 lines
1.4 KiB
JavaScript

// @flow
import React from 'react';
import UriIndicator from 'component/uriIndicator';
import DateTime from 'component/dateTime';
import Button from 'component/button';
import { parseURI } from 'lbry-redux';
type Props = {
uri: string,
claim: ?Claim,
pending?: boolean,
type: string,
beginPublish: (string) => void,
};
function ClaimPreviewSubtitle(props: Props) {
const { pending, uri, claim, type, beginPublish } = props;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
let isChannel;
let name;
try {
({ streamName: name, isChannel } = parseURI(uri));
} catch (e) {}
return (
<div className="media__subtitle">
{claim ? (
<React.Fragment>
<UriIndicator uri={uri} link />{' '}
{!pending &&
claim &&
(isChannel ? (
type !== 'inline' && `${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`
) : (
<DateTime timeAgo uri={uri} />
))}
</React.Fragment>
) : (
<React.Fragment>
<div>{__('Upload something and claim this spot!')}</div>
<div className="card__actions">
<Button onClick={() => beginPublish(name)} button="primary" label={__('Publish to %uri%', { uri })} />
</div>
</React.Fragment>
)}
</div>
);
}
export default ClaimPreviewSubtitle;