Commit 79c8c71e authored by Romain DELEAU's avatar Romain DELEAU

snackbars success/fail rework

parent d9ebbd0c
...@@ -30,21 +30,17 @@ import { MatDialog } from '@angular/material/dialog'; ...@@ -30,21 +30,17 @@ import { MatDialog } from '@angular/material/dialog';
import { SaveDialogComponent } from './components/dialogs/save-dialog/save-dialog.component'; import { SaveDialogComponent } from './components/dialogs/save-dialog/save-dialog.component';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { LoadingsucessSnackbarComponent } from './components/snackbars/loadingsucess-snackbar/loadingsucess-snackbar.component';
import { LoadingfailSnackbarComponent } from './components/snackbars/loadingfail-snackbar/loadingfail-snackbar.component';
import { Trace } from './class/trace/trace'; import { Trace } from './class/trace/trace';
import Minimap from 'js-minimap'; import Minimap from 'js-minimap';
import { MinimapService } from './services/minimap/minimap.service'; import { MinimapService } from './services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from './services/tutorial/tutorial.service'; import { TutorialService } from './services/tutorial/tutorial.service';
import { VerifyGameFailSnackbarComponent } from './components/snackbars/verify-game-fail-snackbar/verify-game-fail-snackbar.component';
import { VerifyDialogComponent } from './components/dialogs/verify-dialog/verify-dialog.component'; import { VerifyDialogComponent } from './components/dialogs/verify-dialog/verify-dialog.component';
import { LegalDialogComponent } from './components/dialogs/legal-dialog/legal-dialog.component'; import { LegalDialogComponent } from './components/dialogs/legal-dialog/legal-dialog.component';
import { CreateOptionnalTaskDialogComponent } from './components/dialogs/create-optionnal-task-dialog/create-optionnal-task-dialog.component'; import { CreateOptionnalTaskDialogComponent } from './components/dialogs/create-optionnal-task-dialog/create-optionnal-task-dialog.component';
import { UnityService } from './services/unity/unity.service'; import { UnityService } from './services/unity/unity.service';
import { Discussion } from './class/discussion/discussion'; import { Discussion } from './class/discussion/discussion';
import { Response } from './class/response/response'; import { Response } from './class/response/response';
import { Sentence } from './class/sentence/sentence';
import { InterrogativeSentence } from './class/sentence/interrogativeSentence/interrogative-sentence'; import { InterrogativeSentence } from './class/sentence/interrogativeSentence/interrogative-sentence';
import { DeclarativeSentence } from './class/sentence/declarativeSentence/declarative-sentence'; import { DeclarativeSentence } from './class/sentence/declarativeSentence/declarative-sentence';
import { ObjectReward } from './class/rewards/object-reward/object-reward'; import { ObjectReward } from './class/rewards/object-reward/object-reward';
...@@ -600,10 +596,10 @@ export class AppComponent { ...@@ -600,10 +596,10 @@ export class AppComponent {
this.titleService.setTitle('RLG Maker'); this.titleService.setTitle('RLG Maker');
} }
this.cdr.detectChanges(); this.cdr.detectChanges();
this._snackBar.openFromComponent(LoadingsucessSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_loading_success'), '', { duration: 5000, panelClass: 'snackbar-success' });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
this._snackBar.openFromComponent(LoadingfailSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_loading_fail'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
}; };
} }
...@@ -769,7 +765,7 @@ export class AppComponent { ...@@ -769,7 +765,7 @@ export class AppComponent {
data: this.scenario data: this.scenario
}); });
} else { } else {
this._snackBar.openFromComponent(VerifyGameFailSnackbarComponent, { duration: 10000 }); this._snackBar.open(this.translate.instant('verify_error'), '', { duration: 10000, panelClass: 'snackbar-fail' });
} }
} }
......
...@@ -41,26 +41,16 @@ import { CleanDialogComponent } from './components/dialogs/clean-dialog/clean-di ...@@ -41,26 +41,16 @@ import { CleanDialogComponent } from './components/dialogs/clean-dialog/clean-di
import { CreateDialogComponent } from './components/dialogs/create-dialog/create-dialog.component'; import { CreateDialogComponent } from './components/dialogs/create-dialog/create-dialog.component';
import { GameCharactersComponent } from './pieces/game-characters/game-characters.component'; import { GameCharactersComponent } from './pieces/game-characters/game-characters.component';
import { SaveDialogComponent } from './components/dialogs/save-dialog/save-dialog.component'; import { SaveDialogComponent } from './components/dialogs/save-dialog/save-dialog.component';
import { IdentifierSnackbarComponent } from './components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { LoadingsucessSnackbarComponent } from './components/snackbars/loadingsucess-snackbar/loadingsucess-snackbar.component';
import { LoadingfailSnackbarComponent } from './components/snackbars/loadingfail-snackbar/loadingfail-snackbar.component';
import { HttpClient, HttpClientModule } from '@angular/common/http'; import { HttpClient, HttpClientModule } from '@angular/common/http';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TutorialComponent } from './components/tutorial/tutorial.component'; import { TutorialComponent } from './components/tutorial/tutorial.component';
import { FinishTutorialComponent } from './components/snackbars/finish-tutorial/finish-tutorial.component';
import { VerifyGameFailSnackbarComponent } from './components/snackbars/verify-game-fail-snackbar/verify-game-fail-snackbar.component';
import { VerifyDialogComponent } from './components/dialogs/verify-dialog/verify-dialog.component'; import { VerifyDialogComponent } from './components/dialogs/verify-dialog/verify-dialog.component';
import { RoleNameDuplicateComponent } from './components/snackbars/role-name-duplicate/role-name-duplicate.component';
import { CopyRoleSuccessComponent } from './components/snackbars/copy-role-success/copy-role-success.component';
import { LegalDialogComponent } from './components/dialogs/legal-dialog/legal-dialog.component'; import { LegalDialogComponent } from './components/dialogs/legal-dialog/legal-dialog.component';
import { RewardsComponent } from './sider-pieces/rewards/rewards.component'; import { RewardsComponent } from './sider-pieces/rewards/rewards.component';
import { MoveOptionnalTasksComponent } from './components/snackbars/move-optionnal-tasks/move-optionnal-tasks.component';
import { CreateOptionnalTaskDialogComponent } from './components/dialogs/create-optionnal-task-dialog/create-optionnal-task-dialog.component'; import { CreateOptionnalTaskDialogComponent } from './components/dialogs/create-optionnal-task-dialog/create-optionnal-task-dialog.component';
import { DeleteOptionnalTasksComponent } from './components/snackbars/delete-optionnal-tasks/delete-optionnal-tasks.component';
import { DiscussionsComponent } from './sider-pieces/discussions/discussions.component'; import { DiscussionsComponent } from './sider-pieces/discussions/discussions.component';
import { DiscussionDialogComponent } from './components/dialogs/discussion-dialog/discussion-dialog.component'; import { DiscussionDialogComponent } from './components/dialogs/discussion-dialog/discussion-dialog.component';
import { CopyTaskSuccessComponent } from './components/snackbars/copy-task-success/copy-task-success.component';
export function HttpLoaderFactory(http: HttpClient) { export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http); return new TranslateHttpLoader(http);
...@@ -96,23 +86,13 @@ export function HttpLoaderFactory(http: HttpClient) { ...@@ -96,23 +86,13 @@ export function HttpLoaderFactory(http: HttpClient) {
CreateDialogComponent, CreateDialogComponent,
GameCharactersComponent, GameCharactersComponent,
SaveDialogComponent, SaveDialogComponent,
IdentifierSnackbarComponent,
LoadingsucessSnackbarComponent,
LoadingfailSnackbarComponent,
TutorialComponent, TutorialComponent,
FinishTutorialComponent,
VerifyGameFailSnackbarComponent,
VerifyDialogComponent, VerifyDialogComponent,
RoleNameDuplicateComponent,
CopyRoleSuccessComponent,
LegalDialogComponent, LegalDialogComponent,
RewardsComponent, RewardsComponent,
MoveOptionnalTasksComponent,
CreateOptionnalTaskDialogComponent, CreateOptionnalTaskDialogComponent,
DeleteOptionnalTasksComponent,
DiscussionsComponent, DiscussionsComponent,
DiscussionDialogComponent, DiscussionDialogComponent
CopyTaskSuccessComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
......
<span matSnackBarLabel>{{'role_copy_snackbar' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #1ba345;
color: white;
box-shadow: 0px 0px 15px 5px #1ba345;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CopyRoleSuccessComponent } from './copy-role-success.component';
describe('CopyRoleSuccessComponent', () => {
let component: CopyRoleSuccessComponent;
let fixture: ComponentFixture<CopyRoleSuccessComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CopyRoleSuccessComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(CopyRoleSuccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-copy-role-success',
templateUrl: './copy-role-success.component.html',
styleUrls: ['./copy-role-success.component.scss']
})
export class CopyRoleSuccessComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'task_copy_snackbar' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #1ba345;
color: white;
box-shadow: 0px 0px 15px 5px #1ba345;
text-align: center;
white-space: pre-wrap;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CopyTaskSuccessComponent } from './copy-task-success.component';
describe('CopyTaskSuccessComponent', () => {
let component: CopyTaskSuccessComponent;
let fixture: ComponentFixture<CopyTaskSuccessComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CopyTaskSuccessComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(CopyTaskSuccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-copy-task-success',
templateUrl: './copy-task-success.component.html',
styleUrls: ['./copy-task-success.component.scss']
})
export class CopyTaskSuccessComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_deleteOptionnalTask' | translate}}</span>
::ng-deep .mat-snack-bar-container {
background-color: #ffa808;
color: white;
box-shadow: 0px 0px 15px 5px #ffa808;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DeleteOptionnalTasksComponent } from './delete-optionnal-tasks.component';
describe('DeleteOptionnalTasksComponent', () => {
let component: DeleteOptionnalTasksComponent;
let fixture: ComponentFixture<DeleteOptionnalTasksComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DeleteOptionnalTasksComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(DeleteOptionnalTasksComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-delete-optionnal-tasks',
templateUrl: './delete-optionnal-tasks.component.html',
styleUrls: ['./delete-optionnal-tasks.component.scss']
})
export class DeleteOptionnalTasksComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'tutorial_finish' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #1ba345;
color: white;
box-shadow: 0px 0px 15px 5px #1ba345;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FinishTutorialComponent } from './finish-tutorial.component';
describe('FinishTutorialComponent', () => {
let component: FinishTutorialComponent;
let fixture: ComponentFixture<FinishTutorialComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FinishTutorialComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(FinishTutorialComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-finish-tutorial',
templateUrl: './finish-tutorial.component.html',
styleUrls: ['./finish-tutorial.component.scss']
})
export class FinishTutorialComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_identifier' | translate}}</span>
::ng-deep .mat-snack-bar-container {
background-color: #de3e44;
color: white;
box-shadow: 0px 0px 15px 5px #de3e44;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IdentifierSnackbarComponent } from './identifier-snackbar.component';
describe('IdentifierSnackbarComponent', () => {
let component: IdentifierSnackbarComponent;
let fixture: ComponentFixture<IdentifierSnackbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ IdentifierSnackbarComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(IdentifierSnackbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, inject } from '@angular/core';
import { MatSnackBarRef } from '@angular/material/snack-bar';
@Component({
selector: 'app-identifier-snackbar',
templateUrl: './identifier-snackbar.component.html',
styleUrls: ['./identifier-snackbar.component.scss']
})
export class IdentifierSnackbarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_loading_fail' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #de3e44;
color: white;
box-shadow: 0px 0px 15px 5px #de3e44;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoadingfailSnackbarComponent } from './loadingfail-snackbar.component';
describe('LoadingfailSnackbarComponent', () => {
let component: LoadingfailSnackbarComponent;
let fixture: ComponentFixture<LoadingfailSnackbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoadingfailSnackbarComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(LoadingfailSnackbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-loadingfail-snackbar',
templateUrl: './loadingfail-snackbar.component.html',
styleUrls: ['./loadingfail-snackbar.component.scss']
})
export class LoadingfailSnackbarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_loading_success' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #1ba345;
color: white;
box-shadow: 0px 0px 15px 5px #1ba345;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoadingsucessSnackbarComponent } from './loadingsucess-snackbar.component';
describe('LoadingsucessSnackbarComponent', () => {
let component: LoadingsucessSnackbarComponent;
let fixture: ComponentFixture<LoadingsucessSnackbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoadingsucessSnackbarComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(LoadingsucessSnackbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-loadingsucess-snackbar',
templateUrl: './loadingsucess-snackbar.component.html',
styleUrls: ['./loadingsucess-snackbar.component.scss']
})
export class LoadingsucessSnackbarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_moveOptionnalTask' | translate}}</span>
::ng-deep .mat-snack-bar-container {
background-color: #ffa808;
color: white;
box-shadow: 0px 0px 15px 5px #ffa808;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MoveOptionnalTasksComponent } from './move-optionnal-tasks.component';
describe('MoveOptionnalTasksComponent', () => {
let component: MoveOptionnalTasksComponent;
let fixture: ComponentFixture<MoveOptionnalTasksComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ MoveOptionnalTasksComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(MoveOptionnalTasksComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-move-optionnal-tasks',
templateUrl: './move-optionnal-tasks.component.html',
styleUrls: ['./move-optionnal-tasks.component.scss']
})
export class MoveOptionnalTasksComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'snackbar_roleName' | translate}}</span>
::ng-deep .mat-snack-bar-container {
background-color: #de3e44;
color: white;
box-shadow: 0px 0px 15px 5px #de3e44;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RoleNameDuplicateComponent } from './role-name-duplicate.component';
describe('RoleNameDuplicateComponent', () => {
let component: RoleNameDuplicateComponent;
let fixture: ComponentFixture<RoleNameDuplicateComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ RoleNameDuplicateComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(RoleNameDuplicateComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-role-name-duplicate',
templateUrl: './role-name-duplicate.component.html',
styleUrls: ['./role-name-duplicate.component.scss']
})
export class RoleNameDuplicateComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<span matSnackBarLabel>{{'verify_error' | translate}}</span>
\ No newline at end of file
::ng-deep .mat-snack-bar-container {
background-color: #de3e44;
color: white;
box-shadow: 0px 0px 15px 5px #de3e44;
text-align: center;
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { VerifyGameFailSnackbarComponent } from './verify-game-fail-snackbar.component';
describe('VerifyGameFailSnackbarComponent', () => {
let component: VerifyGameFailSnackbarComponent;
let fixture: ComponentFixture<VerifyGameFailSnackbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ VerifyGameFailSnackbarComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(VerifyGameFailSnackbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-verify-game-fail-snackbar',
templateUrl: './verify-game-fail-snackbar.component.html',
styleUrls: ['./verify-game-fail-snackbar.component.scss']
})
export class VerifyGameFailSnackbarComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
...@@ -22,10 +22,8 @@ import { MinimapService } from 'src/app/services/minimap/minimap.service'; ...@@ -22,10 +22,8 @@ import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from 'src/app/services/tutorial/tutorial.service'; import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { RoleNameDuplicateComponent } from 'src/app/components/snackbars/role-name-duplicate/role-name-duplicate.component';
import { CopyRoleService } from 'src/app/services/copyRole/copy-role.service'; import { CopyRoleService } from 'src/app/services/copyRole/copy-role.service';
import { Task } from 'src/app/class/task/task'; import { Task } from 'src/app/class/task/task';
import { CopyRoleSuccessComponent } from 'src/app/components/snackbars/copy-role-success/copy-role-success.component';
import { RoleOccurrence } from 'src/app/class/role-occurrence/role-occurrence'; import { RoleOccurrence } from 'src/app/class/role-occurrence/role-occurrence';
import { ObjectReward } from 'src/app/class/rewards/object-reward/object-reward'; import { ObjectReward } from 'src/app/class/rewards/object-reward/object-reward';
import { Reward } from 'src/app/class/rewards/reward'; import { Reward } from 'src/app/class/rewards/reward';
...@@ -141,7 +139,7 @@ export class RoleComponent implements OnInit { ...@@ -141,7 +139,7 @@ export class RoleComponent implements OnInit {
} }
}); });
this.copyRoleService.mission = this.mission; this.copyRoleService.mission = this.mission;
this._snackBar.openFromComponent(CopyRoleSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('role_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
onClickPaste(): void { onClickPaste(): void {
...@@ -723,7 +721,7 @@ export class RoleComponent implements OnInit { ...@@ -723,7 +721,7 @@ export class RoleComponent implements OnInit {
intituleIsAlreadyUsed(): void { intituleIsAlreadyUsed(): void {
this.mission.roles.forEach(role => { this.mission.roles.forEach(role => {
if (role != this.role && role.intitule == this.role.intitule) { if (role != this.role && role.intitule == this.role.intitule) {
this._snackBar.openFromComponent(RoleNameDuplicateComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_roleName'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.role.intitule = ''; this.role.intitule = '';
} }
}); });
......
...@@ -12,15 +12,12 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service'; ...@@ -12,15 +12,12 @@ import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component'; import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dialog/suppress-dialog.component';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component'; import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { Trace } from 'src/app/class/trace/trace'; import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service'; import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from 'src/app/services/tutorial/tutorial.service'; import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { FinishTutorialComponent } from 'src/app/components/snackbars/finish-tutorial/finish-tutorial.component';
import { UnityService } from 'src/app/services/unity/unity.service'; import { UnityService } from 'src/app/services/unity/unity.service';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
@Component({ @Component({
selector: 'app-annexe-task', selector: 'app-annexe-task',
...@@ -59,7 +56,7 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -59,7 +56,7 @@ export class AnnexeTaskComponent implements OnInit {
this.scenario.traces.push(new Trace(this.scenario.traces.length, 'valid_phase', undefined, undefined, 'phase_'+this.tutorialService.phase, 'Tutorial')); this.scenario.traces.push(new Trace(this.scenario.traces.length, 'valid_phase', undefined, undefined, 'phase_'+this.tutorialService.phase, 'Tutorial'));
this.tutorialService.validPhase(); this.tutorialService.validPhase();
if (this.tutorialService.isDone()) { if (this.tutorialService.isDone()) {
this._snackBar.openFromComponent(FinishTutorialComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('tutorial_finish'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
} }
} }
...@@ -161,13 +158,13 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -161,13 +158,13 @@ export class AnnexeTaskComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
onClickPaste() { onClickPaste() {
this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);; this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);;
if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) { if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
(this.role.tasks[this.i][this.j] as Task).identifier = ''; (this.role.tasks[this.i][this.j] as Task).identifier = '';
} }
} }
...@@ -283,7 +280,7 @@ export class AnnexeTaskComponent implements OnInit { ...@@ -283,7 +280,7 @@ export class AnnexeTaskComponent implements OnInit {
}); });
} }
if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) { if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.task.identifier = ''; this.task.identifier = '';
} }
this.editTrace(event, 'Task_identifier'); this.editTrace(event, 'Task_identifier');
......
...@@ -12,12 +12,10 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia ...@@ -12,12 +12,10 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component'; import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { Trace } from 'src/app/class/trace/trace'; import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service'; import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { UnityService } from 'src/app/services/unity/unity.service'; import { UnityService } from 'src/app/services/unity/unity.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
@Component({ @Component({
...@@ -163,13 +161,13 @@ export class FinalTaskComponent implements OnInit { ...@@ -163,13 +161,13 @@ export class FinalTaskComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success'});
} }
onClickPaste() { onClickPaste() {
this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);; this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);;
if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) { if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
(this.role.tasks[this.i][this.j] as Task).identifier = ''; (this.role.tasks[this.i][this.j] as Task).identifier = '';
} }
} }
...@@ -305,7 +303,7 @@ export class FinalTaskComponent implements OnInit { ...@@ -305,7 +303,7 @@ export class FinalTaskComponent implements OnInit {
}); });
} }
if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) { if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.task.identifier = ''; this.task.identifier = '';
} }
this.editTrace(event,'Task_identifier'); this.editTrace(event,'Task_identifier');
......
...@@ -12,15 +12,11 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia ...@@ -12,15 +12,11 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component'; import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { Trace } from 'src/app/class/trace/trace'; import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service'; import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { MoveOptionnalTasksComponent } from 'src/app/components/snackbars/move-optionnal-tasks/move-optionnal-tasks.component';
import { DeleteOptionnalTasksComponent } from 'src/app/components/snackbars/delete-optionnal-tasks/delete-optionnal-tasks.component';
import { UnityService } from 'src/app/services/unity/unity.service'; import { UnityService } from 'src/app/services/unity/unity.service';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
@Component({ @Component({
selector: 'app-optionnal-task', selector: 'app-optionnal-task',
...@@ -138,7 +134,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -138,7 +134,7 @@ export class OptionnalTaskComponent implements OnInit {
} }
this.task.changeType(type); this.task.changeType(type);
if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) { if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) {
this._snackBar.openFromComponent(DeleteOptionnalTasksComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_deleteOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' });
} }
this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']', '#E8E3B3')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform_into_['+type+']',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']', '#E8E3B3'));
} }
...@@ -159,7 +155,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -159,7 +155,7 @@ export class OptionnalTaskComponent implements OnInit {
this.role.removeTask(this.i, this.j); this.role.removeTask(this.i, this.j);
this.mission.equalizeLengths(); this.mission.equalizeLengths();
if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) { if (this.role.countOptionnalTasksInColumn(this.role.getRealIndex(this.i,this.j)) < 2) {
this._snackBar.openFromComponent(DeleteOptionnalTasksComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_deleteOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' });
} }
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']', '#E8E3B3')); this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',this.missionIndex,this.roleIndex,'all','Opt_task_['+this.i+';'+this.j+']', '#E8E3B3'));
} else { } else {
...@@ -170,13 +166,13 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -170,13 +166,13 @@ export class OptionnalTaskComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
onClickPaste() { onClickPaste() {
this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);; this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);;
if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) { if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
(this.role.tasks[this.i][this.j] as Task).identifier = ''; (this.role.tasks[this.i][this.j] as Task).identifier = '';
} }
} }
...@@ -242,7 +238,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -242,7 +238,7 @@ export class OptionnalTaskComponent implements OnInit {
this.displayPrequires = 'hide'; this.displayPrequires = 'hide';
this.displaySymbolChoice = 'hide'; this.displaySymbolChoice = 'hide';
this.mission.equalizeLengths(); this.mission.equalizeLengths();
this._snackBar.openFromComponent(MoveOptionnalTasksComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_moveOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' });
} else if (direction == 'top' && this.canMoveTo('top')) { } else if (direction == 'top' && this.canMoveTo('top')) {
this.role.moveTask(this.i, this.j, direction); this.role.moveTask(this.i, this.j, direction);
this.displayMenu = 'hide'; this.displayMenu = 'hide';
...@@ -255,7 +251,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -255,7 +251,7 @@ export class OptionnalTaskComponent implements OnInit {
this.displayPrequires = 'hide'; this.displayPrequires = 'hide';
this.displaySymbolChoice = 'hide'; this.displaySymbolChoice = 'hide';
this.mission.equalizeLengths(); this.mission.equalizeLengths();
this._snackBar.openFromComponent(MoveOptionnalTasksComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_moveOptionnalTask'), '', { duration: 5000, panelClass: 'snackbar-warning' });
} else if (direction == 'bottom') { } else if (direction == 'bottom') {
this.role.moveTask(this.i, this.j, direction); this.role.moveTask(this.i, this.j, direction);
this.displayMenu = 'hide'; this.displayMenu = 'hide';
...@@ -317,7 +313,7 @@ export class OptionnalTaskComponent implements OnInit { ...@@ -317,7 +313,7 @@ export class OptionnalTaskComponent implements OnInit {
}); });
} }
if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) { if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.task.identifier = ''; this.task.identifier = '';
} }
this.editTrace(event, 'Task_identifier'); this.editTrace(event, 'Task_identifier');
......
...@@ -12,12 +12,10 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia ...@@ -12,12 +12,10 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component'; import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { Trace } from 'src/app/class/trace/trace'; import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service'; import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { UnityService } from 'src/app/services/unity/unity.service'; import { UnityService } from 'src/app/services/unity/unity.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
@Component({ @Component({
...@@ -153,13 +151,13 @@ export class RandomEventComponent implements OnInit { ...@@ -153,13 +151,13 @@ export class RandomEventComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
onClickPaste() { onClickPaste() {
this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);; this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);;
if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) { if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
(this.role.tasks[this.i][this.j] as Task).identifier = ''; (this.role.tasks[this.i][this.j] as Task).identifier = '';
} }
} }
...@@ -299,7 +297,7 @@ export class RandomEventComponent implements OnInit { ...@@ -299,7 +297,7 @@ export class RandomEventComponent implements OnInit {
}); });
} }
if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) { if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.task.identifier = ''; this.task.identifier = '';
} }
this.editTrace(event, 'Task_identifier'); this.editTrace(event, 'Task_identifier');
......
...@@ -17,9 +17,7 @@ import { TutorialService } from 'src/app/services/tutorial/tutorial.service'; ...@@ -17,9 +17,7 @@ import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { Ressource } from 'src/app/class/ressource/ressource'; import { Ressource } from 'src/app/class/ressource/ressource';
import { PrerequireRessource } from 'src/app/class/prerequires/prerequire-ressource/prerequire-ressource'; import { PrerequireRessource } from 'src/app/class/prerequires/prerequire-ressource/prerequire-ressource';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
@Component({ @Component({
selector: 'app-repeat-task', selector: 'app-repeat-task',
...@@ -95,7 +93,7 @@ export class RepeatTaskComponent implements OnInit { ...@@ -95,7 +93,7 @@ export class RepeatTaskComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 5000, panelClass: 'snackbar-success' });
} }
onClickPaste() { onClickPaste() {
......
...@@ -12,14 +12,12 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia ...@@ -12,14 +12,12 @@ import { SuppressDialogComponent } from 'src/app/components/dialogs/suppress-dia
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component'; import { CleanDialogComponent } from 'src/app/components/dialogs/clean-dialog/clean-dialog.component';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { IdentifierSnackbarComponent } from 'src/app/components/snackbars/identifier-snackbar/identifier-snackbar.component';
import { Trace } from 'src/app/class/trace/trace'; import { Trace } from 'src/app/class/trace/trace';
import { MinimapService } from 'src/app/services/minimap/minimap.service'; import { MinimapService } from 'src/app/services/minimap/minimap.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { TutorialService } from 'src/app/services/tutorial/tutorial.service'; import { TutorialService } from 'src/app/services/tutorial/tutorial.service';
import { UnityService } from 'src/app/services/unity/unity.service'; import { UnityService } from 'src/app/services/unity/unity.service';
import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service'; import { CopyTaskService } from 'src/app/services/copyTask/copy-task.service';
import { CopyTaskSuccessComponent } from 'src/app/components/snackbars/copy-task-success/copy-task-success.component';
@Component({ @Component({
selector: 'app-task', selector: 'app-task',
...@@ -164,13 +162,13 @@ export class TaskComponent implements OnInit { ...@@ -164,13 +162,13 @@ export class TaskComponent implements OnInit {
onClickCopy() { onClickCopy() {
this.copyTaskService.onClickCopy(this.scenario, this.role, this.task); this.copyTaskService.onClickCopy(this.scenario, this.role, this.task);
this._snackBar.openFromComponent(CopyTaskSuccessComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('task_copy_snackbar'), '', { duration: 50000, panelClass: 'snackbar-success' });
} }
onClickPaste() { onClickPaste() {
this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);; this.role.tasks[this.i][this.j] = this.copyTaskService.onClickPaste(this.scenario);;
if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) { if (this.role.isAlreadyUsedIdentifier((this.role.tasks[this.i][this.j] as Task).identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
(this.role.tasks[this.i][this.j] as Task).identifier = ''; (this.role.tasks[this.i][this.j] as Task).identifier = '';
} }
} }
...@@ -325,7 +323,7 @@ export class TaskComponent implements OnInit { ...@@ -325,7 +323,7 @@ export class TaskComponent implements OnInit {
}); });
} }
if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) { if (this.role.isAlreadyUsedIdentifier(this.task.identifier)) {
this._snackBar.openFromComponent(IdentifierSnackbarComponent, { duration: 5000 }); this._snackBar.open(this.translate.instant('snackbar_identifier'), '', { duration: 5000, panelClass: 'snackbar-fail' });
this.task.identifier = ''; this.task.identifier = '';
} }
this.editTrace(event, 'Task_identifier'); this.editTrace(event, 'Task_identifier');
......
...@@ -29,6 +29,6 @@ export class TutorialService { ...@@ -29,6 +29,6 @@ export class TutorialService {
} }
isDone(): boolean { isDone(): boolean {
return this.phaseDone.some(phase => false); return !this.phaseDone.some(phase => false);
} }
} }
...@@ -99,4 +99,50 @@ $highlight-color: #009b00; ...@@ -99,4 +99,50 @@ $highlight-color: #009b00;
right: 0px; right: 0px;
bottom: 0px; bottom: 0px;
border: 1px solid black; border: 1px solid black;
} }
\ No newline at end of file
.snackbar-fail {
background-color: #de3e44;
color: white;
box-shadow: 0px 0px 15px 5px #de3e44;
text-align: center;
white-space: pre-wrap;
text-align: center;
span {
font-family: 'Glacial Indifference', sans-serif;
font-size: 16px;
margin-left: auto;
margin-right: auto;
}
}
.snackbar-success {
background-color: #1ba345;
color: white;
box-shadow: 0px 0px 15px 5px #1ba345;
text-align: center;
white-space: pre-wrap;
text-align: center;
span {
font-family: 'Glacial Indifference', sans-serif;
font-size: 16px;
margin-left: auto;
margin-right: auto;
}
}
.snackbar-warning {
background-color: #ffa808;
color: white;
box-shadow: 0px 0px 15px 5px #ffa808;
text-align: center;
white-space: pre-wrap;
text-align: center;
span {
font-family: 'Glacial Indifference', sans-serif;
font-size: 16px;
margin-left: auto;
margin-right: auto;
}
}
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