fix: fix bid help text uri and allow metadata only edits
This commit is contained in:
parent
05e6fbed12
commit
88b2fcc057
3 changed files with 19 additions and 16 deletions
|
@ -7,7 +7,7 @@ type Props = {
|
|||
editingURI: ?string,
|
||||
isResolvingUri: boolean,
|
||||
winningBidForClaimUri: ?number,
|
||||
claimIsMine: ?boolean,
|
||||
myClaimForUri: ?{},
|
||||
onEditMyClaim: any => void,
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ class BidHelpText extends React.PureComponent<Props> {
|
|||
editingURI,
|
||||
isResolvingUri,
|
||||
winningBidForClaimUri,
|
||||
claimIsMine,
|
||||
myClaimForUri,
|
||||
onEditMyClaim,
|
||||
} = this.props;
|
||||
|
||||
|
@ -34,12 +34,12 @@ class BidHelpText extends React.PureComponent<Props> {
|
|||
return __('Checking the winning claim amount...');
|
||||
}
|
||||
|
||||
if (claimIsMine) {
|
||||
if (myClaimForUri) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
{__('You already have a claim at')}
|
||||
{` ${uri} `}
|
||||
<Button button="link" label="Edit it" onClick={onEditMyClaim} />
|
||||
<Button button="link" label="Edit it" onClick={() => onEditMyClaim(myClaimForUri, uri)} />
|
||||
<br />
|
||||
{__('Publishing will update your existing claim.')}
|
||||
</React.Fragment>
|
||||
|
|
|
@ -55,7 +55,7 @@ type Props = {
|
|||
clearPublish: () => void,
|
||||
resolveUri: string => void,
|
||||
scrollToTop: () => void,
|
||||
prepareEdit: ({}) => void,
|
||||
prepareEdit: ({}, uri) => void,
|
||||
};
|
||||
|
||||
class PublishForm extends React.PureComponent<Props> {
|
||||
|
@ -159,10 +159,10 @@ class PublishForm extends React.PureComponent<Props> {
|
|||
updatePublishForm({ bid, bidError });
|
||||
}
|
||||
|
||||
editExistingClaim() {
|
||||
const { myClaimForUri, prepareEdit, scrollToTop } = this.props;
|
||||
editExistingClaim(myClaimForUri: ?{}, uri: string) {
|
||||
const { prepareEdit, scrollToTop } = this.props;
|
||||
if (myClaimForUri) {
|
||||
prepareEdit(myClaimForUri);
|
||||
prepareEdit(myClaimForUri, uri);
|
||||
scrollToTop();
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,8 @@ class PublishForm extends React.PureComponent<Props> {
|
|||
const formDisabled = (!filePath && !editingURI) || publishing;
|
||||
const formValid = this.checkIsFormValid();
|
||||
|
||||
const isStillEditing = editingURI === uri;
|
||||
const simpleUri = uri && uri.split('#')[0];
|
||||
const isStillEditing = editingURI === simpleUri;
|
||||
let submitLabel;
|
||||
if (isStillEditing) {
|
||||
submitLabel = !publishing ? __('Edit') : __('Editing...');
|
||||
|
@ -446,11 +447,11 @@ class PublishForm extends React.PureComponent<Props> {
|
|||
error={nameError}
|
||||
helper={
|
||||
<BidHelpText
|
||||
uri={uri}
|
||||
uri={simpleUri}
|
||||
editingURI={editingURI}
|
||||
isResolvingUri={isResolvingUri}
|
||||
winningBidForClaimUri={winningBidForClaimUri}
|
||||
claimIsMine={!!myClaimForUri}
|
||||
myClaimForUri={myClaimForUri}
|
||||
onEditMyClaim={this.editExistingClaim}
|
||||
/>
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doClaimRewardType } from 'redux/actions/rewards';
|
||||
import { selectMyClaims, selectClaimsByUri } from 'redux/selectors/claims';
|
||||
import { selectResolvingUris } from 'redux/selectors/content';
|
||||
import { selectPublishFormValues } from 'redux/selectors/publish';
|
||||
import { doResolveUri } from 'redux/actions/content';
|
||||
import { selectBalance } from 'redux/selectors/wallet';
|
||||
import { doClearPublish, doUpdatePublishForm, doPublish } from 'redux/actions/publish';
|
||||
import {
|
||||
doClearPublish,
|
||||
doUpdatePublishForm,
|
||||
doPublish,
|
||||
doPrepareEdit,
|
||||
} from 'redux/actions/publish';
|
||||
import { makeSelectCostInfoForUri } from 'redux/selectors/cost_info';
|
||||
import { doPrepareEdit } from 'redux/actions/publish';
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
|
@ -50,7 +52,7 @@ const perform = dispatch => ({
|
|||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
publish: params => dispatch(doPublish(params)),
|
||||
navigate: path => dispatch(doNavigate(path)),
|
||||
prepareEdit: claim => dispatch(doPrepareEdit(claim)),
|
||||
prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(PublishPage);
|
||||
|
|
Loading…
Reference in a new issue