From 73f3d28f934d063ab90c7ddceae52ff4f63fe3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Tue, 19 Feb 2019 11:26:30 +0100 Subject: [PATCH] Fix room-joining on landing page --- src/app/app.module.ts | 4 +--- .../home/new-landing/new-landing.component.html | 13 +------------ .../home/new-landing/new-landing.component.scss | 12 ------------ .../home/room-join/room-join.component.html | 15 --------------- .../home/room-join/room-join.component.scss | 0 .../shared/room-join/room-join.component.html | 17 +++++++++++++++++ .../shared/room-join/room-join.component.scss | 11 +++++++++++ .../room-join/room-join.component.spec.ts | 0 .../room-join/room-join.component.ts | 2 +- src/app/components/shared/shared.module.ts | 3 +++ 10 files changed, 34 insertions(+), 43 deletions(-) delete mode 100644 src/app/components/home/room-join/room-join.component.html delete mode 100644 src/app/components/home/room-join/room-join.component.scss create mode 100644 src/app/components/shared/room-join/room-join.component.html create mode 100644 src/app/components/shared/room-join/room-join.component.scss rename src/app/components/{home => shared}/room-join/room-join.component.spec.ts (100%) rename src/app/components/{home => shared}/room-join/room-join.component.ts (95%) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cf0d78fb2..45e7d7d55 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -27,7 +27,6 @@ import { MarkdownService, MarkedOptions } from 'ngx-markdown'; import { NewLandingComponent } from './components/home/new-landing/new-landing.component'; import { RoomCreateComponent } from './components/home/_dialogs/room-create/room-create.component'; import { HomePageComponent } from './components/home/home-page/home-page.component'; -import {RoomJoinComponent} from "./components/home/room-join/room-join.component"; export function dialogClose(dialogResult: any) { } @@ -41,8 +40,7 @@ export function dialogClose(dialogResult: any) { UserActivationComponent, NewLandingComponent, RoomCreateComponent, - HomePageComponent, - RoomJoinComponent + HomePageComponent ], entryComponents: [ RegisterComponent, 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 05795cd9e..28a631e77 100644 --- a/src/app/components/home/new-landing/new-landing.component.html +++ b/src/app/components/home/new-landing/new-landing.component.html @@ -1,16 +1,5 @@ <div fxLayout="column" fxLayoutAlign="center center" fxlayoutgap="50px" fxFill> - <form> - <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> - <mat-form-field class="number"> - <input matInput #roomId placeholder="Join Session!" maxlength="8"/> - <mat-hint align="end">{{roomId.value.length}} / 8</mat-hint> - </mat-form-field> - <button mat-fab color="primary" type="submit" (click)="joinRoom(roomId.value)"> - <mat-icon>input</mat-icon> - </button> - </div> - </form> - <button mat-button class="demo" color="primary" (click)="joinDemo()">Demo Session<mat-icon color="accent">lightbulb_outline</mat-icon></button> + <app-room-join></app-room-join> <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.scss b/src/app/components/home/new-landing/new-landing.component.scss index 6c52bd72d..a342b846b 100644 --- a/src/app/components/home/new-landing/new-landing.component.scss +++ b/src/app/components/home/new-landing/new-landing.component.scss @@ -1,11 +1,3 @@ -.demo { - margin-bottom: 20px; -} - -form { - padding-top: 40px; -} - .fab-extended { width: 75%; height: 50px; @@ -14,10 +6,6 @@ form { font-size: large; } -mat-form-field { - font-size: x-large; -} - .add { transform: scale(1.4); padding-right: 5px; diff --git a/src/app/components/home/room-join/room-join.component.html b/src/app/components/home/room-join/room-join.component.html deleted file mode 100644 index c26e85683..000000000 --- a/src/app/components/home/room-join/room-join.component.html +++ /dev/null @@ -1,15 +0,0 @@ -<form (ngSubmit)="joinRoom(roomId.value)"> - <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> - <mat-form-field class="input-block"> - <input matInput #roomId placeholder="{{ 'home-page.session-id' | translate}}" [formControl]="roomFormControl" - [errorStateMatcher]="matcher" maxlength="8"/> - <mat-hint align="end">{{roomId.value.length}} / 8</mat-hint> - <mat-error *ngIf="roomFormControl.hasError('required')">{{ 'home-page.please-enter' | translate}}</mat-error> - <mat-error *ngIf="roomFormControl.hasError('minlength')">{{ 'home-page.exactly-8' | translate}}</mat-error> - </mat-form-field> - <button mat-fab color="primary" type="submit"> - <mat-icon>input</mat-icon> - </button> - </div> -</form> -<button mat-button color="primary" (click)="joinDemo()">{{ 'home-page.join-demo-session' | translate}}<mat-icon color="accent">lightbulb_outline</mat-icon></button> diff --git a/src/app/components/home/room-join/room-join.component.scss b/src/app/components/home/room-join/room-join.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/app/components/shared/room-join/room-join.component.html b/src/app/components/shared/room-join/room-join.component.html new file mode 100644 index 000000000..857edf781 --- /dev/null +++ b/src/app/components/shared/room-join/room-join.component.html @@ -0,0 +1,17 @@ +<div fxLayout="column" fxLayoutAlign="center center" fxlayoutgap="50px" fxFill> +<form (ngSubmit)="joinRoom(roomId.value)"> + <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> + <mat-form-field class="number"> + <input matInput #roomId placeholder="Join Session!" [formControl]="roomFormControl" + [errorStateMatcher]="matcher" maxlength="8"/> + <mat-hint align="end">{{roomId.value.length}} / 8</mat-hint> + <mat-error *ngIf="roomFormControl.hasError('required')">{{ 'home-page.please-enter' | translate}}</mat-error> + <mat-error *ngIf="roomFormControl.hasError('minlength')">{{ 'home-page.exactly-8' | translate}}</mat-error> + </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" (click)="joinDemo()">Demo Session<mat-icon color="accent">lightbulb_outline</mat-icon></button> +</div> diff --git a/src/app/components/shared/room-join/room-join.component.scss b/src/app/components/shared/room-join/room-join.component.scss new file mode 100644 index 000000000..62749754d --- /dev/null +++ b/src/app/components/shared/room-join/room-join.component.scss @@ -0,0 +1,11 @@ +mat-form-field { + font-size: x-large; +} + +form { + padding-top: 40px; +} + +.demo { + margin-bottom: 20px; +} diff --git a/src/app/components/home/room-join/room-join.component.spec.ts b/src/app/components/shared/room-join/room-join.component.spec.ts similarity index 100% rename from src/app/components/home/room-join/room-join.component.spec.ts rename to src/app/components/shared/room-join/room-join.component.spec.ts diff --git a/src/app/components/home/room-join/room-join.component.ts b/src/app/components/shared/room-join/room-join.component.ts similarity index 95% rename from src/app/components/home/room-join/room-join.component.ts rename to src/app/components/shared/room-join/room-join.component.ts index 259cc449e..b639d76c7 100644 --- a/src/app/components/home/room-join/room-join.component.ts +++ b/src/app/components/shared/room-join/room-join.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Room } from '../../../models/room'; import { RoomService } from '../../../services/http/room.service'; import { Router } from '@angular/router'; -import { RegisterErrorStateMatcher } from '../_dialogs/register/register.component'; +import { RegisterErrorStateMatcher } from '../../home/_dialogs/register/register.component'; import { FormControl, FormGroupDirective, NgForm, Validators } from '@angular/forms'; import { ErrorStateMatcher } from '@angular/material'; import { NotificationService } from '../../../services/util/notification.service'; diff --git a/src/app/components/shared/shared.module.ts b/src/app/components/shared/shared.module.ts index bed6abd81..9f5382f51 100644 --- a/src/app/components/shared/shared.module.ts +++ b/src/app/components/shared/shared.module.ts @@ -18,6 +18,7 @@ import { SharedRoutingModule } from './shared-routing.module'; import { ListStatisticComponent } from './list-statistic/list-statistic.component'; import { ChartsModule } from 'ng2-charts'; import { StatisticComponent } from './statistic/statistic.component'; +import { RoomJoinComponent } from './room-join/room-join.component'; @NgModule({ imports: [ @@ -27,6 +28,7 @@ import { StatisticComponent } from './statistic/statistic.component'; SharedRoutingModule ], declarations: [ + RoomJoinComponent, PageNotFoundComponent, RoomPageComponent, RoomListComponent, @@ -45,6 +47,7 @@ import { StatisticComponent } from './statistic/statistic.component'; StatisticComponent ], exports: [ + RoomJoinComponent, PageNotFoundComponent, RoomPageComponent, RoomListComponent, -- GitLab