From b2b4f0d70838ef0b84e25a00b2464e5c37842162 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 12:34:30 +0100
Subject: [PATCH] Add new landing-page component to try new design

---
 src/app/app.module.ts                         |  9 +++-
 .../home/login-page/login-page.component.html |  5 ++-
 .../new-landing/new-landing.component.html    | 23 +++++++++++
 .../new-landing/new-landing.component.scss    | 12 ++++++
 .../new-landing/new-landing.component.spec.ts | 25 +++++++++++
 .../home/new-landing/new-landing.component.ts | 41 +++++++++++++++++++
 .../shared/header/header.component.html       |  3 ++
 7 files changed, 114 insertions(+), 4 deletions(-)
 create mode 100644 src/app/components/home/new-landing/new-landing.component.html
 create mode 100644 src/app/components/home/new-landing/new-landing.component.scss
 create mode 100644 src/app/components/home/new-landing/new-landing.component.spec.ts
 create mode 100644 src/app/components/home/new-landing/new-landing.component.ts

diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index a93f5b1b5..88468b8ff 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -24,6 +24,8 @@ import { BrowserModule } from '@angular/platform-browser';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { LanguageService } from './services/util/language.service';
 import { MarkdownService, MarkedOptions } from 'ngx-markdown';
+import { NewLandingComponent } from './components/home/new-landing/new-landing.component';
+import { RoomCreateComponent } from './components/creator/_dialogs/room-create/room-create.component';
 export function dialogClose(dialogResult: any) {
 }
 
@@ -34,12 +36,15 @@ export function dialogClose(dialogResult: any) {
     LoginComponent,
     PasswordResetComponent,
     RegisterComponent,
-    UserActivationComponent
+    UserActivationComponent,
+    NewLandingComponent,
+    RoomCreateComponent
   ],
   entryComponents: [
     RegisterComponent,
     PasswordResetComponent,
-    UserActivationComponent
+    UserActivationComponent,
+    RoomCreateComponent
   ],
   imports: [
     AppRoutingModule,
diff --git a/src/app/components/home/login-page/login-page.component.html b/src/app/components/home/login-page/login-page.component.html
index 0ff5ac236..32297bade 100644
--- a/src/app/components/home/login-page/login-page.component.html
+++ b/src/app/components/home/login-page/login-page.component.html
@@ -13,7 +13,7 @@
       <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="20px" fxFill>
           <div fxLayout="row" fxLayoutAlign="center">
             <mat-card class="inner">
-            <mat-tab-group class="login-tab-group">
+            <!-- <mat-tab-group class="login-tab-group">
              <mat-tab label="{{ 'login-page.creator' | translate }}">
                 <div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px">
                   <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="5px">
@@ -36,7 +36,8 @@
                 <button mat-raised-button class="pwButton" color="primary" (click)="openPasswordDialog()">
                  {{ 'login-page.password-reset' | translate }}
                 </button>
-              </div>
+              </div> -->
+              <app-new-landing></app-new-landing>
             </mat-card>
           </div>
         </div>
diff --git a/src/app/components/home/new-landing/new-landing.component.html b/src/app/components/home/new-landing/new-landing.component.html
new file mode 100644
index 000000000..127652857
--- /dev/null
+++ b/src/app/components/home/new-landing/new-landing.component.html
@@ -0,0 +1,23 @@
+<div fxLayout="column" fxLayoutAlign="center center" fxlayoutgap="50px" fxFill>
+  <form>
+    <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px">
+      <mat-form-field class="input-block">
+        <input matInput #roomId placeholder="Join Session!" maxlength="8" [matAutocomplete]="auto"/>
+        <mat-hint align="end">{{roomId.value.length}} / 8</mat-hint>
+        <mat-autocomplete #auto="matAutocomplete">
+          <mat-option *ngFor="let session of sessions" [value]="session.id">
+            {{session.name}}
+          </mat-option>
+        </mat-autocomplete>
+      </mat-form-field>
+      <button mat-fab color="primary" type="submit">
+        <mat-icon>input</mat-icon>
+      </button>
+    </div>
+  </form>
+  <button mat-button class="demo" color="primary">Demo Session<mat-icon color="accent">lightbulb_outline</mat-icon></button>
+    <button mat-fab  color="accent" (click)="openCreateRoomDialog()">
+      <mat-icon>add</mat-icon>
+    </button>
+  <h3>Neue Session erstellen!</h3>
+</div>
diff --git a/src/app/components/home/new-landing/new-landing.component.scss b/src/app/components/home/new-landing/new-landing.component.scss
new file mode 100644
index 000000000..6348c9435
--- /dev/null
+++ b/src/app/components/home/new-landing/new-landing.component.scss
@@ -0,0 +1,12 @@
+.demo {
+  margin-bottom: 40px;
+}
+
+form {
+  padding-top: 40px;
+}
+
+h3 {
+  color: #4db6ac;
+  text-align: center;
+}
diff --git a/src/app/components/home/new-landing/new-landing.component.spec.ts b/src/app/components/home/new-landing/new-landing.component.spec.ts
new file mode 100644
index 000000000..d663781f6
--- /dev/null
+++ b/src/app/components/home/new-landing/new-landing.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { NewLandingComponent } from './new-landing.component';
+
+describe('NewLandingComponent', () => {
+  let component: NewLandingComponent;
+  let fixture: ComponentFixture<NewLandingComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ NewLandingComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(NewLandingComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/app/components/home/new-landing/new-landing.component.ts b/src/app/components/home/new-landing/new-landing.component.ts
new file mode 100644
index 000000000..71985809e
--- /dev/null
+++ b/src/app/components/home/new-landing/new-landing.component.ts
@@ -0,0 +1,41 @@
+import { Component, OnInit } from '@angular/core';
+import { RoomCreateComponent } from '../../creator/_dialogs/room-create/room-create.component';
+import { MatDialog } from '@angular/material';
+import { RoomService } from '../../../services/http/room.service';
+import { ActivatedRoute, Router } from '@angular/router';
+import { Room } from '../../../models/room';
+
+export class Session {
+  name: string;
+  id: number;
+
+  constructor(name: string, id: number) {
+    this.id = id;
+    this.name = name;
+  }
+}
+
+@Component({
+  selector: 'app-new-landing',
+  templateUrl: './new-landing.component.html',
+  styleUrls: ['./new-landing.component.scss']
+})
+export class NewLandingComponent implements OnInit {
+
+  sessions: Session[] = new Array<Session>();
+
+  constructor(public dialog: MatDialog) {
+  }
+
+  ngOnInit() {
+    this.sessions[0] = new Session('Angular', 98299243);
+    this.sessions[1] = new Session('Typescript', 52009627);
+    this.sessions[2] = new Session('Angular', 48590407);
+  }
+
+  openCreateRoomDialog(): void {
+    this.dialog.open(RoomCreateComponent, {
+      width: '350px'
+    });
+  }
+}
diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html
index 68eee7c5a..655b2452b 100644
--- a/src/app/components/shared/header/header.component.html
+++ b/src/app/components/shared/header/header.component.html
@@ -23,6 +23,9 @@
         <span>{{ 'header.logout' | translate }}</span>
       </button>
     </mat-menu>
+    <button mat-icon-button>
+      <mat-icon>account_box</mat-icon>
+    </button>
     <button mat-icon-button *ngIf="user" [matMenuTriggerFor]="appMenu">
       <mat-icon *ngIf="user.role === 1" aria-label="Example icon-button with a heart icon" color="accent">record_voice_over</mat-icon>
       <mat-icon *ngIf="user.role === 0" aria-label="Example icon-button with a heart icon" color="accent">supervisor_account</mat-icon>
-- 
GitLab