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 {
|
||||
render () {
|
||||
const { isUpdate, uri } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<Row>
|
||||
{isUpdate && uri && (<p className='text--extra-small'>{`Editing ${uri}`}</p>)}
|
||||
<PublishTitleInput />
|
||||
</Row>
|
||||
<HorizontalSplit
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
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