adding 'editing uri' message above title
This commit is contained in:
parent
d9000dda0d
commit
7ed43c645b
4 changed files with 24 additions and 3 deletions
|
@ -7,9 +7,11 @@ import Row from '@components/Row';
|
||||||
|
|
||||||
class PublishPreview extends React.Component {
|
class PublishPreview extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
|
const { isUpdate, uri } = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Row>
|
<Row>
|
||||||
|
{isUpdate && uri && (<p className='text--extra-small'>{`Editing ${uri}`}</p>)}
|
||||||
<PublishTitleInput />
|
<PublishTitleInput />
|
||||||
</Row>
|
</Row>
|
||||||
<HorizontalSplit
|
<HorizontalSplit
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import View from './view';
|
import View from './view';
|
||||||
|
import {selectAsset} from "../../selectors/show";
|
||||||
|
import {buildURI} from "../../utils/buildURI";
|
||||||
|
|
||||||
const mapStateToProps = ({ publish }) => {
|
const mapStateToProps = props => {
|
||||||
|
const { show, publish } = props;
|
||||||
|
const asset = selectAsset(show);
|
||||||
|
let uri;
|
||||||
|
if (asset) {
|
||||||
|
uri = `lbry://${buildURI(asset)}`;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
disabled: publish.disabled,
|
disabled: publish.disabled,
|
||||||
file : publish.file,
|
file : publish.file,
|
||||||
status : publish.status.status,
|
status : publish.status.status,
|
||||||
isUpdate: publish.isUpdate,
|
isUpdate: publish.isUpdate,
|
||||||
|
uri,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { SAVE } from '../../constants/confirmation_messages';
|
||||||
|
|
||||||
class PublishTool extends React.Component {
|
class PublishTool extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
const {disabled, file, isUpdate, status} = this.props;
|
const {disabled, file, isUpdate, uri, status} = this.props;
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return (
|
return (
|
||||||
<PublishDisabledMessage />
|
<PublishDisabledMessage />
|
||||||
|
@ -25,7 +25,7 @@ class PublishTool extends React.Component {
|
||||||
<Prompt
|
<Prompt
|
||||||
message={SAVE}
|
message={SAVE}
|
||||||
/>
|
/>
|
||||||
<PublishPreview isUpdate={isUpdate} />
|
<PublishPreview isUpdate={isUpdate} uri={uri} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
10
client/src/utils/buildURI.js
Normal file
10
client/src/utils/buildURI.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export const buildURI = asset => {
|
||||||
|
let channelName, certificateId, name, claimId;
|
||||||
|
if (asset.claimData) {
|
||||||
|
({ channelName, certificateId, name, claimId } = asset.claimData);
|
||||||
|
}
|
||||||
|
if (channelName) {
|
||||||
|
return `${channelName}:${certificateId}/${name}`;
|
||||||
|
}
|
||||||
|
return `${claimId}/${name}`;
|
||||||
|
};
|
Loading…
Reference in a new issue