From b4fc93d607eec355afa2ba81577d8eb710d38ff5 Mon Sep 17 00:00:00 2001 From: crusader Date: Mon, 29 Apr 2019 23:27:38 +0900 Subject: [PATCH] bug fix --- package-lock.json | 28 +++++++++++---- .../src/app/app-routing.module.ts | 9 +++-- .../src/app/app-store.module.ts | 23 ++++++++++++ .../src/app/app.component.html | 36 ------------------- .../src/app/app.module.ts | 10 ++++-- .../src/app/page/main/component/index.ts | 3 ++ .../main/component/main.page.component.html | 1 + .../main/component/main.page.component.scss | 0 .../component/main.page.component.spec.ts | 33 +++++++++++++++++ .../main/component/main.page.component.ts | 10 ++++++ .../app/page/main/main-routing.page.module.ts | 25 +++++++++++++ .../src/app/page/main/main.page.module.ts | 21 +++++++++++ .../src/app/store/index.ts | 20 +++++++++++ .../lib/component/main-layout.component.html | 17 +++++++++ .../lib/component/main-layout.component.scss | 0 .../component/main-layout.component.spec.ts | 24 +++++++++++++ .../lib/component/main-layout.component.ts | 12 +++++++ .../src/lib/layout.module.ts | 13 ++++--- .../src/public-api.ts | 1 + 19 files changed, 234 insertions(+), 52 deletions(-) create mode 100644 projects/odds-crawler-frontend-app/src/app/app-store.module.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/component/index.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.html create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.scss create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.spec.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/main-routing.page.module.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/page/main/main.page.module.ts create mode 100644 projects/odds-crawler-frontend-app/src/app/store/index.ts create mode 100644 projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.html create mode 100644 projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.scss create mode 100644 projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.spec.ts create mode 100644 projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.ts diff --git a/package-lock.json b/package-lock.json index 1eaeafa..0be3543 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4044,12 +4044,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4064,17 +4066,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4191,7 +4196,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4203,6 +4209,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4217,6 +4224,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4224,12 +4232,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4248,6 +4258,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4328,7 +4339,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4340,6 +4352,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4461,6 +4474,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/projects/odds-crawler-frontend-app/src/app/app-routing.module.ts b/projects/odds-crawler-frontend-app/src/app/app-routing.module.ts index d425c6f..34a8a6c 100644 --- a/projects/odds-crawler-frontend-app/src/app/app-routing.module.ts +++ b/projects/odds-crawler-frontend-app/src/app/app-routing.module.ts @@ -1,10 +1,15 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -const routes: Routes = []; +const routes: Routes = [ + { + path: '', + loadChildren: './page/main/main.page.module#MainPageModule' + } +]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/projects/odds-crawler-frontend-app/src/app/app-store.module.ts b/projects/odds-crawler-frontend-app/src/app/app-store.module.ts new file mode 100644 index 0000000..bed48b0 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/app-store.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; + +import { StoreModule } from '@ngrx/store'; +import { reducers, metaReducers, effects } from './store'; +import { EffectsModule } from '@ngrx/effects'; +import { StoreDevtoolsModule } from '@ngrx/store-devtools'; +import { environment } from '../environments/environment'; +import { StoreRouterConnectingModule } from '@ngrx/router-store'; + +@NgModule({ + declarations: [], + imports: [ + StoreModule.forRoot(reducers, { metaReducers }), + StoreDevtoolsModule.instrument({ + maxAge: 25, + logOnly: environment.production + }), + StoreRouterConnectingModule.forRoot(), + EffectsModule.forRoot(effects) + ], + providers: [] +}) +export class AppStoreModule {} diff --git a/projects/odds-crawler-frontend-app/src/app/app.component.html b/projects/odds-crawler-frontend-app/src/app/app.component.html index 1885a58..0680b43 100644 --- a/projects/odds-crawler-frontend-app/src/app/app.component.html +++ b/projects/odds-crawler-frontend-app/src/app/app.component.html @@ -1,37 +1 @@ - -
-

Welcome to {{ title }}!

- Angular Logo -
-

Here are some links to help you start:

- - - - diff --git a/projects/odds-crawler-frontend-app/src/app/app.module.ts b/projects/odds-crawler-frontend-app/src/app/app.module.ts index fe7174a..c8b01e8 100644 --- a/projects/odds-crawler-frontend-app/src/app/app.module.ts +++ b/projects/odds-crawler-frontend-app/src/app/app.module.ts @@ -1,19 +1,23 @@ -import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common'; import { OddsCrawlerFrontendLayoutModule } from '@odds-crawler/layout'; import { AppRoutingModule } from './app-routing.module'; +import { AppStoreModule } from './app-store.module'; import { AppComponent } from './app.component'; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, - AppRoutingModule, + BrowserAnimationsModule, OddsCrawlerFrontendCommonModule, - OddsCrawlerFrontendLayoutModule + OddsCrawlerFrontendLayoutModule, + AppRoutingModule, + AppStoreModule ], providers: [], bootstrap: [AppComponent] diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/component/index.ts b/projects/odds-crawler-frontend-app/src/app/page/main/component/index.ts new file mode 100644 index 0000000..43201f3 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/component/index.ts @@ -0,0 +1,3 @@ +import { MainPageComponent } from './main.page.component'; + +export const COMPONENTS = [MainPageComponent]; diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.html b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.html new file mode 100644 index 0000000..0680b43 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.html @@ -0,0 +1 @@ + diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.scss b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.spec.ts b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.spec.ts new file mode 100644 index 0000000..25f9d11 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.spec.ts @@ -0,0 +1,33 @@ +import { TestBed, async } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { MainPageComponent } from './main.page.component'; + +describe('MainPageComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule], + declarations: [MainPageComponent] + }).compileComponents(); + })); + + it('should create the app', () => { + const fixture = TestBed.createComponent(MainPageComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'odds-crawler-frontend-app'`, () => { + const fixture = TestBed.createComponent(MainPageComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('odds-crawler-frontend-app'); + }); + + it('should render title in a h1 tag', () => { + const fixture = TestBed.createComponent(MainPageComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain( + 'Welcome to odds-crawler-frontend-app!' + ); + }); +}); diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.ts b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.ts new file mode 100644 index 0000000..7054439 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/component/main.page.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'odds-crawler-app-page-main', + templateUrl: './main.page.component.html', + styleUrls: ['./main.page.component.scss'] +}) +export class MainPageComponent { + title = 'odds-crawler-frontend-app'; +} diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/main-routing.page.module.ts b/projects/odds-crawler-frontend-app/src/app/page/main/main-routing.page.module.ts new file mode 100644 index 0000000..a0116a5 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/main-routing.page.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { MainLayoutComponent } from '@odds-crawler/layout'; + +import { MainPageComponent } from './component/main.page.component'; + +const routes: Routes = [ + { + path: '', + component: MainLayoutComponent, + children: [ + { + path: '', + component: MainPageComponent + } + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class MainRoutingPageModule {} diff --git a/projects/odds-crawler-frontend-app/src/app/page/main/main.page.module.ts b/projects/odds-crawler-frontend-app/src/app/page/main/main.page.module.ts new file mode 100644 index 0000000..2caf066 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/page/main/main.page.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; + +import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common'; +import { OddsCrawlerFrontendLayoutModule } from '@odds-crawler/layout'; + +import { COMPONENTS } from './component'; +import { MainRoutingPageModule } from './main-routing.page.module'; + +@NgModule({ + imports: [ + CommonModule, + TranslateModule, + OddsCrawlerFrontendCommonModule, + OddsCrawlerFrontendLayoutModule, + MainRoutingPageModule + ], + declarations: [...COMPONENTS] +}) +export class MainPageModule {} diff --git a/projects/odds-crawler-frontend-app/src/app/store/index.ts b/projects/odds-crawler-frontend-app/src/app/store/index.ts new file mode 100644 index 0000000..b4931d3 --- /dev/null +++ b/projects/odds-crawler-frontend-app/src/app/store/index.ts @@ -0,0 +1,20 @@ +import { Type } from '@angular/core'; + +import { + ActionReducer, + ActionReducerMap, + createFeatureSelector, + createSelector, + MetaReducer +} from '@ngrx/store'; +import { environment } from '../../environments/environment'; + +export interface State {} + +export const reducers: ActionReducerMap = {}; + +export const metaReducers: MetaReducer[] = !environment.production + ? [] + : []; + +export const effects: Type[] = []; diff --git a/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.html b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.html new file mode 100644 index 0000000..9eef56e --- /dev/null +++ b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.html @@ -0,0 +1,17 @@ + + + + Content 1 + + + + + Content 2 + + + + + Content 3 + + + diff --git a/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.scss b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.spec.ts b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.spec.ts new file mode 100644 index 0000000..145c946 --- /dev/null +++ b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MainLayoutComponent } from './main-layout.component'; + +describe('layout.MainLayoutComponent', () => { + let component: MainLayoutComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [MainLayoutComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MainLayoutComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.ts b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.ts new file mode 100644 index 0000000..e68a864 --- /dev/null +++ b/projects/odds-crawler-frontend-layout/src/lib/component/main-layout.component.ts @@ -0,0 +1,12 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'odds-crawler-layout-main', + templateUrl: './main-layout.component.html', + styles: ['./main-layout.component.scss'] +}) +export class MainLayoutComponent implements OnInit { + constructor() {} + + ngOnInit() {} +} diff --git a/projects/odds-crawler-frontend-layout/src/lib/layout.module.ts b/projects/odds-crawler-frontend-layout/src/lib/layout.module.ts index 5ac92c1..6c069f2 100644 --- a/projects/odds-crawler-frontend-layout/src/lib/layout.module.ts +++ b/projects/odds-crawler-frontend-layout/src/lib/layout.module.ts @@ -1,11 +1,16 @@ import { NgModule } from '@angular/core'; -import { DefaultLayoutComponent } from './component/default-layout.component'; +import { CommonModule } from '@angular/common'; import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common'; +import { DefaultLayoutComponent } from './component/default-layout.component'; +import { MainLayoutComponent } from './component/main-layout.component'; + +export const COMPONENTS = [DefaultLayoutComponent, MainLayoutComponent]; + @NgModule({ - declarations: [DefaultLayoutComponent], - imports: [OddsCrawlerFrontendCommonModule], - exports: [DefaultLayoutComponent] + declarations: [...COMPONENTS], + imports: [CommonModule, OddsCrawlerFrontendCommonModule], + exports: [...COMPONENTS] }) export class OddsCrawlerFrontendLayoutModule {} diff --git a/projects/odds-crawler-frontend-layout/src/public-api.ts b/projects/odds-crawler-frontend-layout/src/public-api.ts index ba7bfd8..c14cb57 100644 --- a/projects/odds-crawler-frontend-layout/src/public-api.ts +++ b/projects/odds-crawler-frontend-layout/src/public-api.ts @@ -4,4 +4,5 @@ export * from './lib/service/odds-crawler-frontend-layout.service'; export * from './lib/component/default-layout.component'; +export * from './lib/component/main-layout.component'; export * from './lib/layout.module';