From 72d98767c6322f6ee82774f4048803a42b5e13ac Mon Sep 17 00:00:00 2001 From: btzr-io Date: Mon, 4 Sep 2017 21:03:28 -0600 Subject: [PATCH] add and use editClaim action --- ui/js/actions/file_info.js | 8 +++++++- ui/js/component/fileActions/index.js | 10 +++------- ui/js/component/fileActions/view.jsx | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ui/js/actions/file_info.js b/ui/js/actions/file_info.js index 7d9d102c6..7f4f103a0 100644 --- a/ui/js/actions/file_info.js +++ b/ui/js/actions/file_info.js @@ -13,7 +13,7 @@ import { selectTotalDownloadProgress, } from "selectors/file_info"; import { doCloseModal } from "actions/app"; -import { doHistoryBack } from "actions/navigation"; +import { doNavigate, doHistoryBack } from "actions/navigation"; import setProgressBar from "util/setProgressBar"; import batchActions from "util/batchActions"; @@ -155,3 +155,9 @@ export function doFetchFileInfosAndPublishedClaims() { if (!isFetchingFileInfo) dispatch(doFileList()); }; } + +export function doEditClaim(fileInfo) { + return function(dispatch, getState) { + dispatch(doNavigate("/publish", fileInfo)); + }; +} diff --git a/ui/js/component/fileActions/index.js b/ui/js/component/fileActions/index.js index 75e884cc2..179493408 100644 --- a/ui/js/component/fileActions/index.js +++ b/ui/js/component/fileActions/index.js @@ -9,13 +9,9 @@ import { import { makeSelectIsAvailableForUri } from "selectors/availability"; import { makeSelectCostInfoForUri } from "selectors/cost_info"; import { doCloseModal, doOpenModal } from "actions/app"; -import { doNavigate } from "actions/navigation"; import { doFetchAvailability } from "actions/availability"; -import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info"; -import { - makeSelectClaimForUriIsMine, - makeSelectClaimForUri, -} from "selectors/claims"; +import { doOpenFileInShell, doOpenFileInFolder, doEditClaim, } from "actions/file_info"; +import { makeSelectClaimForUri,makeSelectClaimForUriIsMine } from "selectors/claims"; import { doPurchaseUri, doLoadVideo, doStartDownload } from "actions/content"; import FileActions from "./view"; @@ -53,7 +49,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)), + editClaim: fileInfo => dispatch(doEditClaim(fileInfo)), }); export default connect(makeSelect, perform)(FileActions); diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index cf6db5680..2012ec409 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -79,6 +79,7 @@ class FileActions extends React.PureComponent { claimIsMine, claimInfo, navigate, + editClaim, } = this.props; const name = fileInfo ? fileInfo.name : null; @@ -192,7 +193,7 @@ class FileActions extends React.PureComponent { {claimIsMine && navigate("/publish", { name, channel })} + onClick={() => editClaim({ name, channel })} label={__("Edit claim")} />}