Only connect to snapcast when enabled; App placeholder

This commit is contained in:
James Barnsley
2018-04-03 17:01:40 +12:00
parent 94431d4b8a
commit 5b8ad5ece9
8 changed files with 28052 additions and 26037 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -25,11 +25,37 @@
<!-- Raven Sentry -->
<script src="https://cdn.ravenjs.com/3.17.0/raven.min.js" crossorigin="anonymous"></script>
<!-- Loading screen -->
<style>
#app-loading {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
color: #FFFFFF;
background-color: #121212;
}
#app-loading .logo {
width: 80%;
max-width: 160px;
margin: 0 auto;
height: 100%;
background-image: url('/iris/assets/logo-app-512.png');
background-position: 50% 50%;
background-size: contain;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="app">
<!-- ReactJS application here -->
<!-- ReactJS app gets injected here, replacing the loader -->
<div id="app-loading">
<div class="logo"></div>
</div>
</div>
</body>
@ -38,7 +64,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1522638235";
var build = "1522699992";
var version = "3.16.0";
// Construct the script tag

View File

@ -25,11 +25,37 @@
<!-- Raven Sentry -->
<script src="https://cdn.ravenjs.com/3.17.0/raven.min.js" crossorigin="anonymous"></script>
<!-- Loading screen -->
<style>
#app-loading {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
color: #FFFFFF;
background-color: #121212;
}
#app-loading .logo {
width: 80%;
max-width: 160px;
margin: 0 auto;
height: 100%;
background-image: url('/iris/assets/logo-app-512.png');
background-position: 50% 50%;
background-size: contain;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="app">
<!-- ReactJS application here -->
<!-- ReactJS app gets injected here, replacing the loader -->
<div id="app-loading">
<div class="logo"></div>
</div>
</div>
</body>

View File

@ -93,7 +93,8 @@ class App extends React.Component{
}
// Scroll to bottom, only if we've PUSHed to a new route
if (nextProps.location.action == 'PUSH'){
// We also prevent scroll reset for any sub_view routes (like tabs, services, etc)
if (nextProps.location.action == 'PUSH' && nextProps.params.sub_view === undefined){
window.scrollTo(0, 0);
}
}

View File

@ -32,11 +32,7 @@ class Snapcast extends React.Component{
componentWillReceiveProps(newProps){
// Just connected
if (!this.props.pusher_connected && newProps.pusher_connected){
this.props.pusherActions.getSnapcast();
// Just enabled (well, identified as being enabled)
} else if (!this.props.pusher_enabled && newProps.pusher_enabled && newProps.pusher_connected){
if (newProps.snapcast_enabled && !this.props.pusher_connected && newProps.pusher_connected){
this.props.pusherActions.getSnapcast();
}
}
@ -47,8 +43,20 @@ class Snapcast extends React.Component{
}
render(){
if (!this.props.snapcast_enabled){
return (
<div>
To enable Snapcast, edit your <code>mopidy.conf</code> file
</div>
)
}
if (!this.props.snapcast_clients || !this.props.snapcast_groups){
return null;
return (
<div className="lazy-loader body-loader loading">
<div className="loader"></div>
</div>
)
}
// Construct a simple array of our groups index

View File

@ -62,7 +62,7 @@ ReactDOM.render(
<Route path="queue" component={Queue} />
<Route path="queue/history" component={QueueHistory} />
<Route path="settings/debug" component={Debug} />
<Route path="settings(/service/:service)" component={Settings} />
<Route path="settings(/service/:sub_view)" component={Settings} />
<Route path="search(/:query)" component={Search} />
<Route path="album/:uri" component={Album} />

View File

@ -225,7 +225,7 @@ class Settings extends React.Component {
</form>
<h4 className="underline">Services</h4>
<Services active={this.props.params.service} />
<Services active={this.props.params.sub_view} />
<h4 className="underline">Advanced</h4>