From 6d8662e2e6089495130dfa91f1d0d4a7299dc527 Mon Sep 17 00:00:00 2001 From: geek Date: Wed, 18 Apr 2018 20:27:27 +0900 Subject: [PATCH] modify->profile change profile routing & page print --- .../layout/profile/app.profile.component.html | 6 +-- .../layout/profile/app.profile.component.ts | 34 +++++++++++++-- .../account/account-page-routing.module.ts | 23 ++++++++++ .../pages/account/account-page.component.html | 9 ++++ .../account/account-page.component.spec.ts | 25 +++++++++++ .../pages/account/account-page.component.ts | 16 +++++++ src/app/pages/account/account-page.module.ts | 27 ++++++++++++ src/app/pages/log/log-page.component.spec.ts | 2 +- src/app/pages/pages-routing.module.ts | 1 + .../report/report-page.component.spec.ts | 10 ++--- src/packages/member/component/index.ts | 4 +- .../component/modify/modify.component.html | 3 -- .../component/modify/modify.component.ts | 15 ------- .../component/profile/profile.component.html | 42 +++++++++++++++++++ .../profile.component.scss} | 0 .../profile.component.spec.ts} | 12 +++--- .../component/profile/profile.component.ts | 15 +++++++ 17 files changed, 205 insertions(+), 39 deletions(-) create mode 100644 src/app/pages/account/account-page-routing.module.ts create mode 100644 src/app/pages/account/account-page.component.html create mode 100644 src/app/pages/account/account-page.component.spec.ts create mode 100644 src/app/pages/account/account-page.component.ts create mode 100644 src/app/pages/account/account-page.module.ts delete mode 100644 src/packages/member/component/modify/modify.component.html delete mode 100644 src/packages/member/component/modify/modify.component.ts create mode 100644 src/packages/member/component/profile/profile.component.html rename src/packages/member/component/{modify/modify.component.scss => profile/profile.component.scss} (100%) rename src/packages/member/component/{modify/modify.component.spec.ts => profile/profile.component.spec.ts} (56%) create mode 100644 src/packages/member/component/profile/profile.component.ts diff --git a/src/app/commons/component/layout/profile/app.profile.component.html b/src/app/commons/component/layout/profile/app.profile.component.html index 57e3f65..c9b65e2 100644 --- a/src/app/commons/component/layout/profile/app.profile.component.html +++ b/src/app/commons/component/layout/profile/app.profile.component.html @@ -1,14 +1,14 @@
- Jane Williams + {{member.name}} keyboard_arrow_down
\ No newline at end of file + diff --git a/src/app/commons/component/layout/profile/app.profile.component.ts b/src/app/commons/component/layout/profile/app.profile.component.ts index 1abe1b8..b90e375 100644 --- a/src/app/commons/component/layout/profile/app.profile.component.ts +++ b/src/app/commons/component/layout/profile/app.profile.component.ts @@ -1,6 +1,11 @@ -import {Component, trigger, state, transition, style, animate} from '@angular/core'; +import {Component, trigger, state, transition, style, animate, OnInit} from '@angular/core'; import {AppComponent} from 'app/app.component'; import { PagesComponent } from 'app/pages/pages.component'; +import {ActivatedRoute, Router} from '@angular/router'; +import * as AuthStore from '../../../../../packages/member/store/auth'; +import {select, Store} from '@ngrx/store'; +import {AuthSelector} from '../../../../../packages/member/store'; +import {Member} from '../../../../../packages/member/model'; @Component({ selector: 'of-inline-profile', @@ -18,13 +23,34 @@ import { PagesComponent } from 'app/pages/pages.component'; ]) ] }) -export class AppInlineProfileComponent { +export class AppInlineProfileComponent implements OnInit { active: boolean; - constructor(public app: PagesComponent) {} + member: Member; - onClick(event) { + // this.store.select(AuthSelector.select('member'); + + constructor( + public app: PagesComponent, + private activatedRoute: ActivatedRoute, + private router: Router, + private store: Store, + ) { + } + + + ngOnInit() { + this.store.select(AuthSelector.select('member')).subscribe( + (member: Member) => { + this.member = member; + }, + (error) => { + console.log(error); + } + ); + } + onClick(event) { this.active = !this.active; setTimeout(() => { this.app.layoutMenuScrollerViewChild.moveBar(); diff --git a/src/app/pages/account/account-page-routing.module.ts b/src/app/pages/account/account-page-routing.module.ts new file mode 100644 index 0000000..9bbd5f0 --- /dev/null +++ b/src/app/pages/account/account-page-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AccountPageComponent } from './account-page.component'; +import { ProfilePageComponent } from './profile/profile-page.component'; +import { SettingsPageComponent } from './settings/settings-page.component'; + +const routes: Routes = [ + { + path: '', + component: AccountPageComponent, + children: [ + { path: '', redirectTo: 'profile' }, + { path: 'profile', component: ProfilePageComponent}, + { path: 'settings', component: SettingsPageComponent}, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AccountPageRoutingModule { } diff --git a/src/app/pages/account/account-page.component.html b/src/app/pages/account/account-page.component.html new file mode 100644 index 0000000..15f4e9a --- /dev/null +++ b/src/app/pages/account/account-page.component.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/app/pages/account/account-page.component.spec.ts b/src/app/pages/account/account-page.component.spec.ts new file mode 100644 index 0000000..45db8e5 --- /dev/null +++ b/src/app/pages/account/account-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AccountPageComponent } from './account-page.component'; + +describe('ProfilePageComponent', () => { + let component: AccountPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AccountPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AccountPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/account/account-page.component.ts b/src/app/pages/account/account-page.component.ts new file mode 100644 index 0000000..5b5cc48 --- /dev/null +++ b/src/app/pages/account/account-page.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'of-pages-account', + templateUrl: './account-page.component.html', +}) +export class AccountPageComponent implements OnInit { + + constructor(private route: ActivatedRoute, private router: Router) { + } + + ngOnInit() { + } + +} diff --git a/src/app/pages/account/account-page.module.ts b/src/app/pages/account/account-page.module.ts new file mode 100644 index 0000000..0861a33 --- /dev/null +++ b/src/app/pages/account/account-page.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AccountPageRoutingModule } from './account-page-routing.module'; +import { AccountPageComponent } from './account-page.component'; +import { ProfilePageComponent } from './profile/profile-page.component'; +import { SettingsPageComponent } from './settings/settings-page.component'; +import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; +import { MemberModule } from 'packages/member/member.module'; + +export const COMPONENTS = [ + AccountPageComponent, + ProfilePageComponent, + SettingsPageComponent +]; + +@NgModule({ + imports: [ + CommonModule, + AccountPageRoutingModule, + PrimeNGModules, + MemberModule, + // NotificationModule, + ], + declarations: COMPONENTS +}) +export class AccountPageModule { } diff --git a/src/app/pages/log/log-page.component.spec.ts b/src/app/pages/log/log-page.component.spec.ts index 6296272..851c04d 100644 --- a/src/app/pages/log/log-page.component.spec.ts +++ b/src/app/pages/log/log-page.component.spec.ts @@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { LogPageComponent } from './log-page.component'; -describe('AlertPageComponent', () => { +describe('ProfilePageComponent', () => { let component: LogPageComponent; let fixture: ComponentFixture; diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index c58f2a2..ca2222c 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -22,6 +22,7 @@ const routes: Routes = [ { path: 'alert', loadChildren: './alert/alert-page.module#AlertPageModule' }, { path: 'report', loadChildren: './report/report-page.module#ReportPageModule' }, { path: 'log', loadChildren: './log/log-page.module#LogPageModule' }, + { path: 'account', loadChildren: './account/account-page.module#AccountPageModule' }, // { path: 'settings/member', loadChildren: './settings/member/member-page.module#MemberPageModule' }, ] } diff --git a/src/app/pages/report/report-page.component.spec.ts b/src/app/pages/report/report-page.component.spec.ts index 3583b2e..38631fe 100644 --- a/src/app/pages/report/report-page.component.spec.ts +++ b/src/app/pages/report/report-page.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { AlertPageComponent } from './report-page.component'; +import { ReportPageComponent } from './report-page.component'; describe('AlertPageComponent', () => { - let component: AlertPageComponent; - let fixture: ComponentFixture; + let component: ReportPageComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AlertPageComponent ] + declarations: [ ReportPageComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(AlertPageComponent); + fixture = TestBed.createComponent(ReportPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/packages/member/component/index.ts b/src/packages/member/component/index.ts index 31dbb87..b506afe 100644 --- a/src/packages/member/component/index.ts +++ b/src/packages/member/component/index.ts @@ -1,10 +1,10 @@ -import { ModifyComponent } from './modify/modify.component'; +import { ProfileComponent } from './profile/profile.component'; import { SigninComponent } from './signin/signin.component'; import { SignupComponent } from './signup/signup.component'; import { ResetPasswordComponent } from './reset-password/reset-password.component'; export const COMPONENTS = [ - ModifyComponent, + ProfileComponent, SigninComponent, SignupComponent, ResetPasswordComponent, diff --git a/src/packages/member/component/modify/modify.component.html b/src/packages/member/component/modify/modify.component.html deleted file mode 100644 index df6f1b6..0000000 --- a/src/packages/member/component/modify/modify.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- modify works! -

diff --git a/src/packages/member/component/modify/modify.component.ts b/src/packages/member/component/modify/modify.component.ts deleted file mode 100644 index b81bc06..0000000 --- a/src/packages/member/component/modify/modify.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'of-member-modify', - templateUrl: './modify.component.html', - styleUrls: ['./modify.component.scss'] -}) -export class ModifyComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/packages/member/component/profile/profile.component.html b/src/packages/member/component/profile/profile.component.html new file mode 100644 index 0000000..e453395 --- /dev/null +++ b/src/packages/member/component/profile/profile.component.html @@ -0,0 +1,42 @@ +
+
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
diff --git a/src/packages/member/component/modify/modify.component.scss b/src/packages/member/component/profile/profile.component.scss similarity index 100% rename from src/packages/member/component/modify/modify.component.scss rename to src/packages/member/component/profile/profile.component.scss diff --git a/src/packages/member/component/modify/modify.component.spec.ts b/src/packages/member/component/profile/profile.component.spec.ts similarity index 56% rename from src/packages/member/component/modify/modify.component.spec.ts rename to src/packages/member/component/profile/profile.component.spec.ts index 96890e8..692b234 100644 --- a/src/packages/member/component/modify/modify.component.spec.ts +++ b/src/packages/member/component/profile/profile.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ModifyComponent } from './modify.component'; +import { ProfileComponent } from './profile.component'; -describe('ModifyComponent', () => { - let component: ModifyComponent; - let fixture: ComponentFixture; +describe('ProfileComponent', () => { + let component: ProfileComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ModifyComponent ] + declarations: [ ProfileComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(ModifyComponent); + fixture = TestBed.createComponent(ProfileComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/packages/member/component/profile/profile.component.ts b/src/packages/member/component/profile/profile.component.ts new file mode 100644 index 0000000..34fac63 --- /dev/null +++ b/src/packages/member/component/profile/profile.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-member-profile', + templateUrl: './profile.component.html', + styleUrls: ['./profile.component.scss'] +}) +export class ProfileComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +}