Skip to content

Commit

Permalink
Dreamview: updated loading page for the dreamview in offline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vlin17 authored and ycool committed Dec 18, 2017
1 parent 29ba038 commit 778f459
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class MainView extends React.Component {

if (hmi.showNavigationMap) {
return <Navigation height={sceneDimension.height}/>;
} else if (!isInitialized) {
} else if (!isInitialized && !OFFLINE_PLAYBACK) {
return <Loader height={sceneDimension.height}/>;
} else {
return <SceneView />;
Expand Down
9 changes: 9 additions & 0 deletions modules/dreamview/frontend/src/components/Offlineview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { inject, observer } from "mobx-react";
import Header from "components/Header";
import MainView from "components/Layouts/MainView";
import ToolView from "components/Layouts/ToolView";
import Loader from "components/common/Loader";
import WS from "store/websocket";


Expand Down Expand Up @@ -34,6 +35,14 @@ export default class Dreamview extends React.Component {
render() {
const { isInitialized, dimension, sceneDimension, options, hmi } = this.props.store;

if (!isInitialized) {
return (
<div className="offlineview">
<Loader extraClasses="offline-loader"/>
</div>
);
}

return (
<div className="offlineview">
<MainView />
Expand Down
15 changes: 10 additions & 5 deletions modules/dreamview/frontend/src/components/common/Loader.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import React from "react";

import classNames from "classnames";

import RENDERER from "renderer";
import loaderImg from "assets/images/logo_apollo.png";
import loaderGif from "assets/images/loader_apollo.gif";


export default class Loader extends React.Component {
render() {
const { height } = this.props;
const message = OFFLINE_PLAYBACK ? "" : "Please send car initial position and map data.";
const { height, extraClasses } = this.props;
const message = OFFLINE_PLAYBACK
? "Loading ...." : "Please send car initial position and map data.";
const imgSrc = OFFLINE_PLAYBACK ? loaderGif : loaderImg;

return (
<div className="loader" style={{height: height}}>
<div className="img-container">
<img src={loaderImg} alt="Loader"/>
<div className="loader"style={{height: height}}>
<div className={classNames("img-container", extraClasses)}>
<img src={imgSrc} alt="Loader"/>
<div className="status-message">{message}</div>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions modules/dreamview/frontend/src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,8 @@ body {
flex: 0 0 auto;

position: relative;
width: 100%;
height: 100%;
background-color: #000C17;

.img-container {
Expand Down Expand Up @@ -1171,6 +1173,17 @@ body {
}
}
}

.offline-loader {
width: 80%;

.status-message {
position: relative;
top: -80px;

font-size: 3.5vw;
}
}
}

.video {
Expand Down
2 changes: 1 addition & 1 deletion modules/dreamview/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
// first, and then file-loader.
//
// Now you can import images just like js.
test: /\.(png|jpe?g|svg|mp4|mov)$/i,
test: /\.(png|jpe?g|svg|mp4|mov|gif)$/i,
use: [
{
loader: "file-loader",
Expand Down
2 changes: 1 addition & 1 deletion modules/dreamview/frontend/webpack.offline.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = {
// first, and then file-loader.
//
// Now you can import images just like js.
test: /\.(png|jpe?g|svg|mp4|mov)$/i,
test: /\.(png|jpe?g|svg|mp4|mov|gif)$/i,
use: [
{
loader: "file-loader",
Expand Down

0 comments on commit 778f459

Please sign in to comment.