Merge pull request 'SES-75 added router into sign-in page' (#13) from SES-75 into master

Reviewed-on: #13
This commit is contained in:
Łukasz Góreczny 2020-12-06 08:59:07 +01:00
commit b6a80a2e89
6 changed files with 39 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { SelectRoleComponent } from './app/components/select-role/select-role.component'; import { SelectRoleComponent } from './app/components/select-role/select-role.component';
import { SignInComponent } from './app/components/sign-in/sign-in.component';
const routes: Routes = [ const routes: Routes = [
{ {
@ -7,6 +8,11 @@ const routes: Routes = [
component: SelectRoleComponent, component: SelectRoleComponent,
pathMatch: 'full' pathMatch: 'full'
}, },
{
path: 'login',
component: SignInComponent,
pathMatch: 'full'
},
]; ];
export const appRoutingModule = RouterModule.forRoot(routes); export const appRoutingModule = RouterModule.forRoot(routes);

View File

@ -8,14 +8,16 @@ import { appRoutingModule } from '../app.routing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { SignInComponent } from './components/sign-in/sign-in.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
SelectRoleComponent, SelectRoleComponent,
SignInComponent
], ],
imports: [ imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
HttpClientModule, HttpClientModule,
FormsModule, FormsModule,
appRoutingModule, appRoutingModule,

View File

@ -1,4 +1,4 @@
<div class="container font"> <div class="container font">
<button id="player-button" class="button font">Player</button> <button (click)="SignInWithRole()" id="player-button" class="button font">Player</button>
<button id="game-master-button" class="button font">Game Master</button> <button (click)="SignInWithRole()" id="game-master-button" class="button font">Game Master</button>
</div> </div>

View File

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { SignInComponent } from './../sign-in/sign-in.component';
@Component({ @Component({
selector: 'app-select-role', selector: 'app-select-role',
@ -8,10 +10,16 @@ import { Component } from '@angular/core';
export class SelectRoleComponent { export class SelectRoleComponent {
isExpanded = false; isExpanded = false;
constructor(private router: Router) {}
collapse() { collapse() {
this.isExpanded = false; this.isExpanded = false;
} }
SignInWithRole() {
this.router.navigate(['login'])
}
toggle() { toggle() {
this.isExpanded = !this.isExpanded; this.isExpanded = !this.isExpanded;
} }

View File

@ -0,0 +1,19 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@ngrx/store": {
"version": "10.1.0",
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/@ngrx/store/-/store-10.1.0.tgz",
"integrity": "sha1-N5qjhUP//T5ByoYiQ0oXH+cO1vg=",
"requires": {
"tslib": "^2.0.0"
}
},
"tslib": {
"version": "2.0.3",
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha1-jgdBrEX8DCJuWKF7/D5kubxsphw="
}
}
}