diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4bdcac1..d43e8ef 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -13,42 +13,43 @@ import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-f import { PageMenuSemaineComponent } from './pages/page-menu-semaine/page-menu-semaine.component'; import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component'; import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component'; -import { PageHumeurComponent} from './pages/page-humeur/page-humeur.component'; import { PageRepertoireComponent } from './pages/page-repertoire/page-repertoire.component'; import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component'; import { PageSignupComponent } from './pages/page-signup/page-signup.component'; import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component'; import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component'; import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component'; +import { PageSupportComponent } from './pages/page-support/page-support.component'; import { FooterComponent } from './components/footer/footer.component'; +import { AuthGuard } from './auth.guard'; const routes: Routes = [ { path: '', redirectTo: 'accueil', pathMatch: 'full' }, - { path: 'modifier-contact/:id', component: PageModifierContactComponent }, - { path: 'compte', component: PageAccountComponent }, + { path: 'modifier-contact/:id', canActivate: [AuthGuard], component: PageModifierContactComponent }, + { path: 'compte', canActivate: [AuthGuard], component: PageAccountComponent }, { path: 'accueil', component: PageAccueilComponent }, - { path: 'ajout-membre', component: PageAddMemberComponent }, - { path: 'agenda', component: PageAgendaComponent }, - { path: 'tableau-de-bord', component: PageDashboardComponent }, - { path: 'supprimer-membre', component: PageDeleteMemberComponent }, - { path: 'supprimer-compte', component: PageDeleteAccountComponent }, + { path: 'ajout-membre', canActivate: [AuthGuard], component: PageAddMemberComponent }, + { path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent }, + { path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent }, + { path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent }, + { path: 'supprimer-compte', canActivate: [AuthGuard], component: PageDeleteAccountComponent }, { path: 'password-oublie', component: PageForgotPasswordComponent }, - { path: 'menu', component: PageMenuSemaineComponent }, - { path: 'repertoire', component: PageRepertoireComponent }, - { path: 'reinitialisation-password', component: PageResetPasswordComponent }, + { path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent }, + { path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent }, + { path: 'reinitialisation-password/:uuid', component: PageResetPasswordComponent }, { path: 'creation-compte', component: PageSignupComponent }, - { path: 'to-do-list', component: PageToDoListComponent }, - { path: 'modifier-membre', component: PageUpdateMemberComponent }, - { path: 'modifier-compte', component: PageUpdateAccountComponent }, - { path: 'ajouter-contact', component: PageAjoutContactComponent }, - { path: 'creation-team', component: PageCreationTeamComponent }, - { path: 'humeur', component: PageHumeurComponent }, + { path: 'page-support', component: PageSupportComponent}, + { path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent }, + { path: 'modifier-membre', canActivate: [AuthGuard], component: PageUpdateMemberComponent }, + { path: 'modifier-compte', canActivate: [AuthGuard], component: PageUpdateAccountComponent }, + { path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent }, + { path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent }, { path: 'footer', component: FooterComponent}, { path: '**', component: PageNotFoundComponent }, ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes, {onSameUrlNavigation:'reload'})], exports: [RouterModule], }) export class AppRoutingModule {} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3f6ed7b..5850a5c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,5 @@ -import { NgModule } from '@angular/core'; +import { NgModule, LOCALE_ID } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; - import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component'; @@ -35,11 +34,16 @@ import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component'; import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; import { AutofocusFixModule } from 'ngx-autofocus-fix'; -import { PageHumeurComponent } from './pages/page-humeur/page-humeur.component'; import { FooterComponent } from './components/footer/footer.component'; import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component'; import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component'; import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; +import { registerLocaleData } from '@angular/common'; +import localeFr from '@angular/common/locales/fr'; +import { CardAvatarComponent } from './components/card-avatar/card-avatar.component'; +import { HumeurComponent } from './components/humeur/humeur.component'; +import { DeconnexionComponent } from './components/deconnexion/deconnexion.component'; +registerLocaleData(localeFr) @NgModule({ declarations: [ @@ -62,7 +66,6 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; SigninComponent, PageDashboardComponent, MeteoComponent, - PageHumeurComponent, CalendrierComponent, CardMemberComponent, ToDoListComponent, @@ -74,10 +77,13 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; PageAjoutContactComponent, PageModifierContactComponent, PageCreationTeamComponent, - PageHumeurComponent, FooterComponent, PageDeleteAccountComponent, PageUpdateAccountComponent, + CardAvatarComponent, + DeconnexionComponent, + HumeurComponent + ], imports: [ BrowserModule, @@ -86,9 +92,10 @@ import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; HttpClientModule, FormsModule, AutofocusFixModule.forRoot(), - DayPilotModule + DayPilotModule, ], providers: [ +{provide: LOCALE_ID, useValue: "fr-FR" } ], bootstrap: [AppComponent], diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts index 86d4f28..c457e30 100644 --- a/src/app/auth.guard.ts +++ b/src/app/auth.guard.ts @@ -39,7 +39,7 @@ export class AuthGuard implements CanActivate { const dateExp = new Date(decodedToken.exp * 1000); if (new Date() >= dateExp) { // le token a expiré, je n'autorise pas l'accès - this.router.navigate(['account/signin']); + this.router.navigate(['accueil']); return false; } } @@ -48,7 +48,7 @@ export class AuthGuard implements CanActivate { return true; } else { console.log('You shall not pass !!!!'); - this.router.navigate(['account/signin']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS) + this.router.navigate(['accueil']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS) return false; } } diff --git a/src/app/components/card-avatar/card-avatar.component.html b/src/app/components/card-avatar/card-avatar.component.html new file mode 100644 index 0000000..4591621 --- /dev/null +++ b/src/app/components/card-avatar/card-avatar.component.html @@ -0,0 +1,13 @@ +
+
+
+
+ +
+
+

{{membre.prenom }} {{membre.nom }}

+
+
+
+
+
diff --git a/src/app/components/card-avatar/card-avatar.component.scss b/src/app/components/card-avatar/card-avatar.component.scss new file mode 100644 index 0000000..91c7e56 --- /dev/null +++ b/src/app/components/card-avatar/card-avatar.component.scss @@ -0,0 +1,20 @@ +#couleur{ + width: 60px; + height: 60px; + margin: 0 auto; + background: black; + +} + +.card { + min-height: 8px; + border: none; + overflow: hidden; + border-radius: 8px; + justify-content: center; +} + + +h3 { + font-size: small; +} diff --git a/src/app/pages/page-humeur/page-humeur.component.spec.ts b/src/app/components/card-avatar/card-avatar.component.spec.ts similarity index 54% rename from src/app/pages/page-humeur/page-humeur.component.spec.ts rename to src/app/components/card-avatar/card-avatar.component.spec.ts index 01c84db..b966873 100644 --- a/src/app/pages/page-humeur/page-humeur.component.spec.ts +++ b/src/app/components/card-avatar/card-avatar.component.spec.ts @@ -1,20 +1,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PageHumeurComponent } from './page-humeur.component'; +import { CardAvatarComponent } from './card-avatar.component'; -describe('PageHumeurComponent', () => { - let component: PageHumeurComponent; - let fixture: ComponentFixture; +describe('CardAvatarComponent', () => { + let component: CardAvatarComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ PageHumeurComponent ] + declarations: [ CardAvatarComponent ] }) .compileComponents(); }); beforeEach(() => { - fixture = TestBed.createComponent(PageHumeurComponent); + fixture = TestBed.createComponent(CardAvatarComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/components/card-avatar/card-avatar.component.ts b/src/app/components/card-avatar/card-avatar.component.ts new file mode 100644 index 0000000..1f9ac37 --- /dev/null +++ b/src/app/components/card-avatar/card-avatar.component.ts @@ -0,0 +1,17 @@ +import { Component, Input, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-card-avatar', + templateUrl: './card-avatar.component.html', + styleUrls: ['./card-avatar.component.scss'] +}) +export class CardAvatarComponent implements OnInit { + @Input() membre: any; + + constructor() { } + + ngOnInit(): void { + } + + +} diff --git a/src/app/components/card-menu/card-menu.component.html b/src/app/components/card-menu/card-menu.component.html index a6a566b..76793e5 100644 --- a/src/app/components/card-menu/card-menu.component.html +++ b/src/app/components/card-menu/card-menu.component.html @@ -1,46 +1,135 @@ -