Skip to content

Commit

Permalink
Merge pull request #188 from FlyingPAD/develop
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
FlyingPAD authored Oct 31, 2024
2 parents d061913 + 3b8cf17 commit f122bbd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
32 changes: 14 additions & 18 deletions front/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ import { AnimRotation360Directive } from './directives/anim-rotation-360.directi
import { LayoutAboutComponent } from './layouts/layout-about/layout-about.component';

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
let version : string = '1.0.0'
return new TranslateHttpLoader(http, './assets/i18n/', `.json?v=${version}`)
}

export function appInitializerFactory(translate: TranslateService) {
Expand Down Expand Up @@ -313,26 +314,21 @@ export function appInitializerFactory(translate: TranslateService) {
LayoutAboutComponent
],
imports: [
// --- CORE :
BrowserModule,
AppRoutingModule,

// --- NATIVE :
HttpClientModule, // Manual Import
BrowserAnimationsModule, // Enables Animations ( Required for Toastr )

// Toastr Configuration :
HttpClientModule,
BrowserAnimationsModule,
ToastrModule.forRoot({
positionClass: 'toast-bottom-right', // Position des notifications toastr
timeOut: 1500, // Désactive l'autodismiss (0 = infini)
extendedTimeOut: 0, // Désactive le timeout au survol (hover)
progressBar: true, // Affiche une barre de progression
closeButton: true, // Affiche un bouton de fermeture
preventDuplicates: false, // Autorise les duplications
tapToDismiss: true, // Permet la fermeture en cliquant dessus
newestOnTop: true, // Les nouveaux toasts apparaissent en haut
easeTime: 750, // Désactive l'animation
enableHtml: true // Autorise le contenu HTML
positionClass: 'toast-bottom-right',
timeOut: 1500,
extendedTimeOut: 0,
progressBar: true,
closeButton: true,
preventDuplicates: false,
tapToDismiss: true,
newestOnTop: true,
easeTime: 750,
enableHtml: true
}),
CommonModule,
RouterModule,
Expand Down
10 changes: 5 additions & 5 deletions front/src/app/components/left-column/left-column.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<div class="menu-elements">
@if(isUserConnected) {
<a routerLink="/dashboard" routerLinkActive="active">
<a routerLink="/dashboard" routerLinkActive="active" (click)="handleMenuMobile()">
<img [src]="getImageURL('icons-main-menu', 'model', 'png')" />
<p>{{ 'title.dashboard' | translate }}</p>
</a>
Expand All @@ -24,16 +24,16 @@
<p>{{ 'title.home' | translate }}</p>
</a>
}
<a routerLink="/scripts" routerLinkActive="active">
<a routerLink="/scripts" routerLinkActive="active" (click)="handleMenuMobile()">
<img [src]="getImageURL('icons-main-menu', 'scripts', 'png')" />
<p>Scripts</p>
</a>
<a routerLink="/tools" routerLinkActive="active">
<a routerLink="/tools" routerLinkActive="active" (click)="handleMenuMobile()">
<img [src]="getImageURL('icons-main-menu', 'tools', 'png')" />
<p>{{ 'title.tools' | translate }}</p>
</a>
@if(!isUserConnected) {
<a routerLink="/links" routerLinkActive="active">
<a routerLink="/links" routerLinkActive="active" (click)="handleMenuMobile()">
<img [src]="getImageURL('icons-main-menu', 'links', 'png')" />
<p>{{ 'title.links' | translate }}</p>
</a>
Expand Down Expand Up @@ -68,7 +68,7 @@
<p>{{ 'title.log-in' | translate }}</p>
</a>
}
<a routerLink="/settings">
<a routerLink="/settings" (click)="handleMenuMobile()">
<img [src]="getImageURL('icons-main-menu', 'settings', 'png')" />
<p>{{ 'title.settings' | translate }}</p>
</a>
Expand Down
11 changes: 10 additions & 1 deletion front/src/app/components/left-column/left-column.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, EventEmitter, inject, Input, Output } from '@angular/core';
import { ImageUrlService } from '../../services/display/image-url.service';
import { LanguageService } from '../../services/display/language.service';
import { DisplayService } from '../../services/display/display.service';

@Component({
selector: 'app-left-column',
Expand All @@ -10,7 +11,10 @@ import { LanguageService } from '../../services/display/language.service';
export class LeftColumnComponent {
#languageService = inject(LanguageService)
#imageUrlService = inject(ImageUrlService)
currentLanguage = this.#languageService.currentLanguage
#displayService = inject(DisplayService)

public currentLanguage = this.#languageService.currentLanguage
public displayInfo = this.#displayService.displayInfo

isLanguageMenuON : boolean = false

Expand All @@ -30,6 +34,11 @@ export class LeftColumnComponent {
this.menuToggle.emit()
}

public handleMenuMobile(): void {
if(this.displayInfo().mode === 'Mobile') {
this.handleMenuToggle()
}
}
public handleLogout(): void {
this.logout.emit()
}
Expand Down

0 comments on commit f122bbd

Please sign in to comment.