-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from paulmojicatech/updates
update routing
- Loading branch information
Showing
17 changed files
with
218 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tasy-football/components/fantasy-football-sidebar/fantasy-football-sidebar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="sidebar-container"> | ||
<button color="primary" *ngFor="let item of SIDEBAR_ITEM_MAP" mat-raised-button (click)="sideBarEvent.emit(item.path)">{{item.label}}</button> | ||
<button class="pmt-white" color="primary" *ngFor="let item of SIDEBAR_ITEM_MAP" mat-raised-button (click)="sideBarEvent.emit(item.path)">{{item.label}}</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
button { | ||
margin-bottom: 1rem; | ||
} | ||
} | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
apps/fantalytic-public/src/app/fantasy-football/components/scores/scores.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>scores works!</p> |
Empty file.
21 changes: 21 additions & 0 deletions
21
apps/fantalytic-public/src/app/fantasy-football/components/scores/scores.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ScoresComponent } from './scores.component'; | ||
|
||
describe('ScoresComponent', () => { | ||
let component: ScoresComponent; | ||
let fixture: ComponentFixture<ScoresComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ScoresComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ScoresComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
apps/fantalytic-public/src/app/fantasy-football/components/scores/scores.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'pmt-scores', | ||
standalone: true, | ||
imports: [CommonModule], | ||
templateUrl: './scores.component.html', | ||
styleUrls: ['./scores.component.scss'], | ||
}) | ||
export class ScoresComponent {} |
33 changes: 33 additions & 0 deletions
33
apps/fantalytic-public/src/app/fantasy-football/components/stats/stats.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<section class="m-2" *ngIf="fantasyFootballState$ | async as state"> | ||
<mat-sidenav-container autosize > | ||
<mat-sidenav-content> | ||
<div class="filter-container"> | ||
<div class="position-container"> | ||
<span>Position</span> | ||
<button [ngClass]="{'active': (currentPosition$ | async) === 'QB'}" (click)="updatePosition('QB')" mat-button>QB</button> | ||
<button [ngClass]="{'active': (currentPosition$ | async) === 'RB'}" (click)="updatePosition('RB')" mat-button>RB</button> | ||
<button [ngClass]="{'active': (currentPosition$ | async) === 'WR'}" (click)="updatePosition('WR')" mat-button>WR / TE</button> | ||
<button [ngClass]="{'active': (currentPosition$ | async) === 'DEF'}" (click)="updatePosition('DEF')" mat-button>DEF</button> | ||
</div> | ||
<div class="year-container"> | ||
<span>Year</span> | ||
<button [ngClass]="{'active': (currentYear$ | async) === year}" (click)="filterByYear(year)" mat-button *ngFor="let year of ALL_YEARS">{{year}}</button> | ||
</div> | ||
</div> | ||
<div class="grid-container" *ngIf="state.gridConfig"> | ||
<ag-grid-angular #statGrid | ||
class="ag-theme-alpine" | ||
[columnDefs]="state.gridConfig.colDef" | ||
[rowData]="state.selectedRowData" | ||
rowSelection="multiple" | ||
[defaultColDef]="DEFAULT_COL_DEF_SETTINGS" | ||
(rowSelected)="handleUpdatedRowSelected()"></ag-grid-angular> | ||
|
||
</div> | ||
</mat-sidenav-content> | ||
<mat-sidenav #drawer mode="side" position="end"> | ||
<pmt-fantasy-football-sidebar (sideBarEvent)="handleSidebarEvent($event)"></pmt-fantasy-football-sidebar> | ||
</mat-sidenav> | ||
</mat-sidenav-container> | ||
</section> | ||
|
3 changes: 3 additions & 0 deletions
3
apps/fantalytic-public/src/app/fantasy-football/components/stats/stats.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ag-grid-angular { | ||
height: 50vh; | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/fantalytic-public/src/app/fantasy-football/components/stats/stats.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { StatsComponent } from './stats.component'; | ||
|
||
describe('StatsComponent', () => { | ||
let component: StatsComponent; | ||
let fixture: ComponentFixture<StatsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [StatsComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(StatsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
83 changes: 83 additions & 0 deletions
83
apps/fantalytic-public/src/app/fantasy-football/components/stats/stats.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav'; | ||
import { Router } from '@angular/router'; | ||
import { Store } from '@ngrx/store'; | ||
import { FantasyFootballState, PositionTypes } from '@pmt/fantalytic-shared'; | ||
import { AgGridAngular, AgGridModule } from 'ag-grid-angular'; | ||
import { Observable, Subject } from 'rxjs'; | ||
import { DEFAULT_COL_DEF_SETTINGS } from '../../../const/grid.const'; | ||
import { setPositionType, updateSelectedPlayers, updateYearFilter } from '../../ngrx/actions/fantasy-football.actions'; | ||
import { getSelectedYear, getPosition, getFantasyFootballState } from '../../ngrx/selectors/fantasy-football.selectors'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { FantasyFootballSidebarComponent } from '../fantasy-football-sidebar/fantasy-football-sidebar.component'; | ||
|
||
@Component({ | ||
selector: 'pmt-stats', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
AgGridModule, | ||
MatButtonModule, | ||
MatSidenavModule, | ||
FantasyFootballSidebarComponent, | ||
], | ||
templateUrl: './stats.component.html', | ||
styleUrls: ['./stats.component.scss'], | ||
}) | ||
export class StatsComponent implements OnInit, OnDestroy { | ||
|
||
@ViewChild('statGrid') | ||
statGrid!: AgGridAngular; | ||
|
||
@ViewChild('drawer') | ||
drawer!: MatSidenav; | ||
|
||
fantasyFootballState$!: Observable<FantasyFootballState>; | ||
currentYear$ = this._store.select(getSelectedYear); | ||
currentPosition$ = this._store.select(getPosition); | ||
|
||
readonly DEFAULT_COL_DEF_SETTINGS = DEFAULT_COL_DEF_SETTINGS; | ||
readonly ALL_YEARS = [2018,2019,2020,2021,2022]; | ||
|
||
private _compDestroyedSub$ = new Subject<void>(); | ||
|
||
constructor(private _store: Store<FantasyFootballState>, private _router: Router) {} | ||
|
||
ngOnInit(): void { | ||
this._store.dispatch(setPositionType(PositionTypes.QB)); | ||
this.fantasyFootballState$ = this._store.select(getFantasyFootballState); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this._compDestroyedSub$.next(); | ||
} | ||
|
||
gridReady(): void { | ||
this.statGrid.api.sizeColumnsToFit(); | ||
} | ||
|
||
handleUpdatedRowSelected(): void { | ||
const selectedPlayers = this.statGrid.api.getSelectedNodes().map(node => node.data.player); | ||
this._store.dispatch(updateSelectedPlayers(selectedPlayers)); | ||
if (selectedPlayers.length) { | ||
this.drawer.open(); | ||
} else { | ||
this.drawer.close(); | ||
} | ||
|
||
} | ||
|
||
updatePosition(position: string): void { | ||
this.drawer.close(); | ||
this._store.dispatch(setPositionType(position as PositionTypes)); | ||
} | ||
|
||
handleSidebarEvent(path: string): void { | ||
this._router.navigate(['fantasy-football', path]); | ||
} | ||
|
||
filterByYear(year: number): void { | ||
this._store.dispatch(updateYearFilter(year)); | ||
} | ||
} |
6 changes: 1 addition & 5 deletions
6
apps/fantalytic-public/src/app/fantasy-football/const/fantasy-football-routes.const.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 6 additions & 31 deletions
37
apps/fantalytic-public/src/app/fantasy-football/fantasy-football.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +0,0 @@ | ||
.main-container { | ||
display: grid; | ||
grid-template-columns: repeat(3, 1fr); | ||
mat-sidenav-container { | ||
width: 100vw; | ||
} | ||
} | ||
|
||
.filter-container { | ||
grid-column: 1 / 3; | ||
display: inline-flex; | ||
margin: 1rem; | ||
.position-container, .year-container { | ||
background-color: #ccc; | ||
margin-right: 1rem; | ||
} | ||
span, div, a { | ||
padding: 1.5rem; | ||
} | ||
} | ||
|
||
.grid-container { | ||
height: 70vh; | ||
width: 90vw; | ||
grid-column: 2 / 3; | ||
margin: 1rem; | ||
ag-grid-angular { | ||
height: 100%; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.active { | ||
text-decoration: underline; | ||
} | ||
Oops, something went wrong.