Skip to content

Commit

Permalink
feat(client): delete loading screen
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jun 16, 2019
1 parent 3b27a1c commit 05230b8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"react": "16.8.6",
"react-dom": "16.8.6",
"react-icons": "^3.6.1",
"react-loading": "2.0.3",
"react-sidebar": "3.0.2",
"remark-emoji": "^2.0.2",
"remote-origin-url": "2.0.0",
Expand Down
35 changes: 19 additions & 16 deletions src/client/src/components/AppContainer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { MdMenu } from 'react-icons/md';
import { Loader } from './Loader';
import { Base } from './ContentView/Base';
import { router } from '../router';
import { setup as setupWebSlides } from '../setup/webSlides';
Expand All @@ -18,7 +17,6 @@ export class AppContainer extends React.Component {

this.state = {
opened: false, // TODO: refactor to `status: {}`
loader: true,
SidebarComponent: null, // for lazy load
isSidebar: true,
slideInfo: {
Expand All @@ -43,7 +41,23 @@ export class AppContainer extends React.Component {
}
}

setupWS = () => {
if (!window.slide) {
window.slide = setupWebSlides();

this.updateSlideState(this.state.slideInfo.index);
window.slide.el.addEventListener('ws:slide-change', (e) => {
console.log(e.detail.currentSlide0);
this.updateSlideState(e.detail.currentSlide0);
});
}
};

async componentDidMount() {
if (this.mode !== 'view') {
this.setupWS();
}

this.changeSidebarState();

const slides = AppContainer.createProps(this.props.slides);
Expand Down Expand Up @@ -115,25 +129,15 @@ export class AppContainer extends React.Component {
}

if (this.mode === 'host') {
this.setState({ loader: false, opened: false });
} else {
this.setState({ opened: false });
} else if (this.mode === 'view') {
await new Promise((resolve) => {
setTimeout(() => {
this.setState({ loader: false, opened: false });
this.setupWS();
resolve();
}, 500);
});
}

if (!window.slide) {
window.slide = setupWebSlides();

this.updateSlideState(this.state.slideInfo.index);

window.slide.el.addEventListener('ws:slide-change', (e) => {
this.updateSlideState(e.detail.currentSlide0);
});
}
}

goTo = (num) => {
Expand Down Expand Up @@ -185,7 +189,6 @@ export class AppContainer extends React.Component {
<MdMenu className="btn-sidebar" onClick={() => this.onSetSidebarOpen(true)} />
</>
)}
<Loader displayed={this.state.loader} />
{this.ContentComponent && (
<this.ContentComponent
slides={this.state.slides}
Expand Down
8 changes: 0 additions & 8 deletions src/client/src/components/Loader.js

This file was deleted.

0 comments on commit 05230b8

Please sign in to comment.