Browse Source

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

Signed-off-by: Baptiste Lemoine <contact@cipherbliss.com>
develop
Baptiste Lemoine 2 years ago
parent
commit
b4f496b08d
  1. 44
      src/app/app-routing.module.ts
  2. 22
      src/app/app.component.ts
  3. 10
      src/app/core/components/header/header.component.html
  4. 1
      src/app/core/enums/theme.enum.ts
  5. 2
      src/app/features/administration/administration.component.html
  6. 46
      src/app/routes-framadate.ts

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

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

10
src/app/core/components/header/header.component.html

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

1
src/app/core/enums/theme.enum.ts

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

2
src/app/features/administration/administration.component.html

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

46
src/app/routes-framadate.ts

@ -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'},
];
Loading…
Cancel
Save