add and use editClaim action

This commit is contained in:
btzr-io 2017-09-04 21:03:28 -06:00 committed by Jeremy Kauffman
parent 7766b6db28
commit 72d98767c6
3 changed files with 12 additions and 9 deletions

View file

@ -13,7 +13,7 @@ import {
selectTotalDownloadProgress, selectTotalDownloadProgress,
} from "selectors/file_info"; } from "selectors/file_info";
import { doCloseModal } from "actions/app"; import { doCloseModal } from "actions/app";
import { doHistoryBack } from "actions/navigation"; import { doNavigate, doHistoryBack } from "actions/navigation";
import setProgressBar from "util/setProgressBar"; import setProgressBar from "util/setProgressBar";
import batchActions from "util/batchActions"; import batchActions from "util/batchActions";
@ -155,3 +155,9 @@ export function doFetchFileInfosAndPublishedClaims() {
if (!isFetchingFileInfo) dispatch(doFileList()); if (!isFetchingFileInfo) dispatch(doFileList());
}; };
} }
export function doEditClaim(fileInfo) {
return function(dispatch, getState) {
dispatch(doNavigate("/publish", fileInfo));
};
}

View file

@ -9,13 +9,9 @@ import {
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 } from "actions/app";
import { doNavigate } from "actions/navigation";
import { doFetchAvailability } from "actions/availability"; import { doFetchAvailability } from "actions/availability";
import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info"; import { doOpenFileInShell, doOpenFileInFolder, doEditClaim, } from "actions/file_info";
import { import { makeSelectClaimForUri,makeSelectClaimForUriIsMine } from "selectors/claims";
makeSelectClaimForUriIsMine,
makeSelectClaimForUri,
} from "selectors/claims";
import { doPurchaseUri, doLoadVideo, doStartDownload } from "actions/content"; import { doPurchaseUri, doLoadVideo, doStartDownload } from "actions/content";
import FileActions from "./view"; import FileActions from "./view";
@ -53,7 +49,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)), editClaim: fileInfo => dispatch(doEditClaim(fileInfo)),
}); });
export default connect(makeSelect, perform)(FileActions); export default connect(makeSelect, perform)(FileActions);

View file

@ -79,6 +79,7 @@ class FileActions extends React.PureComponent {
claimIsMine, claimIsMine,
claimInfo, claimInfo,
navigate, navigate,
editClaim,
} = this.props; } = this.props;
const name = fileInfo ? fileInfo.name : null; const name = fileInfo ? fileInfo.name : null;
@ -192,7 +193,7 @@ class FileActions extends React.PureComponent {
{claimIsMine && {claimIsMine &&
<DropDownMenuItem <DropDownMenuItem
key={1} key={1}
onClick={() => navigate("/publish", { name, channel })} onClick={() => editClaim({ name, channel })}
label={__("Edit claim")} label={__("Edit claim")}
/>} />}
<DropDownMenuItem <DropDownMenuItem