move edit link from AssetTitle to AssetInfo
This commit is contained in:
parent
4c9608a964
commit
5d3f66d201
4 changed files with 18 additions and 13 deletions
|
@ -6,9 +6,11 @@ const mapStateToProps = (props) => {
|
||||||
const {show} = props;
|
const {show} = props;
|
||||||
// select asset
|
// select asset
|
||||||
const asset = selectAsset(show);
|
const asset = selectAsset(show);
|
||||||
|
const editable = Boolean(props.channel.loggedInChannel.name === asset.claimData.channelName);
|
||||||
// return props
|
// return props
|
||||||
return {
|
return {
|
||||||
asset,
|
asset,
|
||||||
|
editable,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,11 @@ import createCanonicalLink from '../../../../utils/createCanonicalLink';
|
||||||
|
|
||||||
class AssetInfo extends React.Component {
|
class AssetInfo extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
const { asset } = this.props;
|
const { editable, asset } = this.props;
|
||||||
const { claimViews, claimData: { channelName, channelShortId, description, name, fileExt, contentType, thumbnail, host } } = asset;
|
const { claimViews, claimData } = asset;
|
||||||
|
const { channelName, claimId, channelShortId, description, name, fileExt, contentType, host } = claimData;
|
||||||
|
|
||||||
const canonicalUrl = createCanonicalLink({ asset: { ...asset.claimData, shortId: asset.shortId }});
|
const canonicalUrl = createCanonicalLink({ asset: { ...claimData, shortId: asset.shortId }});
|
||||||
const assetCanonicalUrl = `${host}${canonicalUrl}`;
|
const assetCanonicalUrl = `${host}${canonicalUrl}`;
|
||||||
|
|
||||||
let channelCanonicalUrl;
|
let channelCanonicalUrl;
|
||||||
|
@ -29,6 +30,15 @@ class AssetInfo extends React.Component {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
{editable && (
|
||||||
|
<Row>
|
||||||
|
<RowLabeled
|
||||||
|
label={<Label value={'Edit:'} />}
|
||||||
|
content={<Link to={`/edit/${claimId}/${name}`}>{name}</Link>}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
|
)}
|
||||||
|
|
||||||
{channelName && (
|
{channelName && (
|
||||||
<Row>
|
<Row>
|
||||||
<RowLabeled
|
<RowLabeled
|
||||||
|
|
|
@ -3,13 +3,9 @@ import View from './view';
|
||||||
import { selectAsset } from '../../selectors/show';
|
import { selectAsset } from '../../selectors/show';
|
||||||
|
|
||||||
const mapStateToProps = (props) => {
|
const mapStateToProps = (props) => {
|
||||||
const { claimData: { title, claimId, name, channelName } } = selectAsset(props.show);
|
const { claimData: { title } } = selectAsset(props.show);
|
||||||
const editable = Boolean(props.channel.loggedInChannel.name === channelName);
|
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
claimId,
|
|
||||||
name,
|
|
||||||
editable,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,10 @@ import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import Row from '@components/Row';
|
import Row from '@components/Row';
|
||||||
|
|
||||||
const AssetTitle = ({ title, editable, claimId, name }) => {
|
const AssetTitle = ({ title }) => {
|
||||||
return (
|
return (
|
||||||
<Row>
|
<Row>
|
||||||
<h3>
|
<h3>{title}</h3>
|
||||||
{title}
|
|
||||||
{editable && (<span> (<Link to={`/edit/${claimId}/${name}`}>edit</Link>)</span>)}
|
|
||||||
</h3>
|
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue