Skip to content

Commit

Permalink
feat: minor usage improvements in root component
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Jan 19, 2020
1 parent ea062ec commit 8bacc7f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<mat-icon>translate</mat-icon>
angular-t9n
</a>
<a mat-button matTooltip="Dashboard" routerLink="/">
<mat-icon>home</mat-icon>
</a>
<span class="separator"></span>
<mat-icon
class="service-down-error"
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

main {
opacity: 0.5;
pointer-events: none;
}
}

Expand Down
14 changes: 12 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, HostBinding } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';

import { TranslationService } from './core/translation.service';

Expand All @@ -10,7 +11,16 @@ import { TranslationService } from './core/translation.service';
export class AppComponent {
@HostBinding('class.service-down') serviceDown = false;

constructor(translationService: TranslationService) {
translationService.serviceDown.subscribe(a => (this.serviceDown = a));
constructor(translationService: TranslationService, snackbar: MatSnackBar) {
translationService.serviceDown.subscribe(a => {
this.serviceDown = a;
if (a) {
snackbar.open(
`Translation server is not available. Start the server in the console with the command 'ng run yourProject:t9n'`,
undefined,
{ duration: 2500 }
);
}
});
}
}

0 comments on commit 8bacc7f

Please sign in to comment.