From 67ddf4b6636f24a5d66d3ccd5ce679f5912cb0f9 Mon Sep 17 00:00:00 2001 From: Mathieu Sanchez Date: Tue, 21 May 2019 12:47:27 +0900 Subject: [PATCH] Add router and homepage --- src/app/app-material.module.ts | 30 ++++++++++ src/app/app-routing.module.ts | 85 +++++++++++++++++++++++++++++ src/app/app.component.html | 22 +------- src/app/app.module.ts | 7 +++ src/app/home/home.component.css | 0 src/app/home/home.component.html | 3 + src/app/home/home.component.spec.ts | 25 +++++++++ src/app/home/home.component.ts | 15 +++++ 8 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 src/app/app-material.module.ts create mode 100644 src/app/app-routing.module.ts create mode 100644 src/app/home/home.component.css create mode 100644 src/app/home/home.component.html create mode 100644 src/app/home/home.component.spec.ts create mode 100644 src/app/home/home.component.ts diff --git a/src/app/app-material.module.ts b/src/app/app-material.module.ts new file mode 100644 index 0000000..a4dcced --- /dev/null +++ b/src/app/app-material.module.ts @@ -0,0 +1,30 @@ +import { NgModule } from '@angular/core'; + +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; +import { MatTableModule } from '@angular/material/table'; +import { MatInputModule, MatNativeDateModule, MatSnackBarModule, MatTooltipModule } from '@angular/material'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatSelectModule } from '@angular/material/select'; + +@NgModule( { + exports: [ + MatIconModule, + MatButtonModule, + MatCardModule, + MatTableModule, + MatInputModule, + MatFormFieldModule, + MatExpansionModule, + MatSnackBarModule, + MatDatepickerModule, + MatNativeDateModule, + MatSelectModule, + MatTooltipModule, + ] +} ) +export class AppMaterialModule { +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 0000000..8ce2927 --- /dev/null +++ b/src/app/app-routing.module.ts @@ -0,0 +1,85 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { HomeComponent } from './home/home.component'; + +const routes: Routes = [ + // No logged pages + { path: '', component: HomeComponent, }, + // { + // path: 'login', + // component: LoginComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Créez-vous ou connectez-vous à votre compte', + // description: 'Venez vous créer un compte sur notre platforme, grâce à notre application web et mobile vous serez prêt pour tout' + + // 'les cas de figure', + // noindex: true, + // nofollow: true, + // }, + // }, + // { + // path: 'verification/:id', + // component: VerificationComponent, + // data: { + // noindex: true, + // nofollow: true, + // }, + // }, + // { + // path: 'password/:id', + // component: PasswordComponent, + // data: { + // noindex: true, + // nofollow: true, + // }, + // }, + // + // // Logged pages + // { + // path: 'dashboard', + // component: DashboardComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Mom dashboard', + // }, + // }, + // { + // path: 'vehicles', + // component: CarsComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Mes véhicules', + // }, + // }, + // { + // path: 'reports', + // component: ReportsComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Mes constat', + // }, + // }, + // { + // path: 'reports/:id', + // component: ReportDetailsComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Détail d\'un constat', + // }, + // }, + // { + // path: 'profile', + // component: ProfileComponent, + // canActivate: [ AuthGuard ], + // data: { + // title: 'Mon Profil', + // }, + // }, +]; + +@NgModule( { + imports: [ RouterModule.forRoot( routes ) ], + exports: [ RouterModule ] +} ) +export class AppRoutingModule { +} diff --git a/src/app/app.component.html b/src/app/app.component.html index a3005ba..0680b43 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,21 +1 @@ - -
-

- Welcome to {{ title }}! -

- Angular Logo -
-

Here are some links to help you start:

- - + diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 208d5d8..599d92a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -4,21 +4,28 @@ import { ErrorHandler, NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { HomeComponent } from './home/home.component'; + import { AngularFireModule } from '@angular/fire'; import { AngularFireDatabaseModule } from '@angular/fire/database'; import { environment } from '@env/environment'; import { GlobalErrorHandler } from '@app/core/global-error-handler/global-error-handler.service'; import { LogService } from '@app/core/services'; +import { AppMaterialModule } from '@app/app-material.module'; +import { AppRoutingModule } from '@app/app-routing.module'; @NgModule({ declarations: [ AppComponent, + HomeComponent, ], imports: [ BrowserModule, BrowserAnimationsModule, + AppRoutingModule, AngularFireModule.initializeApp(environment.firebaseConfig), AngularFireDatabaseModule, + AppMaterialModule, ], providers: [ LogService, diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000..978ec09 --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,3 @@ +
+ Welcome in our home page +
diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts new file mode 100644 index 0000000..490e81b --- /dev/null +++ b/src/app/home/home.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts new file mode 100644 index 0000000..33fd770 --- /dev/null +++ b/src/app/home/home.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.css'] +}) +export class HomeComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +}