From b43720cab85eef9f628f50a7fb9ffa5a2187cbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C3=B3reczny?= Date: Sat, 9 Jan 2021 15:12:53 +0100 Subject: [PATCH] SES-138 added table with armor in gm screen --- .../ClientApp/src/app/app.module.ts | 7 ++- .../game-master-armors-table.component.css | 32 +++++++++++ .../game-master-armors-table.component.html | 43 ++++++++++++++ .../game-master-armors-table.component.ts | 57 +++++++++++++++++++ .../game-master-dashboard.component.html | 2 +- .../game-master-dashboard.component.ts | 17 ++++++ .../game-master-spells-table.component.html | 5 -- .../shared/animations/sidenav-animations.ts | 28 ++++++--- .../armor-viewmodels/ArmorViewModel.ts | 12 ++++ 9 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.css create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.html create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.ts create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/armor-viewmodels/ArmorViewModel.ts diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index ccc3c8a..260c784 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -34,6 +34,7 @@ import { reducers } from './store/models/app-state.model'; 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'; @NgModule({ declarations: [ @@ -46,6 +47,7 @@ import { GameMasterSpellsTableComponent } from './components/game-master-spells- SelectCharacterComponent, AbilityCardComponent, GameMasterSpellsTableComponent, + GameMasterArmorsTableComponent, ], imports: [ BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), @@ -74,6 +76,9 @@ import { GameMasterSpellsTableComponent } from './components/game-master-spells- ], providers: [UserService, CharacterService], bootstrap: [AppComponent], - entryComponents: [GameMasterSpellsTableComponent], + entryComponents: [ + GameMasterSpellsTableComponent, + GameMasterArmorsTableComponent, + ], }) export class AppModule {} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.css new file mode 100644 index 0000000..acb093a --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.css @@ -0,0 +1,32 @@ +table { + width: 100%; + background-color: initial; +} + +mat-paginator { + background-color: initial; + color: white; +} + +::ng-deep .mat-select-arrow { + color: whitesmoke; +} + +::ng-deep .mat-select-value { + color: white; +} + +.mat-sort-header-container { + color: whitesmoke !important; +} + +.mat-form-field { + font-size: 14px; + width: 100%; +} + +td, +th { + color: whitesmoke; + width: 25%; +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.html new file mode 100644 index 0000000..de8cbe6 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.html @@ -0,0 +1,43 @@ + + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Category {{row.category}} Minimum Strength {{row.minimumStrength}}% Weight {{row.weight}} Cost {{row.cost}} $
No data matching the filter "{{input.value}}"
+ + +
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.ts new file mode 100644 index 0000000..0af906c --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-armors-table/game-master-armors-table.component.ts @@ -0,0 +1,57 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { ArmorViewModel } from '../../../types/viewmodels/armor-viewmodels/ArmorViewModel'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; + +@Component({ + selector: 'app-game-master-armors-table', + templateUrl: './game-master-armors-table.component.html', + styleUrls: ['./game-master-armors-table.component.css'], +}) +export class GameMasterArmorsTableComponent implements OnInit { + displayedColumns: string[] = [ + 'Name', + 'Category', + 'MinimumStrength', + 'Weight', + 'Cost', + ]; + dataSource: MatTableDataSource; + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor() { + const armors = [ + { + id: 1, + name: 'Test', + category: 'Testowa', + minimumStrength: 12, + weight: 98, + cost: 123, + armorClassBase: 10, + haveDexterityBonus: false, + haveStealthDisadvantage: false, + currencyType: 1, + }, + ]; + + this.dataSource = new MatTableDataSource(armors); + } + + ngOnInit() { + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + + if (this.dataSource.paginator) { + this.dataSource.paginator.firstPage(); + } + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html index a89fb07..0e0db4c 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html @@ -18,7 +18,7 @@
- + {{item.displayName}} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts index 9eebb56..ae3aa72 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts @@ -12,6 +12,7 @@ import { LoggedCharactersViewModel } from '../../../types/viewmodels/character-v 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'; @Component({ selector: 'app-game-master-dashboard', @@ -25,6 +26,19 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy { leftSidenavExpanded = false; leftSidenavTextExpanded = false; leftSidenavItems: LeftNavItem[] = [ + { + displayName: 'Equipment', + iconName: 'ra ra-anvil', + expanded: false, + children: [ + { + displayName: 'Armor', + iconName: 'ra ra-vest', + expanded: false, + componentToDisplay: 'GameMasterArmorsTableComponent', + }, + ], + }, { displayName: 'Spells', iconName: 'ra ra-aura', @@ -87,6 +101,9 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy { case 'GameMasterSpellsTableComponent': this.middleComponentName = GameMasterSpellsTableComponent; break; + case 'GameMasterArmorsTableComponent': + this.middleComponentName = GameMasterArmorsTableComponent; + break; } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html index f7f460f..515e687 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html @@ -6,25 +6,21 @@
- - - - @@ -33,7 +29,6 @@ - diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/animations/sidenav-animations.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/animations/sidenav-animations.ts index fba161d..f7d5433 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/animations/sidenav-animations.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/animations/sidenav-animations.ts @@ -1,14 +1,22 @@ -import { trigger, state, style, transition, animate, animateChild, query } from '@angular/animations'; +import { + trigger, + state, + style, + transition, + animate, +} from '@angular/animations'; export const onSideNavChange = trigger('onSideNavChange', [ - state('close', + state( + 'close', style({ - 'min-width': '50px' + 'min-width': '50px', }) ), - state('open', + state( + 'open', style({ - 'min-width': '200px' + 'min-width': '250px', }) ), transition('close => open', animate('250ms ease-in')), @@ -16,15 +24,17 @@ export const onSideNavChange = trigger('onSideNavChange', [ ]); export const animateText = trigger('animateText', [ - state('hide', + state( + 'hide', style({ - 'display': 'none', + display: 'none', opacity: 0, }) ), - state('show', + state( + 'show', style({ - 'display': 'block', + display: 'block', opacity: 1, }) ), diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/armor-viewmodels/ArmorViewModel.ts b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/armor-viewmodels/ArmorViewModel.ts new file mode 100644 index 0000000..a616587 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/armor-viewmodels/ArmorViewModel.ts @@ -0,0 +1,12 @@ +export interface ArmorViewModel { + id: number; + name: string; + category: string; + armorClassBase: number; + haveDexterityBonus: boolean; + minimumStrength: number; + haveStealthDisadvantage: boolean; + weight: number; + cost: number; + currencyType: number; +} -- 2.20.1
Name {{row.name}} Range {{row.range}}% Level {{row.level}} School {{row.school}}
No data matching the filter "{{input.value}}"