2019-05-07 04:35:04 +02:00
|
|
|
// @flow
|
2020-09-16 18:26:14 +02:00
|
|
|
import { SIMPLE_SITE } from 'config';
|
2019-05-07 04:35:04 +02:00
|
|
|
import React, { Fragment } from 'react';
|
2019-05-29 23:54:47 +02:00
|
|
|
import MarkdownPreview from 'component/common/markdown-preview';
|
2020-02-14 17:52:54 +01:00
|
|
|
import ClaimTags from 'component/claimTags';
|
2020-03-12 15:57:38 +01:00
|
|
|
import CreditAmount from 'component/common/credit-amount';
|
|
|
|
import Button from 'component/button';
|
|
|
|
import * as PAGES from 'constants/pages';
|
|
|
|
import DateTime from 'component/dateTime';
|
2019-05-07 04:35:04 +02:00
|
|
|
|
|
|
|
type Props = {
|
2020-03-12 15:57:38 +01:00
|
|
|
claim: ChannelClaim,
|
2020-02-14 17:52:54 +01:00
|
|
|
uri: string,
|
2019-05-07 04:35:04 +02:00
|
|
|
description: ?string,
|
|
|
|
email: ?string,
|
|
|
|
website: ?string,
|
|
|
|
};
|
|
|
|
|
2019-05-30 01:21:20 +02:00
|
|
|
const formatEmail = (email: string) => {
|
|
|
|
if (email) {
|
|
|
|
const protocolRegex = new RegExp('^mailto:', 'i');
|
|
|
|
const protocol = protocolRegex.exec(email);
|
|
|
|
return protocol ? email : `mailto:${email}`;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2020-03-12 15:57:38 +01:00
|
|
|
function ChannelAbout(props: Props) {
|
|
|
|
const { claim, uri, description, email, website } = props;
|
2019-05-07 04:35:04 +02:00
|
|
|
|
|
|
|
return (
|
2020-03-12 15:57:38 +01:00
|
|
|
<div className="card">
|
|
|
|
<section className="section card--section">
|
2019-05-07 04:35:04 +02:00
|
|
|
<Fragment>
|
2019-05-29 23:54:47 +02:00
|
|
|
{description && (
|
2020-06-29 21:54:07 +02:00
|
|
|
<>
|
|
|
|
<label>{__('Description')}</label>
|
|
|
|
<div className="media__info-text media__info-text--constrained">
|
|
|
|
<MarkdownPreview content={description} />
|
|
|
|
</div>
|
|
|
|
</>
|
2019-05-29 23:54:47 +02:00
|
|
|
)}
|
2019-05-07 04:35:04 +02:00
|
|
|
{email && (
|
|
|
|
<Fragment>
|
2019-11-22 22:13:00 +01:00
|
|
|
<label>{__('Contact')}</label>
|
2019-05-30 01:21:20 +02:00
|
|
|
<div className="media__info-text">
|
2019-12-03 17:41:44 +01:00
|
|
|
<MarkdownPreview content={formatEmail(email)} />
|
2019-05-30 01:21:20 +02:00
|
|
|
</div>
|
2019-05-07 04:35:04 +02:00
|
|
|
</Fragment>
|
|
|
|
)}
|
|
|
|
{website && (
|
|
|
|
<Fragment>
|
2019-11-22 22:13:00 +01:00
|
|
|
<label>{__('Site')}</label>
|
2019-05-29 23:54:47 +02:00
|
|
|
<div className="media__info-text">
|
2019-12-03 17:41:44 +01:00
|
|
|
<MarkdownPreview content={website} />
|
2019-05-29 23:54:47 +02:00
|
|
|
</div>
|
2019-05-07 04:35:04 +02:00
|
|
|
</Fragment>
|
|
|
|
)}
|
2020-02-14 17:52:54 +01:00
|
|
|
|
|
|
|
<label>{__('Tags')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<ClaimTags uri={uri} type="large" />
|
|
|
|
</div>
|
2020-03-12 15:57:38 +01:00
|
|
|
|
2020-07-23 19:11:53 +02:00
|
|
|
<label>{__('Total Uploads')}</label>
|
2020-03-12 15:57:38 +01:00
|
|
|
<div className="media__info-text">{claim.meta.claims_in_channel}</div>
|
|
|
|
|
|
|
|
<label>{__('Last Updated')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<DateTime timeAgo uri={uri} />
|
|
|
|
</div>
|
|
|
|
|
2020-07-29 19:04:23 +02:00
|
|
|
<label>{__('URL')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<div className="media__info-text media__info-text--constrained">{claim.canonical_url}</div>
|
|
|
|
</div>
|
|
|
|
|
2020-03-12 15:57:38 +01:00
|
|
|
<label>{__('Claim ID')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<div className="media__info-text media__info-text--constrained">{claim.claim_id}</div>
|
|
|
|
</div>
|
|
|
|
|
2020-09-02 22:08:37 +02:00
|
|
|
<label>{__('Staked LBRY Credits')}</label>
|
2020-03-12 15:57:38 +01:00
|
|
|
<div className="media__info-text">
|
|
|
|
<CreditAmount
|
|
|
|
badge={false}
|
|
|
|
amount={parseFloat(claim.amount) + parseFloat(claim.meta.support_amount)}
|
|
|
|
precision={8}
|
|
|
|
/>{' '}
|
2020-09-16 18:26:14 +02:00
|
|
|
{SIMPLE_SITE && (
|
|
|
|
<Button
|
|
|
|
button="link"
|
|
|
|
label={__('view other claims at lbry://%name%', {
|
|
|
|
name: claim.name,
|
|
|
|
})}
|
|
|
|
navigate={`/$/${PAGES.TOP}?name=${claim.name}`}
|
|
|
|
/>
|
|
|
|
)}
|
2020-03-12 15:57:38 +01:00
|
|
|
</div>
|
2019-05-07 04:35:04 +02:00
|
|
|
</Fragment>
|
2020-03-12 15:57:38 +01:00
|
|
|
</section>
|
|
|
|
</div>
|
2019-05-07 04:35:04 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-12 15:57:38 +01:00
|
|
|
export default ChannelAbout;
|