From 0bfa571e242c944b02b8eb5079478df0a57e2918 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Mon, 15 Jul 2019 16:46:40 +0200
Subject: [PATCH] Add help (doc) button in navbar when calculators list is
 empty

---
 src/app/app.component.html |  3 +++
 src/app/app.component.scss | 10 ++++++++++
 src/app/app.component.ts   |  4 ++++
 3 files changed, 17 insertions(+)

diff --git a/src/app/app.component.html b/src/app/app.component.html
index 6bdcbc2af..e3245eb0a 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -56,6 +56,9 @@
     <button *ngIf="currentRoute != '/list'" mat-icon-button id="new-calculator" routerLink="/list" (click)="sidenav.close()">
       <mat-icon>add_box</mat-icon>
     </button>
+    <a *ngIf="enableHeaderDoc" target="_blank" id="header-doc" href="/assets/docs-fr/index.html" (click)="sidenav.close()">
+      <mat-icon>help</mat-icon>
+    </a>
 
     <mat-progress-bar *ngIf="showProgressBar" color="accent" id="loading-progress-bar"
       [mode]="progressBarMode" [value]="progessBarValue">
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index 0a4cebf95..25a2b9e34 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -55,6 +55,16 @@ button:focus {
     }
 }
 
+#header-doc {
+    color: white;
+    transform: scale(1.4);
+    margin-top: 10px;
+
+    &:focus {
+        outline: 0;
+    }
+}
+
 #tabs-container {
     width: 100%;
 }
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index a4f44c3d2..0624e3f47 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -272,6 +272,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
     this.progressBarDeterminate = ! show;
   }
 
+  public get enableHeaderDoc() {
+    return this.currentRoute === "/list" && this._calculators.length === 0;
+  }
+
   // interface Observer
 
   update(sender: any, data: any): void {
-- 
GitLab