From b4f496b08dbd2bdea757b9f2feb1007a81d8b86e Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Mon, 14 Sep 2020 16:07:09 +0200 Subject: [PATCH] :alien: i18n header menu, :gears: splits routes, :fix: RED theme fix in switch Signed-off-by: Baptiste Lemoine --- src/app/app-routing.module.ts | 44 ++---------------- src/app/app.component.ts | 22 +++++---- .../components/header/header.component.html | 10 ++-- src/app/core/enums/theme.enum.ts | 1 + .../administration.component.html | 2 +- src/app/routes-framadate.ts | 46 +++++++++++++++++++ 6 files changed, 70 insertions(+), 55 deletions(-) create mode 100644 src/app/routes-framadate.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b054f1fc..5e91c5eb 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,45 +1,7 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {routes} from "./routes-framadate"; -import { HomeComponent } from './core/components/home/home.component'; -import { PollService } from './core/services/poll.service'; -import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.component'; - -const routes: Routes = [ - { path: '', component: HomeComponent }, - { - path: 'user', - loadChildren: () => import('./features/user-profile/user-profile.module').then((m) => m.UserProfileModule), - }, - { - path: 'administration', - loadChildren: () => - import('./features/administration/administration.module').then((m) => m.AdministrationModule), - resolve: { poll: PollService }, - }, - { - path: 'poll/:slug/administration', - loadChildren: () => - import('./features/administration/administration.module').then((m) => m.AdministrationModule), - resolve: { poll: PollService }, - }, - { - path: 'poll/:slug/consultation', - loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule), - resolve: { poll: PollService }, - }, - { - path: 'poll/:slug/participation', - loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule), - resolve: { poll: PollService }, - }, - { - path: 'oldstuff', - loadChildren: () => import('./features/old-stuff/old-stuff.module').then((m) => m.OldStuffModule), - }, - { path: 'page-not-found', component: PageNotFoundComponent }, - { path: '**', redirectTo: 'page-not-found', pathMatch: 'full' }, -]; @NgModule({ imports: [ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 312f5ac6..5a8dcc6c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,12 +1,12 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { Title } from '@angular/platform-browser'; -import { Subscription } from 'rxjs'; +import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Title} from '@angular/platform-browser'; +import {Subscription} from 'rxjs'; -import { environment } from '../environments/environment'; -import { Theme } from './core/enums/theme.enum'; -import { LanguageService } from './core/services/language.service'; -import { ThemeService } from './core/services/theme.service'; -import { MockingService } from './core/services/mocking.service'; +import {environment} from '../environments/environment'; +import {Theme} from './core/enums/theme.enum'; +import {LanguageService} from './core/services/language.service'; +import {ThemeService} from './core/services/theme.service'; +import {MockingService} from './core/services/mocking.service'; @Component({ selector: 'app-root', @@ -25,7 +25,8 @@ export class AppComponent implements OnInit, OnDestroy { private themeService: ThemeService, private languageService: LanguageService, private mockingService: MockingService - ) {} + ) { + } ngOnInit(): void { if (!environment.production) { @@ -43,6 +44,9 @@ export class AppComponent implements OnInit, OnDestroy { case Theme.CONTRAST: this.themeClass = 'theme-hot-covid'; break; + case Theme.RED: + this.themeClass = 'theme-hot-covid'; + break; default: this.themeClass = 'theme-light-watermelon'; } diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index 8e147afa..fae62667 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -7,7 +7,9 @@ {{ appTitle }} - (dev) + + (dev) + @@ -26,11 +28,11 @@