pausing during partial refactor
This commit is contained in:
parent
ff12ff3d36
commit
bdf84b3dbd
12 changed files with 108 additions and 62 deletions
|
@ -299,7 +299,7 @@ export function doLoadVideo(uri) {
|
|||
data: { uri },
|
||||
});
|
||||
|
||||
dispatch(doOpenModal("timedOut"));
|
||||
dispatch(doOpenModal(modals.FILE_TIMEOUT));
|
||||
} else {
|
||||
dispatch(doDownloadFile(uri, streamInfo));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { selectPlatform, selectCurrentModal } from "selectors/app";
|
||||
import { selectPlatform } from "selectors/app";
|
||||
import {
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectDownloadingForUri,
|
||||
|
@ -8,13 +8,10 @@ import {
|
|||
} from "selectors/file_info";
|
||||
import { makeSelectIsAvailableForUri } from "selectors/availability";
|
||||
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
||||
import { doCloseModal, doOpenModal } from "actions/app";
|
||||
import { doOpenModal } from "actions/app";
|
||||
import { doFetchAvailability } from "actions/availability";
|
||||
import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info";
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimForUriIsMine,
|
||||
} from "selectors/claims";
|
||||
import { makeSelectClaimForUriIsMine } from "selectors/claims";
|
||||
import { doPurchaseUri, doLoadVideo, doStartDownload } from "actions/content";
|
||||
import { doNavigate } from "actions/navigation";
|
||||
import FileActions from "./view";
|
||||
|
@ -26,19 +23,16 @@ const makeSelect = () => {
|
|||
const selectCostInfoForUri = makeSelectCostInfoForUri();
|
||||
const selectLoadingForUri = makeSelectLoadingForUri();
|
||||
const selectClaimForUriIsMine = makeSelectClaimForUriIsMine();
|
||||
const selectClaimForUri = makeSelectClaimForUri();
|
||||
|
||||
const select = (state, props) => ({
|
||||
fileInfo: selectFileInfoForUri(state, props),
|
||||
/*availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix*/
|
||||
isAvailable: true, //selectIsAvailableForUri(state, props),
|
||||
platform: selectPlatform(state),
|
||||
modal: selectCurrentModal(state),
|
||||
downloading: selectDownloadingForUri(state, props),
|
||||
costInfo: selectCostInfoForUri(state, props),
|
||||
loading: selectLoadingForUri(state, props),
|
||||
claimIsMine: selectClaimForUriIsMine(state, props),
|
||||
claimInfo: selectClaimForUri(state, props),
|
||||
});
|
||||
|
||||
return select;
|
||||
|
@ -46,7 +40,6 @@ const makeSelect = () => {
|
|||
|
||||
const perform = dispatch => ({
|
||||
checkAvailability: uri => dispatch(doFetchAvailability(uri)),
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
openInFolder: fileInfo => dispatch(doOpenFileInFolder(fileInfo)),
|
||||
openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)),
|
||||
openModal: modal => dispatch(doOpenModal(modal)),
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import React from "react";
|
||||
import { Icon, BusyMessage } from "component/common";
|
||||
import FilePrice from "component/filePrice";
|
||||
import { Modal } from "modal/modal";
|
||||
import Link from "component/link";
|
||||
import { ToolTip } from "component/tooltip";
|
||||
import { DropDownMenu, DropDownMenuItem } from "component/menu";
|
||||
import ModalRemoveFile from "modal/modalRemoveFile";
|
||||
import * as modals from "constants/modal_types";
|
||||
|
||||
class FileActions extends React.PureComponent {
|
||||
|
@ -70,15 +67,11 @@ class FileActions extends React.PureComponent {
|
|||
uri,
|
||||
openInFolder,
|
||||
openInShell,
|
||||
modal,
|
||||
openModal,
|
||||
closeModal,
|
||||
startDownload,
|
||||
costInfo,
|
||||
loading,
|
||||
claimIsMine,
|
||||
claimInfo,
|
||||
navigate,
|
||||
editClaim,
|
||||
} = this.props;
|
||||
|
||||
|
@ -204,33 +197,7 @@ class FileActions extends React.PureComponent {
|
|||
</DropDownMenu>
|
||||
</div>
|
||||
: ""}
|
||||
<Modal
|
||||
type="confirm"
|
||||
isOpen={modal == "affirmPurchase"}
|
||||
contentLabel={__("Confirm Purchase")}
|
||||
onConfirmed={this.onAffirmPurchase.bind(this)}
|
||||
onAborted={closeModal}
|
||||
>
|
||||
{__("This will purchase")} <strong>{title}</strong> {__("for")}{" "}
|
||||
<strong>
|
||||
<FilePrice uri={uri} showFullPrice={true} look="plain" />
|
||||
</strong>{" "}
|
||||
{__("credits")}.
|
||||
</Modal>
|
||||
<Modal
|
||||
isOpen={modal == "timedOut"}
|
||||
contentLabel={__("Download failed")}
|
||||
onConfirmed={closeModal}
|
||||
>
|
||||
{__("LBRY was unable to download the stream")}{" "}{" "}
|
||||
<strong>{title}</strong>.
|
||||
</Modal>
|
||||
{modal == modals.CONFIRM_FILE_REMOVE &&
|
||||
<ModalRemoveFile
|
||||
uri={uri}
|
||||
outpoint={fileInfo.outpoint}
|
||||
title={title}
|
||||
/>}
|
||||
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -87,13 +87,6 @@ class VideoPlayButton extends React.PureComponent {
|
|||
</strong>{" "}
|
||||
{__("credits")}.
|
||||
</Modal>
|
||||
<Modal
|
||||
isOpen={modal == "timedOut"}
|
||||
onConfirmed={closeModal}
|
||||
contentLabel={__("Timed Out")}
|
||||
>
|
||||
{__("Sorry, your download timed out :(")}
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export const CONFIRM_FILE_REMOVE = "confirmFileRemove";
|
||||
export const INCOMPATIBLE_DAEMON = "incompatibleDaemon";
|
||||
export const FILE_TIMEOUT = "file_timeout";
|
||||
export const DOWNLOADING = "downloading";
|
||||
export const ERROR = "error";
|
||||
export const INSUFFICIENT_CREDITS = "insufficient_credits";
|
||||
|
@ -10,4 +11,5 @@ export const AUTHENTICATION_FAILURE = "auth_failure";
|
|||
export const TRANSACTION_FAILED = "transaction_failed";
|
||||
export const INSUFFICIENT_BALANCE = "insufficient_balance";
|
||||
export const REWARD_APPROVAL_REQUIRED = "reward_approval_required";
|
||||
export const AFFIRM_PURCHASE = "affirm_purchase";
|
||||
export const CREDIT_INTRO = "credit_intro";
|
||||
|
|
15
ui/js/modal/modalAffirmPurchase/index.js
Normal file
15
ui/js/modal/modalAffirmPurchase/index.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { doCloseModal } from "actions/app";
|
||||
import { makeSelectMetadataForUri } from "selectors/claims";
|
||||
import ModalAffirmPurchase from "./view";
|
||||
|
||||
const select = state => ({
|
||||
metadata: makeSelectMetadataForUri()(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalAffirmPurchase);
|
27
ui/js/modal/modalAffirmPurchase/view.jsx
Normal file
27
ui/js/modal/modalAffirmPurchase/view.jsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React from "react";
|
||||
import FilePrice from "component/filePrice";
|
||||
import { Modal } from "modal/modal";
|
||||
|
||||
class ModalAffirmPurchase extends React.PureComponent {
|
||||
render() {
|
||||
const { metadata: { title } } = this.props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
type="confirm"
|
||||
isOpen={modal == "affirmPurchase"}
|
||||
contentLabel={__("Confirm Purchase")}
|
||||
onConfirmed={this.onAffirmPurchase.bind(this)}
|
||||
onAborted={closeModal}
|
||||
>
|
||||
{__("This will purchase")} <strong>{title}</strong> {__("for")}{" "}
|
||||
<strong>
|
||||
<FilePrice uri={uri} showFullPrice={true} look="plain" />
|
||||
</strong>{" "}
|
||||
{__("credits")}.
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ModalAffirmPurchase;
|
15
ui/js/modal/modalFileTimeout/index.js
Normal file
15
ui/js/modal/modalFileTimeout/index.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { doCloseModal } from "actions/app";
|
||||
import { makeSelectMetadataForUri } from "selectors/claims";
|
||||
import ModalFileTimeout from "./view";
|
||||
|
||||
const select = state => ({
|
||||
metadata: makeSelectMetadataForUri()(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalFileTimeout);
|
21
ui/js/modal/modalFileTimeout/view.jsx
Normal file
21
ui/js/modal/modalFileTimeout/view.jsx
Normal file
|
@ -0,0 +1,21 @@
|
|||
import React from "react";
|
||||
import { Modal } from "modal/modal";
|
||||
|
||||
class ModalFileTimeout extends React.PureComponent {
|
||||
render() {
|
||||
const { metadata: { title } } = this.props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen={true}
|
||||
contentLabel={__("Download failed")}
|
||||
onConfirmed={closeModal}
|
||||
>
|
||||
{__("LBRY was unable to download the stream")}{" "}
|
||||
<strong>{title}</strong>.
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ModalFileTimeout;
|
|
@ -5,16 +5,14 @@ import { doDeleteFileAndGoBack } from "actions/file_info";
|
|||
import { makeSelectClaimForUriIsMine } from "selectors/claims";
|
||||
|
||||
import ModalRemoveFile from "./view";
|
||||
import { makeSelectFileInfoForUri } from "../../selectors/file_info";
|
||||
|
||||
const makeSelect = () => {
|
||||
const selectClaimForUriIsMine = makeSelectClaimForUriIsMine();
|
||||
|
||||
const select = (state, props) => ({
|
||||
claimIsMine: selectClaimForUriIsMine(state, props),
|
||||
});
|
||||
|
||||
return select;
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claimIsMine: makeSelectClaimForUriIsMine()(state, props),
|
||||
uri: makeSelectCurrentParam("uri")(state, props),
|
||||
metadata: makeSelectMetadataForUri()(state, props),
|
||||
outpoint: makeSelectFileInfoForUri()(state, props),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
|
@ -23,4 +21,4 @@ const perform = dispatch => ({
|
|||
},
|
||||
});
|
||||
|
||||
export default connect(makeSelect, perform)(ModalRemoveFile);
|
||||
export default connect(select, perform)(ModalRemoveFile);
|
||||
|
|
|
@ -10,6 +10,8 @@ import ModalRewardApprovalRequired from "modal/modalRewardApprovalRequired";
|
|||
import ModalCreditIntro from "modal/modalCreditIntro";
|
||||
import ModalTransactionFailed from "modal/modalTransactionFailed";
|
||||
import ModalInsufficientBalance from "modal/modalInsufficientBalance";
|
||||
import ModalFileTimeout from "modal/modalFileTimeout";
|
||||
import ModalAffirmPurchase from "modal/modalAffirmPurchase";
|
||||
import * as modals from "constants/modal_types";
|
||||
|
||||
class ModalRouter extends React.PureComponent {
|
||||
|
@ -107,6 +109,8 @@ class ModalRouter extends React.PureComponent {
|
|||
return <ModalDownloading />;
|
||||
case modals.ERROR:
|
||||
return <ModalError />;
|
||||
case modals.FILE_TIMEOUT:
|
||||
return <ModalFileTimeout />;
|
||||
case modals.INSUFFICIENT_CREDITS:
|
||||
return <ModalInsufficientCredits />;
|
||||
case modals.WELCOME:
|
||||
|
@ -123,6 +127,10 @@ class ModalRouter extends React.PureComponent {
|
|||
return <ModalInsufficientBalance />;
|
||||
case modals.REWARD_APPROVAL_REQUIRED:
|
||||
return <ModalRewardApprovalRequired />;
|
||||
case modals.CONFIRM_FILE_REMOVE:
|
||||
return <ModalRemoveFile />;
|
||||
case modals.AFFIRM_PURCHASE:
|
||||
return <ModalAffirmPurchase />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,13 @@ export const selectCurrentParams = createSelector(selectCurrentPath, path => {
|
|||
return parseQueryParams(path.split("?")[1]);
|
||||
});
|
||||
|
||||
export const makeSelectCurrentParam = param => {
|
||||
return createSelector(
|
||||
selectCurrentParams,
|
||||
params => (params ? params[param] : undefined)
|
||||
);
|
||||
};
|
||||
|
||||
export const selectHeaderLinks = createSelector(selectCurrentPage, page => {
|
||||
// This contains intentional fall throughs
|
||||
switch (page) {
|
||||
|
|
Loading…
Add table
Reference in a new issue