From bb2876f7a3d23b2a285c5246133e4f82a67cf4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C3=B3reczny?= Date: Fri, 8 Jan 2021 14:55:26 +0100 Subject: [PATCH] SES-136 spell table model create --- .../ClientApp/src/app/app.module.ts | 41 +++++++++------- .../game-master-dashboard.component.css | 10 ++++ .../game-master-dashboard.component.html | 38 ++++++++++----- .../game-master-dashboard.component.ts | 15 +++++- .../game-master-spells-table.component.css | 38 +++++++++++++++ .../game-master-spells-table.component.html | 43 +++++++++++++++++ .../game-master-spells-table.component.ts | 48 +++++++++++++++++++ 7 files changed, 204 insertions(+), 29 deletions(-) create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.css create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.ts diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index d829109..ccc3c8a 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -8,8 +8,8 @@ import { appRoutingModule } from '../app.routing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { SignInComponent } from './components/sign-in/sign-in.component'; import { RegistrationComponent } from './components/registration/registration.component'; -import { GameMasterDashboardComponent} from './components/game-master-dashboard/game-master-dashboard.component'; -import {PlayerDashboardComponent} from './components/player-dashboard/player-dashboard.component'; +import { GameMasterDashboardComponent } from './components/game-master-dashboard/game-master-dashboard.component'; +import { PlayerDashboardComponent } from './components/player-dashboard/player-dashboard.component'; import { SelectCharacterComponent } from './components/select-character/select-character.component'; import { MatCardModule, @@ -18,15 +18,22 @@ import { MatInputModule, MatButtonModule, MatCheckboxModule, - MatIconModule, MatSidenavModule, MatToolbarModule, MatListModule + MatIconModule, + MatSidenavModule, + MatToolbarModule, + MatListModule, + MatPaginatorModule, + MatTableModule, + MatSortModule, } from '@angular/material'; -import {UserService} from '../services/user.service'; +import { UserService } from '../services/user.service'; import { StoreModule } from '@ngrx/store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; -import {environment} from '../environments/environment'; -import {reducers} from './store/models/app-state.model'; -import {CharacterService} from '../services/character.service'; +import { environment } from '../environments/environment'; +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'; @NgModule({ declarations: [ @@ -38,9 +45,10 @@ import { AbilityCardComponent } from './components/ability-card/ability-card.com PlayerDashboardComponent, SelectCharacterComponent, AbilityCardComponent, + GameMasterSpellsTableComponent, ], imports: [ -BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), + BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), HttpClientModule, FormsModule, ReactiveFormsModule, @@ -56,15 +64,16 @@ BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), MatSidenavModule, MatToolbarModule, MatListModule, + MatPaginatorModule, StoreModule.forRoot(reducers), StoreDevtoolsModule.instrument({ - logOnly: environment.production - }) + logOnly: environment.production, + }), + MatTableModule, + MatSortModule, ], - providers: [ - UserService, - CharacterService - ], - bootstrap: [AppComponent] + providers: [UserService, CharacterService], + bootstrap: [AppComponent], + entryComponents: [GameMasterSpellsTableComponent], }) -export class AppModule { } +export class AppModule {} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.css index 49d12fc..af117d2 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.css +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.css @@ -10,6 +10,16 @@ right: 0; } +.no-wrap { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.left-nav-item *{ + padding-right: 0px !important; +} + .leftnav{ background-color: #3D4751; border-right:none; 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 a3da11b..a89fb07 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 @@ -17,25 +17,41 @@ - - - -
+
+ + + {{item.displayName}} -
- - expand_more - + + expand_more + expand_less + - + + +
+
+ + + + {{child.displayName}} + + + +
+
+
SessionCompanion +
+ + + +
{ if ( diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.css new file mode 100644 index 0000000..0144f37 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.css @@ -0,0 +1,38 @@ +table { + width: 100%; + background-color: initial; +} + +mat-paginator{ + background-color: initial; + color: white; +} + +th{ + color: whitesmoke; +} + +td{ + color: whitesmoke; +} + +::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 { + width: 25%; +} 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 new file mode 100644 index 0000000..f7f460f --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.html @@ -0,0 +1,43 @@ + + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Range {{row.range}}% Level {{row.level}} School {{row.school}}
No data matching the filter "{{input.value}}"
+ + +
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.ts new file mode 100644 index 0000000..8da89fa --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-spells-table/game-master-spells-table.component.ts @@ -0,0 +1,48 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; + +export interface SpellData { + name: string; + range: string; + level: number; + school: string; +} + +@Component({ + selector: 'app-game-master-spells-table', + templateUrl: './game-master-spells-table.component.html', + styleUrls: ['./game-master-spells-table.component.css'], +}) +export class GameMasterSpellsTableComponent implements OnInit { + displayedColumns: string[] = ['Name', 'Range', 'Level', 'School']; + dataSource: MatTableDataSource; + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor() { + const users = Array.from({ length: 100 }, (_, k) => this.createSepll()); + + this.dataSource = new MatTableDataSource(users); + } + + createSepll(): SpellData { + return { name: 'test', range: 'asd', level: 2, school: 'UAM!!!!' }; + } + + 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(); + } + } +}