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 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>
|
2020-06-19 18:26:52 +02:00
|
|
|
<label>{__('Description')}</label>
|
2019-05-29 23:54:47 +02:00
|
|
|
{description && (
|
2019-11-22 22:13:00 +01:00
|
|
|
<div className="media__info-text media__info-text--constrained">
|
2019-12-03 17:41:44 +01:00
|
|
|
<MarkdownPreview content={description} />
|
2019-05-29 23:54:47 +02:00
|
|
|
</div>
|
|
|
|
)}
|
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
|
|
|
|
|
|
|
<label>{__('Total Publishes')}</label>
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<label>{__('Claim ID')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<div className="media__info-text media__info-text--constrained">{claim.claim_id}</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<label>{__('Staked LBC')}</label>
|
|
|
|
<div className="media__info-text">
|
|
|
|
<CreditAmount
|
|
|
|
badge={false}
|
|
|
|
amount={parseFloat(claim.amount) + parseFloat(claim.meta.support_amount)}
|
|
|
|
precision={8}
|
|
|
|
/>{' '}
|
|
|
|
(
|
|
|
|
<Button
|
|
|
|
button="link"
|
|
|
|
label={__('view other claims at lbry://%name%', {
|
|
|
|
name: claim.name,
|
|
|
|
})}
|
|
|
|
navigate={`/$/${PAGES.TOP}?name=${claim.name}`}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
</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;
|