From 6dfd0519f33c74588e25ddd2c253e26dba8e9da5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Tue, 12 Feb 2019 22:27:47 +0100
Subject: [PATCH] Add demo-joining

---
 .../components/home/new-landing/new-landing.component.html | 2 +-
 .../components/home/new-landing/new-landing.component.ts   | 7 +++++++
 src/app/components/shared/room-join/room-join.component.ts | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/app/components/home/new-landing/new-landing.component.html b/src/app/components/home/new-landing/new-landing.component.html
index 0ef05f5c9..05795cd9e 100644
--- a/src/app/components/home/new-landing/new-landing.component.html
+++ b/src/app/components/home/new-landing/new-landing.component.html
@@ -10,7 +10,7 @@
       </button>
     </div>
   </form>
-  <button mat-button class="demo" color="primary">Demo Session<mat-icon color="accent">lightbulb_outline</mat-icon></button>
+  <button mat-button class="demo" color="primary" (click)="joinDemo()">Demo Session<mat-icon color="accent">lightbulb_outline</mat-icon></button>
     <button mat-fab class="fab-extended" color="accent" (click)="openCreateRoomDialog()">
       <mat-icon class="add">add</mat-icon>
       Create Session
diff --git a/src/app/components/home/new-landing/new-landing.component.ts b/src/app/components/home/new-landing/new-landing.component.ts
index 35116f0dc..ed2468db5 100644
--- a/src/app/components/home/new-landing/new-landing.component.ts
+++ b/src/app/components/home/new-landing/new-landing.component.ts
@@ -14,6 +14,7 @@ import { Router } from '@angular/router';
 export class NewLandingComponent implements OnInit {
 
   user: User;
+  demoId = 88992370;
 
   constructor(public authenticationService: AuthenticationService,
               private router: Router,
@@ -30,6 +31,10 @@ export class NewLandingComponent implements OnInit {
     });
   }
 
+  joinDemo() {
+    this.joinRoom(this.demoId);
+  }
+
   joinRoom(id: number) {
     if (!this.user) {
       this.authenticationService.guestLogin(UserRole.PARTICIPANT).subscribe(loggedIn => {
@@ -37,6 +42,8 @@ export class NewLandingComponent implements OnInit {
           this.router.navigate([`/participant/room/${id}`]);
         }
       });
+    } else {
+      this.router.navigate([`/participant/room/${id}`]);
     }
   }
 }
diff --git a/src/app/components/shared/room-join/room-join.component.ts b/src/app/components/shared/room-join/room-join.component.ts
index e018ee7de..62c27ad94 100644
--- a/src/app/components/shared/room-join/room-join.component.ts
+++ b/src/app/components/shared/room-join/room-join.component.ts
@@ -24,7 +24,7 @@ export class JoinErrorStateMatcher implements ErrorStateMatcher {
 export class RoomJoinComponent implements OnInit {
 
   room: Room;
-  demoId = '26973546';
+  demoId = '26973546'; // online 95680586, change before merging
 
   roomFormControl = new FormControl('', [Validators.required, Validators.minLength(8)]);
 
-- 
GitLab