diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 998d06b..0f57f08 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,11 +6,11 @@ import { Routes, RouterModule } from '@angular/router'; const routes: Routes = [ { path: '', - loadChildren: () => import('../modules/pool/pool.module').then(m => m.PoolModule) + loadChildren: () => import('../modules/layout/layout.module').then(m => m.LayoutModule) }, { path: '**', - loadChildren: () => import('../modules/pool/pool.module').then(m => m.PoolModule) + loadChildren: () => import('../modules/layout/layout.module').then(m => m.LayoutModule) } ]; diff --git a/src/modules/pool/components/layout/layout.component.html b/src/modules/layout/components/layout/layout.component.html similarity index 75% rename from src/modules/pool/components/layout/layout.component.html rename to src/modules/layout/components/layout/layout.component.html index 1bb2cf1..b1dc79f 100644 --- a/src/modules/pool/components/layout/layout.component.html +++ b/src/modules/layout/components/layout/layout.component.html @@ -1,7 +1,7 @@ - +<> \ No newline at end of file diff --git a/src/modules/pool/components/layout/layout.component.scss b/src/modules/layout/components/layout/layout.component.scss similarity index 100% rename from src/modules/pool/components/layout/layout.component.scss rename to src/modules/layout/components/layout/layout.component.scss diff --git a/src/modules/pool/components/layout/layout.component.ts b/src/modules/layout/components/layout/layout.component.ts similarity index 100% rename from src/modules/pool/components/layout/layout.component.ts rename to src/modules/layout/components/layout/layout.component.ts diff --git a/src/modules/layout/layout-routing.module.ts b/src/modules/layout/layout-routing.module.ts new file mode 100644 index 0000000..1c3a0f2 --- /dev/null +++ b/src/modules/layout/layout-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { LayoutComponent } from './components/layout/layout.component'; + + +const routes: Routes = [ + { path: '', + component: LayoutComponent, + children: [ + { + path: '', + loadChildren: () => import('../pool/pool.module').then(m => m.PoolModule) + } + ] + }, + { path: '**', component: LayoutComponent, pathMatch: 'full' } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class LayoutRoutingModule { } diff --git a/src/modules/layout/layout.module.ts b/src/modules/layout/layout.module.ts new file mode 100644 index 0000000..1fc4f3c --- /dev/null +++ b/src/modules/layout/layout.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { LayoutComponent } from './components/layout/layout.component'; +import { PoolModule } from '../pool/pool.module'; +import { LayoutRoutingModule } from './layout-routing.module'; + +@NgModule({ + declarations: [ + LayoutComponent + ], + imports: [ + CommonModule, + LayoutRoutingModule, + PoolModule + ] +}) + +export class LayoutModule { } diff --git a/src/modules/pool/components/home/home.component.html b/src/modules/pool/components/pool/pool.component.html similarity index 100% rename from src/modules/pool/components/home/home.component.html rename to src/modules/pool/components/pool/pool.component.html diff --git a/src/modules/pool/components/home/home.component.scss b/src/modules/pool/components/pool/pool.component.scss similarity index 100% rename from src/modules/pool/components/home/home.component.scss rename to src/modules/pool/components/pool/pool.component.scss diff --git a/src/modules/pool/components/home/home.component.ts b/src/modules/pool/components/pool/pool.component.ts similarity index 93% rename from src/modules/pool/components/home/home.component.ts rename to src/modules/pool/components/pool/pool.component.ts index 61fc72e..eed48d0 100644 --- a/src/modules/pool/components/home/home.component.ts +++ b/src/modules/pool/components/pool/pool.component.ts @@ -13,12 +13,12 @@ import { DataToShare } from 'src/models/dataToShare'; @Component({ - selector: 'app-home', - templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] + selector: 'app-pool', + templateUrl: './pool.component.html', + styleUrls: ['./pool.component.scss'] }) -export class HomeComponent implements OnInit, OnDestroy { +export class PoolComponent implements OnInit, OnDestroy { formFilters: FormGroup; bonusesPool: Bonus[] = []; champions: Champion[] = []; diff --git a/src/modules/pool/pool-routing.module.ts b/src/modules/pool/pool-routing.module.ts index 6984d14..50babbe 100644 --- a/src/modules/pool/pool-routing.module.ts +++ b/src/modules/pool/pool-routing.module.ts @@ -1,11 +1,11 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { LayoutComponent } from 'src/modules/pool/components/layout/layout.component'; +import { PoolComponent } from './components/pool/pool.component'; const routes: Routes = [ - { path: '', component: LayoutComponent, pathMatch: 'full' }, - { path: '**', component: LayoutComponent, pathMatch: 'full' } + { path: '', component: PoolComponent, pathMatch: 'full' }, + { path: '**', component: PoolComponent, pathMatch: 'full' } ]; @NgModule({ diff --git a/src/modules/pool/pool.module.ts b/src/modules/pool/pool.module.ts index 5a00e93..c5399ec 100644 --- a/src/modules/pool/pool.module.ts +++ b/src/modules/pool/pool.module.ts @@ -6,13 +6,11 @@ import { ReactiveFormsModule } from '@angular/forms'; import { PoolService } from 'src/modules/pool/services/pool.service'; -import { LayoutComponent } from './components/layout/layout.component'; -import { HomeComponent } from './components/home/home.component'; +import { PoolComponent } from './components/pool/pool.component'; @NgModule({ declarations: [ - LayoutComponent, - HomeComponent + PoolComponent ], imports: [ CommonModule, diff --git a/src/modules/pool/services/pool.service.ts b/src/modules/pool/services/pool.service.ts index 98d49b0..ad13d86 100644 --- a/src/modules/pool/services/pool.service.ts +++ b/src/modules/pool/services/pool.service.ts @@ -152,9 +152,11 @@ export class PoolService { * Update role pool */ updatePool() { + let pool = []; this.championsPool.forEach(champion => { - this.rolesPool = _.union(this.rolesPool, champion.roles); + pool = _.union(this.rolesPool, champion.roles); }); + this.rolesPool = pool; } /** diff --git a/src/shared/constants.ts b/src/shared/constants.ts index beeeadd..b8195ed 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -20,6 +20,7 @@ export class Constants { public static championName = 'name'; public static roles = traits.map(trait => trait.name); + public static bonuses: Bonus [] = traits.reduce((previous, current) => { current.sets.forEach(set => { previous.push({