👽 i18n header menu, :gears: splits routes, :fix: RED theme fix in switch

Signed-off-by: Baptiste Lemoine <contact@cipherbliss.com>
This commit is contained in:
Baptiste Lemoine 2020-09-14 16:07:09 +02:00
parent 11b843af29
commit b4f496b08d
6 changed files with 70 additions and 55 deletions

View File

@ -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: [

View File

@ -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';
}

View File

@ -7,7 +7,9 @@
{{ appTitle }}
</span>
<span class="dev-env" *ngIf="!env.production">
(dev)
<i>
(dev)
</i>
</span>
</a>
@ -26,11 +28,11 @@
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
Créer un sondage
<a class="navbar-item" routerLink="/administration" routerLinkActive="is-active">
{{ 'config.title' | translate }}
</a>
<a class="navbar-item" routerLink="user/polls" routerLinkActive="is-active">
Mes sondages
{{ 'config.find_my_polls' | translate }}
</a>
</div>

View File

@ -2,4 +2,5 @@ export enum Theme {
LIGHT = 'LIGHT',
DARK = 'DARK',
CONTRAST = 'CONTRAST',
RED = 'RED',
}

View File

@ -6,6 +6,6 @@
<div class="columns">
<div class="column">
<app-stepper [poll]="poll"></app-stepper>
<!-- <app-stepper [poll]="poll"></app-stepper>-->
</div>
</div>

View File

@ -0,0 +1,46 @@
import {Routes} from "@angular/router";
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";
export 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'},
];