adding 'editing uri' message above title

This commit is contained in:
Travis Eden 2018-10-16 10:33:03 -04:00
parent d9000dda0d
commit 7ed43c645b
4 changed files with 24 additions and 3 deletions

View file

@ -7,9 +7,11 @@ import Row from '@components/Row';
class PublishPreview extends React.Component {
render () {
const { isUpdate, uri } = this.props;
return (
<div>
<Row>
{isUpdate && uri && (<p className='text--extra-small'>{`Editing ${uri}`}</p>)}
<PublishTitleInput />
</Row>
<HorizontalSplit

View file

@ -1,12 +1,21 @@
import {connect} from 'react-redux';
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 {
disabled: publish.disabled,
file : publish.file,
status : publish.status.status,
isUpdate: publish.isUpdate,
uri,
};
};

View file

@ -8,7 +8,7 @@ import { SAVE } from '../../constants/confirmation_messages';
class PublishTool extends React.Component {
render () {
const {disabled, file, isUpdate, status} = this.props;
const {disabled, file, isUpdate, uri, status} = this.props;
if (disabled) {
return (
<PublishDisabledMessage />
@ -25,7 +25,7 @@ class PublishTool extends React.Component {
<Prompt
message={SAVE}
/>
<PublishPreview isUpdate={isUpdate} />
<PublishPreview isUpdate={isUpdate} uri={uri} />
</React.Fragment>
);
}

View 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}`;
};