Commit 00e45d3c authored by Romain DELEAU's avatar Romain DELEAU

change lang icons + reactivate leave security popup

parent d7570dc3
...@@ -154,10 +154,16 @@ ...@@ -154,10 +154,16 @@
<div class="container-settings container-settings-secondline"> <div class="container-settings container-settings-secondline">
<button mat-mini-fab color="white" style="font-size: 20px;" [matMenuTriggerFor]="changeLanguageMenu" <button mat-mini-fab color="white" style="font-size: 20px;" [matMenuTriggerFor]="changeLanguageMenu"
[matTooltip]="translate.instant('lang_tooltip')" [matTooltip]="translate.instant('lang_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">{{langEmoji}}</button> matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"><img class="langIcon" [src]="'../assets/lang/icons/'+selectedLang+'.png'"></button>
<mat-menu #changeLanguageMenu="matMenu"> <mat-menu #changeLanguageMenu="matMenu">
<button mat-menu-item (click)="changeLanguage('fr')">🇫🇷 {{'language_fr' | translate}}</button> <button mat-menu-item class="buttonLang" (click)="changeLanguage('fr')">
<button mat-menu-item (click)="changeLanguage('en')">🇬🇧 {{'language_en' | translate}}</button> <img class="langIcon" src="../assets/lang/icons/fr.png"/>
<div>{{'language_fr' | translate}}</div>
</button>
<button mat-menu-item class="buttonLang" (click)="changeLanguage('en')">
<img class="langIcon langIcon-icon" src="../assets/lang/icons/en.png"/>
<div>{{'language_en' | translate}}</div>
</button>
</mat-menu> </mat-menu>
<button mat-mini-fab color="white" (click)="downloadManual()" <button mat-mini-fab color="white" (click)="downloadManual()"
[matTooltip]="translate.instant('manual_tooltip')" [matTooltip]="translate.instant('manual_tooltip')"
......
...@@ -250,6 +250,21 @@ ...@@ -250,6 +250,21 @@
} }
} }
} }
.langIcon {
width: 28px;
height: 28px;
}
.buttonLang {
display: flex;
flex-direction: row;
img {
margin-top: 10px;
margin-right: 5px;
}
}
::ng-deep .mat-tooltip { ::ng-deep .mat-tooltip {
font-size: 15px; font-size: 15px;
......
...@@ -49,7 +49,6 @@ export class AppComponent { ...@@ -49,7 +49,6 @@ export class AppComponent {
scenario: Scenario = new Scenario(); scenario: Scenario = new Scenario();
@ViewChild('fileInput') fileInput: any; @ViewChild('fileInput') fileInput: any;
selectedLang: string = 'en'; selectedLang: string = 'en';
langEmoji: string = '🇬🇧';
constructor(private cdr: ChangeDetectorRef, private http: HttpClient, protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService, constructor(private cdr: ChangeDetectorRef, private http: HttpClient, protected pieceDetailsService: PieceDetailsService, protected tooltipService: TooltipService,
private elementRef: ElementRef, private zoomService: ZoomService, private dialog: MatDialog, private titleService: Title, private elementRef: ElementRef, private zoomService: ZoomService, private dialog: MatDialog, private titleService: Title,
...@@ -65,10 +64,6 @@ export class AppComponent { ...@@ -65,10 +64,6 @@ export class AppComponent {
this.selectedLang = selectedLang; this.selectedLang = selectedLang;
} }
translate.use(this.selectedLang); translate.use(this.selectedLang);
switch(selectedLang) {
case 'en': this.langEmoji = '🇬🇧'; break;
case 'fr': this.langEmoji = '🇫🇷'; break;
}
pieceDetailsService.piece = this.scenario; pieceDetailsService.piece = this.scenario;
...@@ -87,14 +82,14 @@ export class AppComponent { ...@@ -87,14 +82,14 @@ export class AppComponent {
observe: false observe: false
}) })
} }
/*
@HostListener('window:beforeunload', ['$event']) @HostListener('window:beforeunload', ['$event'])
beforeUnloadHandler(event: any) { beforeUnloadHandler(event: any) {
const message = "Êtes vous sûr de vouloir quitter RLG Maker ?\nVous risquez de perdre les données non sauvegardées."; const message = "Êtes vous sûr de vouloir quitter RLG Maker ?\nVous risquez de perdre les données non sauvegardées.";
event.returnValue = message; event.returnValue = message;
return message; return message;
} }
*/
@HostListener('document:keydown', ['$event']) @HostListener('document:keydown', ['$event'])
onKeyDown(event: KeyboardEvent) { onKeyDown(event: KeyboardEvent) {
if (event.ctrlKey && event.key === 's') { if (event.ctrlKey && event.key === 's') {
...@@ -123,8 +118,8 @@ export class AppComponent { ...@@ -123,8 +118,8 @@ export class AppComponent {
changeLanguage(lang: string): void { changeLanguage(lang: string): void {
if (lang !== this.selectedLang) { if (lang !== this.selectedLang) {
switch(lang) { switch(lang) {
case 'fr': this.selectedLang = 'fr'; this.translate.use('fr'); this.langEmoji = '🇫🇷'; break; case 'fr': this.selectedLang = 'fr'; this.translate.use('fr'); break;
case 'en': this.selectedLang = 'en'; this.translate.use('en'); this.langEmoji = '🇬🇧'; break; case 'en': this.selectedLang = 'en'; this.translate.use('en'); break;
} }
this.minimapService.reset(); this.minimapService.reset();
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'change_lang', undefined, undefined, this.selectedLang, 'Scenario')); this.scenario.traces.push(new Trace(this.scenario.traces.length, 'change_lang', undefined, undefined, this.selectedLang, 'Scenario'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment