add edit-claim button
This commit is contained in:
parent
24e21271a7
commit
73d4f24a5f
3 changed files with 25 additions and 1 deletions
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "selectors/file_info";
|
} from "selectors/file_info";
|
||||||
import { makeSelectIsAvailableForUri } from "selectors/availability";
|
import { makeSelectIsAvailableForUri } from "selectors/availability";
|
||||||
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
||||||
import { doCloseModal, doOpenModal } from "actions/app";
|
import { doCloseModal, doOpenModal, doNavigate } from "actions/app";
|
||||||
import { doFetchAvailability } from "actions/availability";
|
import { doFetchAvailability } from "actions/availability";
|
||||||
import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info";
|
import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info";
|
||||||
import {
|
import {
|
||||||
|
@ -52,6 +52,7 @@ const perform = dispatch => ({
|
||||||
startDownload: uri => dispatch(doPurchaseUri(uri, "affirmPurchase")),
|
startDownload: uri => dispatch(doPurchaseUri(uri, "affirmPurchase")),
|
||||||
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
||||||
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
||||||
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileActions);
|
export default connect(makeSelect, perform)(FileActions);
|
||||||
|
|
|
@ -78,6 +78,7 @@ class FileActions extends React.PureComponent {
|
||||||
loading,
|
loading,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
claimInfo,
|
claimInfo,
|
||||||
|
navigate,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const metadata = fileInfo ? fileInfo.metadata : null,
|
const metadata = fileInfo ? fileInfo.metadata : null,
|
||||||
|
@ -185,6 +186,12 @@ class FileActions extends React.PureComponent {
|
||||||
onClick={() => openInFolder(fileInfo)}
|
onClick={() => openInFolder(fileInfo)}
|
||||||
label={openInFolderMessage}
|
label={openInFolderMessage}
|
||||||
/>
|
/>
|
||||||
|
{claimIsMine &&
|
||||||
|
<DropDownMenuItem
|
||||||
|
key={1}
|
||||||
|
onClick={() => navigate("/publish", { name: fileInfo.name })}
|
||||||
|
label={__("Edit claim")}
|
||||||
|
/>}
|
||||||
<DropDownMenuItem
|
<DropDownMenuItem
|
||||||
key={1}
|
key={1}
|
||||||
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE)}
|
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE)}
|
||||||
|
|
|
@ -187,6 +187,14 @@ class PublishForm extends React.PureComponent {
|
||||||
return !!myClaims.find(claim => claim.name === name);
|
return !!myClaims.find(claim => claim.name === name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleEditClaim() {
|
||||||
|
const isMine = this.myClaimExists();
|
||||||
|
|
||||||
|
if (isMine) {
|
||||||
|
this.handlePrefillClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
topClaimIsMine() {
|
topClaimIsMine() {
|
||||||
const myClaimInfo = this.myClaimInfo();
|
const myClaimInfo = this.myClaimInfo();
|
||||||
const { claimsByUri } = this.props;
|
const { claimsByUri } = this.props;
|
||||||
|
@ -410,8 +418,16 @@ class PublishForm extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
const { name } = this.props.params;
|
||||||
|
|
||||||
this.props.fetchClaimListMine();
|
this.props.fetchClaimListMine();
|
||||||
this._updateChannelList();
|
this._updateChannelList();
|
||||||
|
|
||||||
|
if (name) this.setState({ name });
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.handleEditClaim();
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange() {
|
onFileChange() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue