Seperate electron and web target building

This commit is contained in:
Farkas József
2017-01-20 02:03:27 +01:00
committed by József Farkas
parent 517aed1b1c
commit 983eb72892
276 changed files with 2154 additions and 95 deletions

View File

@@ -0,0 +1,2 @@
export { MacroNotFoundComponent } from './macro-not-found.component';
export { MacroNotFoundGuard } from './macro-not-found-guard.service';

View File

@@ -0,0 +1,30 @@
import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/let';
import 'rxjs/add/operator/map';
import { Store } from '@ngrx/store';
import { AppState } from '../../../store/index';
import { getMacroEntities } from '../../../store/reducers';
@Injectable()
export class MacroNotFoundGuard implements CanActivate {
constructor(private store: Store<AppState>, private router: Router) { }
canActivate(): Observable<boolean> {
return this.store
.let(getMacroEntities())
.map(macros => {
const hasMacros = macros.length > 0;
if (hasMacros) {
this.router.navigate(['/macro', macros[0].id]);
}
return !hasMacros;
});
}
}

View File

@@ -0,0 +1,3 @@
<div class="not-found">
You don't have any macros. Try to add one!
</div>

View File

@@ -0,0 +1,5 @@
.not-found {
margin-top: 30px;
font-size: 16px;
text-align: center;
}

View File

@@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'macro-not-found',
template: require('./macro-not-found.component.html'),
styles: [require('./macro-not-found.component.scss')]
})
export class MacroNotFoundComponent { }