👽 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 {NgModule} from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; 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({ @NgModule({
imports: [ imports: [

View File

@ -1,12 +1,12 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import { Title } from '@angular/platform-browser'; import {Title} from '@angular/platform-browser';
import { Subscription } from 'rxjs'; import {Subscription} from 'rxjs';
import { environment } from '../environments/environment'; import {environment} from '../environments/environment';
import { Theme } from './core/enums/theme.enum'; import {Theme} from './core/enums/theme.enum';
import { LanguageService } from './core/services/language.service'; import {LanguageService} from './core/services/language.service';
import { ThemeService } from './core/services/theme.service'; import {ThemeService} from './core/services/theme.service';
import { MockingService } from './core/services/mocking.service'; import {MockingService} from './core/services/mocking.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -25,7 +25,8 @@ export class AppComponent implements OnInit, OnDestroy {
private themeService: ThemeService, private themeService: ThemeService,
private languageService: LanguageService, private languageService: LanguageService,
private mockingService: MockingService private mockingService: MockingService
) {} ) {
}
ngOnInit(): void { ngOnInit(): void {
if (!environment.production) { if (!environment.production) {
@ -43,6 +44,9 @@ export class AppComponent implements OnInit, OnDestroy {
case Theme.CONTRAST: case Theme.CONTRAST:
this.themeClass = 'theme-hot-covid'; this.themeClass = 'theme-hot-covid';
break; break;
case Theme.RED:
this.themeClass = 'theme-hot-covid';
break;
default: default:
this.themeClass = 'theme-light-watermelon'; this.themeClass = 'theme-light-watermelon';
} }

View File

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

View File

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

View File

@ -6,6 +6,6 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<app-stepper [poll]="poll"></app-stepper> <!-- <app-stepper [poll]="poll"></app-stepper>-->
</div> </div>
</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'},
];