Change header display in selection mode.

This commit is contained in:
Florian THIERRY
2022-03-04 17:40:47 +01:00
parent 760e08a595
commit 3819b859fe
4 changed files with 32 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<nav> <nav *ngIf="!selectionMode">
<span class="title" routerLink="/"> <span class="title" routerLink="/">
To Do To Do
</span> </span>
@@ -16,3 +16,12 @@
Liste active : {{activeTaskList.name}} Liste active : {{activeTaskList.name}}
</div> </div>
</nav> </nav>
<nav *ngIf="selectionMode" class="selectionMode">
<div></div>
<div>
Cliquez sur une liste pour la sélectionner
</div>
<div class="actions">
<button mat-raised-button (click)="disableSelectionMode()">Annuler</button>
</div>
</nav>

View File

@@ -7,6 +7,20 @@ nav {
align-items: center; align-items: center;
height: 4rem; height: 4rem;
&.selectionMode {
font-weight: bold;
background-color: #185eb4;
color: white;
display: flex;
justify-content: center;
.actions {
position: absolute;
right: 0;
margin: 0 1rem;
}
}
.title { .title {
font-size: 1.5rem; font-size: 1.5rem;
margin: 0 1rem; margin: 0 1rem;

View File

@@ -14,6 +14,7 @@ import { TaskListService } from '../../service/task-list.service';
export class HeaderComponent implements OnInit, OnDestroy { export class HeaderComponent implements OnInit, OnDestroy {
private _storeSubscription?: Subscription; private _storeSubscription?: Subscription;
activeTaskList?: TaskList; activeTaskList?: TaskList;
selectionMode = false;
constructor( constructor(
private _dialog: MatDialog, private _dialog: MatDialog,
@@ -24,6 +25,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
ngOnInit(): void { ngOnInit(): void {
this._storeSubscription = this._taskListService.store$.subscribe(store => { this._storeSubscription = this._taskListService.store$.subscribe(store => {
this.activeTaskList = store.taskLists.find(taskList => store.activeTaskListId === taskList.id); this.activeTaskList = store.taskLists.find(taskList => store.activeTaskListId === taskList.id);
this.selectionMode = store.selectionMode;
}); });
} }
@@ -38,4 +40,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
goTaskListsPane(): void { goTaskListsPane(): void {
this._taskListService.removeActiveTaskList(); this._taskListService.removeActiveTaskList();
} }
disableSelectionMode(): void {
this._taskListService.disableSelectionMode();
}
} }

View File

@@ -118,7 +118,8 @@ export class TaskListService {
disableSelectionMode(): void { disableSelectionMode(): void {
const store = this.store; const store = this.store;
store.selectionMode = true; store.selectionMode = false;
store.selectedTaskLists = [];
this._store.next(store); this._store.next(store);
} }
} }