use switch for modals on splash
This commit is contained in:
parent
df322c573a
commit
e407acb63a
2 changed files with 26 additions and 12 deletions
|
@ -42,6 +42,7 @@ export class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
error: false,
|
error: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(this: any).renderModals = this.renderModals.bind(this);
|
||||||
this.hasRecordedUser = false;
|
this.hasRecordedUser = false;
|
||||||
this.timeout = undefined;
|
this.timeout = undefined;
|
||||||
}
|
}
|
||||||
|
@ -170,26 +171,38 @@ export class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
hasRecordedUser: boolean;
|
hasRecordedUser: boolean;
|
||||||
timeout: ?TimeoutID;
|
timeout: ?TimeoutID;
|
||||||
|
|
||||||
render() {
|
renderModals() {
|
||||||
const { modal } = this.props;
|
const { modal } = this.props;
|
||||||
const { message, details, isRunning, error } = this.state;
|
|
||||||
|
|
||||||
const modalId = modal && modal.id;
|
const modalId = modal && modal.id;
|
||||||
|
|
||||||
|
if (!modalId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (modalId) {
|
||||||
|
case MODALS.INCOMPATIBLE_DAEMON:
|
||||||
|
return <ModalIncompatibleDaemon />;
|
||||||
|
case MODALS.WALLET_UNLOCK:
|
||||||
|
return <ModalWalletUnlock />;
|
||||||
|
case MODALS.UPGRADE:
|
||||||
|
return <ModalUpgrade />;
|
||||||
|
case MODALS.DOWNLOADING:
|
||||||
|
return <ModalDownloading />;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { message, details, isRunning, error } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<LoadScreen message={message} details={details} error={error} />
|
<LoadScreen message={message} details={details} error={error} />
|
||||||
{/* Temp hack: don't show any modals on splash screen daemon is running;
|
{/* Temp hack: don't show any modals on splash screen daemon is running;
|
||||||
daemon doesn't let you quit during startup, so the "Quit" buttons
|
daemon doesn't let you quit during startup, so the "Quit" buttons
|
||||||
in the modals won't work. */}
|
in the modals won't work. */}
|
||||||
{isRunning && (
|
{isRunning && this.renderModals()}
|
||||||
<React.Fragment>
|
|
||||||
{modalId === MODALS.WALLET_UNLOCK && <ModalWalletUnlock />}
|
|
||||||
{modalId === MODALS.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
|
|
||||||
{modalId === MODALS.UPGRADE && <ModalUpgrade />}
|
|
||||||
{modalId === MODALS.DOWNLOADING && <ModalDownloading />}
|
|
||||||
</React.Fragment>
|
|
||||||
)}
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5676,6 +5676,7 @@ lbry-redux@lbryio/lbry-redux#bf83ec3dd8f0417439b2ee4b6bf7b2549c012096:
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
uuid "^3.3.2"
|
||||||
|
|
||||||
lbryinc@lbryio/lbryinc#82308ece97188747adbf6d71d55b6e7a6fa0bd95:
|
lbryinc@lbryio/lbryinc#82308ece97188747adbf6d71d55b6e7a6fa0bd95:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
|
@ -9919,7 +9920,7 @@ uuid@3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
|
||||||
|
|
||||||
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0:
|
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2:
|
||||||
version "3.3.2"
|
version "3.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue