SES-101 Added Login to Signalr on GM #34
@ -4,6 +4,7 @@ import { SignInComponent } from './app/components/sign-in/sign-in.component';
|
|||||||
import { RegistrationComponent } from './app/components/registration/registration.component';
|
import { RegistrationComponent } from './app/components/registration/registration.component';
|
||||||
import {GameMasterDashboardComponent} from './app/components/game-master-dashboard/game-master-dashboard.component';
|
import {GameMasterDashboardComponent} from './app/components/game-master-dashboard/game-master-dashboard.component';
|
||||||
import {PlayerDashboardComponent} from './app/components/player-dashboard/player-dashboard.component';
|
import {PlayerDashboardComponent} from './app/components/player-dashboard/player-dashboard.component';
|
||||||
|
import { SelectCharacterComponent } from './app/components/select-character/select-character.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@ -30,6 +31,11 @@ const routes: Routes = [
|
|||||||
path: 'player',
|
path: 'player',
|
||||||
component: PlayerDashboardComponent,
|
component: PlayerDashboardComponent,
|
||||||
pathMatch: 'full'
|
pathMatch: 'full'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'select-character',
|
||||||
|
component: SelectCharacterComponent,
|
||||||
|
pathMatch: 'full'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import { SignInComponent } from './components/sign-in/sign-in.component';
|
|||||||
import { RegistrationComponent } from './components/registration/registration.component';
|
import { RegistrationComponent } from './components/registration/registration.component';
|
||||||
import { GameMasterDashboardComponent} from './components/game-master-dashboard/game-master-dashboard.component';
|
import { GameMasterDashboardComponent} from './components/game-master-dashboard/game-master-dashboard.component';
|
||||||
import {PlayerDashboardComponent} from './components/player-dashboard/player-dashboard.component';
|
import {PlayerDashboardComponent} from './components/player-dashboard/player-dashboard.component';
|
||||||
|
import { SelectCharacterComponent } from './components/select-character/select-character.component';
|
||||||
import {
|
import {
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
@ -28,7 +29,8 @@ import {UserService} from '../services/user.service';
|
|||||||
SignInComponent,
|
SignInComponent,
|
||||||
RegistrationComponent,
|
RegistrationComponent,
|
||||||
GameMasterDashboardComponent,
|
GameMasterDashboardComponent,
|
||||||
PlayerDashboardComponent
|
PlayerDashboardComponent,
|
||||||
|
SelectCharacterComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
|
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
@import "../../../styles.css";
|
||||||
|
mat-form-field {
|
||||||
|
color: #df7c0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 500px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin: 5%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.container h1 {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
padding: 10px;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-text {
|
||||||
|
height: 100px;
|
||||||
|
color: #df7c0f;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1%;
|
||||||
|
margin: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-to-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 400px) {
|
||||||
|
.container {
|
||||||
|
margin-left: 0%;
|
||||||
|
width: 300px;
|
||||||
|
padding-top: 5%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 401px) {
|
||||||
|
.container {
|
||||||
|
margin-left: 1%;
|
||||||
|
width: 450px;
|
||||||
|
padding-top: 10%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.container {
|
||||||
|
width: 550px;
|
||||||
|
padding-top: 5%;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<div class="container">
|
||||||
|
<mat-icon matSuffix class="arrow-back" (click)="onArrowBackClick()">arrow_back</mat-icon>
|
||||||
|
<div class="primary-text header">Select character</div>
|
||||||
|
<mat-list >
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
<mat-list-item> Oweja
|
||||||
|
<mat-icon matSuffix class="arrow-forward align-to-right" (click)="onCharacterClick()">arrow_forward</mat-icon>
|
||||||
|
</mat-list-item>
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
<mat-list-item> James
|
||||||
|
<mat-icon matSuffix class="arrow-forward align-to-right" (click)="onCharacterClick()">arrow_forward</mat-icon>
|
||||||
|
</mat-list-item>
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
<mat-list-item> Legolas
|
||||||
|
<mat-icon matSuffix class="arrow-forward align-to-right" (click)="onCharacterClick()">arrow_forward</mat-icon>
|
||||||
|
</mat-list-item>
|
||||||
|
<mat-divider></mat-divider>
|
||||||
|
</mat-list>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-select-character',
|
||||||
|
templateUrl: './select-character.component.html',
|
||||||
|
styleUrls: ['./select-character.component.css']
|
||||||
|
})
|
||||||
|
export class SelectCharacterComponent {
|
||||||
|
isExpanded = false;
|
||||||
|
|
||||||
|
collapse() {
|
||||||
|
this.isExpanded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
this.isExpanded = !this.isExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
|
onCharacterClick(){
|
||||||
|
this.router.navigate(['player'])
|
||||||
|
}
|
||||||
|
|
||||||
|
onArrowBackClick(){
|
||||||
|
this.router.navigate(['login'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -57,6 +57,14 @@
|
|||||||
background-color: #df7c0f !important;
|
background-color: #df7c0f !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep mat-list-item {
|
||||||
|
color: #df7c0f !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-divider {
|
||||||
|
border-top-color: #e9cca7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -61,16 +61,16 @@ namespace SessionCompanion.Controllers
|
|||||||
public async Task<Either<SuccessResponse, ErrorResponse>> Register(UserRegisterViewModel userRegisterModel)
|
public async Task<Either<SuccessResponse, ErrorResponse>> Register(UserRegisterViewModel userRegisterModel)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
|
||||||
return new ErrorResponse() { StatusCode = 400, Message = "Given model is incorect" };
|
return new ErrorResponse() { StatusCode = 400, Message = "Given model is incorect" };
|
||||||
}
|
|
||||||
|
if (await _service.SearchUserByUsername(userRegisterModel.Username) is not null)
|
||||||
|
return new ErrorResponse() { StatusCode = 400, Message = "Given user is already registered" };
|
||||||
|
|
||||||
UserViewModel userModel = new UserViewModel()
|
UserViewModel userModel = new UserViewModel()
|
||||||
{
|
{
|
||||||
Password = userRegisterModel.Password,
|
Password = userRegisterModel.Password,
|
||||||
Username = userRegisterModel.Username
|
Username = userRegisterModel.Username
|
||||||
};
|
};
|
||||||
|
|
||||||
await _service.Create(userModel);
|
await _service.Create(userModel);
|
||||||
await _service.SaveAsync();
|
await _service.SaveAsync();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user