add edit-claim button

This commit is contained in:
btzr-io 2017-08-25 20:09:56 -06:00 committed by Jeremy Kauffman
parent 24e21271a7
commit 73d4f24a5f
3 changed files with 25 additions and 1 deletions

View file

@ -8,7 +8,7 @@ import {
} from "selectors/file_info";
import { makeSelectIsAvailableForUri } from "selectors/availability";
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 { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info";
import {
@ -52,6 +52,7 @@ const perform = dispatch => ({
startDownload: uri => dispatch(doPurchaseUri(uri, "affirmPurchase")),
loadVideo: uri => dispatch(doLoadVideo(uri)),
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
navigate: (path, params) => dispatch(doNavigate(path, params)),
});
export default connect(makeSelect, perform)(FileActions);

View file

@ -78,6 +78,7 @@ class FileActions extends React.PureComponent {
loading,
claimIsMine,
claimInfo,
navigate,
} = this.props;
const metadata = fileInfo ? fileInfo.metadata : null,
@ -185,6 +186,12 @@ class FileActions extends React.PureComponent {
onClick={() => openInFolder(fileInfo)}
label={openInFolderMessage}
/>
{claimIsMine &&
<DropDownMenuItem
key={1}
onClick={() => navigate("/publish", { name: fileInfo.name })}
label={__("Edit claim")}
/>}
<DropDownMenuItem
key={1}
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE)}

View file

@ -187,6 +187,14 @@ class PublishForm extends React.PureComponent {
return !!myClaims.find(claim => claim.name === name);
}
handleEditClaim() {
const isMine = this.myClaimExists();
if (isMine) {
this.handlePrefillClicked();
}
}
topClaimIsMine() {
const myClaimInfo = this.myClaimInfo();
const { claimsByUri } = this.props;
@ -410,8 +418,16 @@ class PublishForm extends React.PureComponent {
}
componentWillMount() {
const { name } = this.props.params;
this.props.fetchClaimListMine();
this._updateChannelList();
if (name) this.setState({ name });
}
componentDidMount() {
this.handleEditClaim();
}
onFileChange() {