Merge branch 'file_edit' into v16
This commit is contained in:
commit
8b47b8e71d
6 changed files with 58 additions and 12 deletions
|
@ -9,6 +9,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
* Added a tipping button to send LBRY Credits to the publisher
|
* Added a tipping button to send LBRY Credits to the publisher
|
||||||
|
* Added edit button on published content / improved UX for editing claims.
|
||||||
* File pages now show the time of a publish.
|
* File pages now show the time of a publish.
|
||||||
* The "auth token" displayable on Help offers security warning
|
* The "auth token" displayable on Help offers security warning
|
||||||
* Added a new component for rendering dates and times. This component can render the date and time of a block height, as well.
|
* Added a new component for rendering dates and times. This component can render the date and time of a block height, as well.
|
||||||
|
|
|
@ -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));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -10,11 +10,8 @@ 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 { 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";
|
||||||
|
|
||||||
|
@ -52,6 +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)),
|
||||||
|
editClaim: fileInfo => dispatch(doEditClaim(fileInfo)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileActions);
|
export default connect(makeSelect, perform)(FileActions);
|
||||||
|
|
|
@ -78,8 +78,13 @@ class FileActions extends React.PureComponent {
|
||||||
loading,
|
loading,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
claimInfo,
|
claimInfo,
|
||||||
|
navigate,
|
||||||
|
editClaim,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const name = fileInfo ? fileInfo.name : null;
|
||||||
|
const channel = fileInfo ? fileInfo.channel_name : null;
|
||||||
|
|
||||||
const metadata = fileInfo ? fileInfo.metadata : null,
|
const metadata = fileInfo ? fileInfo.metadata : null,
|
||||||
openInFolderMessage = platform.startsWith("Mac")
|
openInFolderMessage = platform.startsWith("Mac")
|
||||||
? __("Open in Finder")
|
? __("Open in Finder")
|
||||||
|
@ -185,6 +190,12 @@ class FileActions extends React.PureComponent {
|
||||||
onClick={() => openInFolder(fileInfo)}
|
onClick={() => openInFolder(fileInfo)}
|
||||||
label={openInFolderMessage}
|
label={openInFolderMessage}
|
||||||
/>
|
/>
|
||||||
|
{claimIsMine &&
|
||||||
|
<DropDownMenuItem
|
||||||
|
key={1}
|
||||||
|
onClick={() => editClaim({ name, channel })}
|
||||||
|
label={__("Edit claim")}
|
||||||
|
/>}
|
||||||
<DropDownMenuItem
|
<DropDownMenuItem
|
||||||
key={1}
|
key={1}
|
||||||
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE)}
|
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE)}
|
||||||
|
|
|
@ -48,6 +48,7 @@ class PublishForm extends React.PureComponent {
|
||||||
isFee: false,
|
isFee: false,
|
||||||
customUrl: false,
|
customUrl: false,
|
||||||
source: null,
|
source: null,
|
||||||
|
mode: "publish",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +188,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;
|
||||||
|
@ -226,6 +235,7 @@ class PublishForm extends React.PureComponent {
|
||||||
name: "",
|
name: "",
|
||||||
uri: "",
|
uri: "",
|
||||||
prefillDone: false,
|
prefillDone: false,
|
||||||
|
mode: "publish",
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -247,6 +257,7 @@ class PublishForm extends React.PureComponent {
|
||||||
rawName: rawName,
|
rawName: rawName,
|
||||||
name: name,
|
name: name,
|
||||||
prefillDone: false,
|
prefillDone: false,
|
||||||
|
mode: "publish",
|
||||||
uri,
|
uri,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -275,6 +286,7 @@ class PublishForm extends React.PureComponent {
|
||||||
} = claimInfo.value.stream.metadata;
|
} = claimInfo.value.stream.metadata;
|
||||||
|
|
||||||
let newState = {
|
let newState = {
|
||||||
|
mode: "edit",
|
||||||
meta_title: title,
|
meta_title: title,
|
||||||
meta_thumbnail: thumbnail,
|
meta_thumbnail: thumbnail,
|
||||||
meta_description: description,
|
meta_description: description,
|
||||||
|
@ -375,6 +387,7 @@ class PublishForm extends React.PureComponent {
|
||||||
|
|
||||||
handleChannelChange(channelName) {
|
handleChannelChange(channelName) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
mode: "publish",
|
||||||
channel: channelName,
|
channel: channelName,
|
||||||
});
|
});
|
||||||
const nameChanged = () => this.nameChanged(this.state.rawName);
|
const nameChanged = () => this.nameChanged(this.state.rawName);
|
||||||
|
@ -410,8 +423,20 @@ class PublishForm extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
let { name, channel } = this.props.params;
|
||||||
|
|
||||||
|
channel = channel || this.state.channel;
|
||||||
|
|
||||||
this.props.fetchClaimListMine();
|
this.props.fetchClaimListMine();
|
||||||
this._updateChannelList();
|
this._updateChannelList();
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
this.setState({ name, rawName: name, channel });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.handleEditClaim();
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileChange() {
|
onFileChange() {
|
||||||
|
@ -455,7 +480,7 @@ class PublishForm extends React.PureComponent {
|
||||||
<span>
|
<span>
|
||||||
{__("You already have a claim with this name.")}{" "}
|
{__("You already have a claim with this name.")}{" "}
|
||||||
<Link
|
<Link
|
||||||
label={__("Use data from my existing claim")}
|
label={__("Edit existing claim")}
|
||||||
onClick={() => this.handlePrefillClicked()}
|
onClick={() => this.handlePrefillClicked()}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
@ -493,10 +518,18 @@ class PublishForm extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { mode, submitting } = this.state;
|
||||||
|
|
||||||
const lbcInputHelp = __(
|
const lbcInputHelp = __(
|
||||||
"This LBC remains yours and the deposit can be undone at any time."
|
"This LBC remains yours and the deposit can be undone at any time."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let submitLabel = !submitting ? __("Publish") : __("Publishing...");
|
||||||
|
|
||||||
|
if (mode === "edit") {
|
||||||
|
submitLabel = !submitting ? __("Update") : __("Updating...");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="main--single-column">
|
<main className="main--single-column">
|
||||||
<form
|
<form
|
||||||
|
@ -839,9 +872,7 @@ class PublishForm extends React.PureComponent {
|
||||||
<div className="card-series-submit">
|
<div className="card-series-submit">
|
||||||
<Link
|
<Link
|
||||||
button="primary"
|
button="primary"
|
||||||
label={
|
label={submitLabel}
|
||||||
!this.state.submitting ? __("Publish") : __("Publishing...")
|
|
||||||
}
|
|
||||||
onClick={event => {
|
onClick={event => {
|
||||||
this.handleSubmit(event);
|
this.handleSubmit(event);
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -53,8 +53,7 @@ const selectClaimForUriIsMine = (state, props) => {
|
||||||
const uri = lbryuri.normalize(props.uri);
|
const uri = lbryuri.normalize(props.uri);
|
||||||
const claim = selectClaimsByUri(state)[uri];
|
const claim = selectClaimsByUri(state)[uri];
|
||||||
const myClaims = selectMyClaimsRaw(state);
|
const myClaims = selectMyClaimsRaw(state);
|
||||||
|
return myClaims && myClaims.has(claim.claim_id);
|
||||||
return myClaims.has(claim.claim_id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const makeSelectClaimForUriIsMine = () => {
|
export const makeSelectClaimForUriIsMine = () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue