2019-05-07 04:35:04 +02:00
|
|
|
// @flow
|
|
|
|
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 DateTime from 'component/dateTime';
|
2020-10-06 22:28:12 +02:00
|
|
|
import YoutubeBadge from 'component/youtubeBadge';
|
2020-10-15 19:56:55 +02:00
|
|
|
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
2022-04-26 17:28:23 +02:00
|
|
|
import { formatNumber } from 'util/number';
|
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,
|
2020-10-15 19:56:55 +02:00
|
|
|
languages: Array<string>,
|
2019-05-07 04:35:04 +02:00
|
|
|
};
|
|
|
|
|
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) {
|
2021-04-08 19:59:22 +02:00
|
|
|
const { claim, uri, description, email, website, languages } = props;
|
2020-10-06 22:28:12 +02:00
|
|
|
const claimId = claim && claim.claim_id;
|
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">
|
2021-04-08 19:59:22 +02:00
|
|
|
<MarkdownPreview content={description} />
|
2020-06-29 21:54:07 +02:00
|
|
|
</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">
|
2021-03-09 15:04:49 +01:00
|
|
|
<MarkdownPreview content={formatEmail(email)} simpleLinks />
|
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">
|
2021-03-09 15:04:49 +01:00
|
|
|
<MarkdownPreview content={website} simpleLinks />
|
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-10-15 19:56:55 +02:00
|
|
|
<label>{__('Languages')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
{/* this could use some nice 'tags' styling */}
|
2020-10-29 18:36:45 +01:00
|
|
|
{languages && languages.length
|
|
|
|
? languages.reduce((acc, lang, i) => {
|
2020-10-30 03:38:32 +01:00
|
|
|
return acc + `${SUPPORTED_LANGUAGES[lang]}` + ' ';
|
2020-10-29 18:36:45 +01:00
|
|
|
}, '')
|
|
|
|
: null}
|
2020-10-15 19:56:55 +02:00
|
|
|
</div>
|
|
|
|
|
2020-07-23 19:11:53 +02:00
|
|
|
<label>{__('Total Uploads')}</label>
|
2022-04-26 17:28:23 +02:00
|
|
|
<div className="media__info-text">{formatNumber(claim.meta.claims_in_channel || 0, 2, true)}</div>
|
2020-03-12 15:57:38 +01:00
|
|
|
|
|
|
|
<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}
|
|
|
|
/>{' '}
|
|
|
|
</div>
|
2020-10-06 22:28:12 +02:00
|
|
|
|
|
|
|
<YoutubeBadge channelClaimId={claimId} />
|
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;
|