Merge pull request 'SES-139 added dialog on character click in gm screen' (#62) from SES-139 into dev

Reviewed-on: #62
This commit is contained in:
Natalia Gawron 2021-01-10 17:45:53 +01:00
commit 0d3ee36121
6 changed files with 58 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import {
MatPaginatorModule,
MatTableModule,
MatSortModule,
MatDialogModule,
} from '@angular/material';
import { UserService } from '../services/user.service';
import { StoreModule } from '@ngrx/store';
@ -35,6 +36,7 @@ import { CharacterService } from '../services/character.service';
import { AbilityCardComponent } from './components/ability-card/ability-card.component';
import { GameMasterSpellsTableComponent } from './components/game-master-spells-table/game-master-spells-table.component';
import { GameMasterArmorsTableComponent } from './components/game-master-armors-table/game-master-armors-table.component';
import { GameMasterCharacterActionsDialogComponent } from './components/game-master-character-actions-dialog/game-master-character-actions-dialog.component';
import { GameMasterWeaponsTableComponent } from './components/game-master-weapons-table/game-master-weapons-table.component';
import { AbilitiesComponent } from './components/abilities/abilities.component';
@ -50,6 +52,7 @@ import { AbilitiesComponent } from './components/abilities/abilities.component';
AbilityCardComponent,
GameMasterSpellsTableComponent,
GameMasterArmorsTableComponent,
GameMasterCharacterActionsDialogComponent,
],
imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
@ -68,6 +71,7 @@ import { AbilitiesComponent } from './components/abilities/abilities.component';
MatSidenavModule,
MatToolbarModule,
MatListModule,
MatDialogModule,
MatPaginatorModule,
StoreModule.forRoot(reducers),
StoreDevtoolsModule.instrument({
@ -83,6 +87,7 @@ import { AbilitiesComponent } from './components/abilities/abilities.component';
GameMasterArmorsTableComponent,
GameMasterWeaponsTableComponent,
AbilitiesComponent,
GameMasterCharacterActionsDialogComponent,
],
})
export class AppModule {}

View File

@ -0,0 +1,12 @@
.character-dialog-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::ng-deep .mat-dialog-container {
background-color: #4a5867;
color: whitesmoke;
box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2),
0 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 5px 20px 4px #d8d8d8;
}

View File

@ -0,0 +1,5 @@
<h1 mat-dialog-title class="character-dialog-title">
{{characterName}}
</h1>
<div mat-dialog-content>
</div>

View File

@ -0,0 +1,22 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({
selector: 'app-game-master-character-actions-dialog',
templateUrl: './game-master-character-actions-dialog.component.html',
styleUrls: ['./game-master-character-actions-dialog.component.css'],
})
export class GameMasterCharacterActionsDialogComponent implements OnInit {
characterId: number;
characterName: string;
constructor(
public dialogRef: MatDialogRef<GameMasterCharacterActionsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
ngOnInit() {
this.characterId = this.data.characterid;
this.characterName = this.data.characterName;
}
}

View File

@ -79,7 +79,7 @@
</div>
<mat-divider></mat-divider>
<mat-nav-list>
<mat-list-item *ngFor="let loggedCharacter of loggedCharacters">
<mat-list-item *ngFor="let loggedCharacter of loggedCharacters" (click)="OpenCharacterDialog(loggedCharacter.id, loggedCharacter.name)">
<mat-icon
svgIcon="{{ loggedCharacter.class.toLowerCase() }}"
mat-list-icon

View File

@ -13,6 +13,8 @@ import { first } from 'rxjs/operators';
import { LeftNavItem } from '../../../types/LeftNavItem';
import { GameMasterSpellsTableComponent } from '../game-master-spells-table/game-master-spells-table.component';
import { GameMasterArmorsTableComponent } from '../game-master-armors-table/game-master-armors-table.component';
import { MatDialog } from '@angular/material';
import { GameMasterCharacterActionsDialogComponent } from '../game-master-character-actions-dialog/game-master-character-actions-dialog.component';
import { GameMasterWeaponsTableComponent } from '../game-master-weapons-table/game-master-weapons-table.component';
@Component({
@ -60,7 +62,8 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy {
constructor(
private signalRService: GMSignalRService,
private characterService: CharacterService
private characterService: CharacterService,
public dialog: MatDialog
) {
this.SubscribeToEvents();
}
@ -103,6 +106,15 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy {
);
}
public OpenCharacterDialog(characterid: number, characterName: string) {
const dialogRef = this.dialog.open(
GameMasterCharacterActionsDialogComponent,
{
data: { characterid: characterid, characterName: characterName },
}
);
}
ChangeMiddleComponent(componentName: string): void {
switch (componentName) {
case 'GameMasterSpellsTableComponent':