adds LBRY and Permanent URLS to info component #801

Merged
jessopb merged 1 commit from AssetInfo into master 2018-12-03 22:58:15 +01:00
Showing only changes of commit 267db2d614 - Show all commits

View file

@ -2,22 +2,20 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Label from '@components/Label'; import Label from '@components/Label';
import RowLabeled from '@components/RowLabeled'; import RowLabeled from '@components/RowLabeled';
import Row from '@components/Row';
import SpaceBetween from '@components/SpaceBetween'; import SpaceBetween from '@components/SpaceBetween';
import AssetShareButtons from '@components/AssetShareButtons'; import AssetShareButtons from '@components/AssetShareButtons';
import ClickToCopy from '@components/ClickToCopy'; import ClickToCopy from '@components/ClickToCopy';
import HorizontalSplit from '@components/HorizontalSplit'; import HorizontalSplit from '@components/HorizontalSplit';
import siteConfig from '@config/siteConfig.json'; import siteConfig from '@config/siteConfig.json';
const { details: { host } } = siteConfig;
import createCanonicalLink from '../../../../utils/createCanonicalLink'; import createCanonicalLink from '../../../../utils/createCanonicalLink';
import AssetInfoFooter from '../../components/AssetInfoFooter/index'; import AssetInfoFooter from '../../components/AssetInfoFooter/index';
const { details: { host } } = siteConfig;
class AssetInfo extends React.Component { class AssetInfo extends React.Component {
render () { render () {
const { editable, asset } = this.props; const { editable, asset } = this.props;
const { claimViews, claimData } = asset; const { claimViews, claimData } = asset;
const { channelName, claimId, channelShortId, description, name, fileExt, contentType, host } = claimData; const { channelName, claimId, channelShortId, description, name, fileExt, contentType, host, certificateId } = claimData;
const canonicalUrl = createCanonicalLink({ asset: { ...claimData, shortId: asset.shortId }}); const canonicalUrl = createCanonicalLink({ asset: { ...claimData, shortId: asset.shortId }});
const assetCanonicalUrl = `${host}${canonicalUrl}`; const assetCanonicalUrl = `${host}${canonicalUrl}`;
@ -25,7 +23,7 @@ class AssetInfo extends React.Component {
let channelCanonicalUrl; let channelCanonicalUrl;
if (channelName) { if (channelName) {
const channel = { const channel = {
name: channelName, name : channelName,
shortId: channelShortId, shortId: channelShortId,
}; };
channelCanonicalUrl = `${createCanonicalLink({channel})}`; channelCanonicalUrl = `${createCanonicalLink({channel})}`;
@ -116,6 +114,18 @@ class AssetInfo extends React.Component {
} }
/> />
<RowLabeled
label={
<Label value={'ID for Robots'} />
}
content={
<ClickToCopy
id={'short-link'}
value={`${channelName}#${certificateId}/${name}`}
/>
}
/>
<SpaceBetween> <SpaceBetween>
<a <a
className='link--primary' className='link--primary'
@ -130,6 +140,13 @@ class AssetInfo extends React.Component {
> >
Download Download
</a> </a>
<a
className={'link--primary'}
href={`https://open.lbry.io/${channelName}#${certificateId}/${name}`}
download={name}
>
LBRY URL
</a>
<a <a
className={'link--primary'} className={'link--primary'}
target='_blank' target='_blank'
@ -140,10 +157,10 @@ class AssetInfo extends React.Component {
</SpaceBetween> </SpaceBetween>
</div> </div>
} /> } />
<AssetInfoFooter/> <AssetInfoFooter />
</div> </div>
); );
} }
}; };
export default AssetInfo; export default AssetInfo;