Move multi select book options to footer

This commit is contained in:
aditya.chandel
2024-12-27 17:50:47 -07:00
parent 8b791e48d4
commit 9f8a1f1269
3 changed files with 43 additions and 27 deletions
@@ -1,6 +1,6 @@
<div class="library-header"> <div class="book-browser-header">
<div class="library-header-dial"> <div class="flex">
<h4 class="library-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h4> <h4 class="entity-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h4>
<p-speedDial <p-speedDial
[model]="speedDialItems!" [model]="speedDialItems!"
direction="right" direction="right"
@@ -11,16 +11,7 @@
</p-speedDial> </p-speedDial>
</div> </div>
<div *ngIf="isAnyBookSelected()"> <div class="header-right-items">
<div class="button-container">
<p-button *ngIf="(entityType$ | async) === 'Library'" icon="pi pi-ellipsis-v" label="Options" severity="primary" [rounded]="true" [outlined]="true" (click)="menu.toggle($event)"></p-button>
<p-button *ngIf="(entityType$ | async) === 'Shelf'" icon="pi pi-minus-circle" label="Unshelf" severity="primary" [rounded]="true" [outlined]="true" (click)="unshelfBooks()"></p-button>
<p-button icon="pi pi-times" label="Deselect" severity="warning" [rounded]="true" [outlined]="true" (click)="deselectAllBooks()"></p-button>
</div>
<p-menu #menu [model]="multiSelectItems" [popup]="true" appendTo="body"></p-menu>
</div>
<div class="library-header-right">
<p-dropdown <p-dropdown
[options]="sortOptions" [options]="sortOptions"
optionLabel="label" optionLabel="label"
@@ -35,8 +26,8 @@
</div> </div>
</div> </div>
<div class="content-container"> <div class="virtual-scroller-container">
<div class="card-container" *ngIf="books$ | async as books"> <div class="book-card-container" *ngIf="books$ | async as books">
<virtual-scroller *ngIf="books.length > 0" class="virtual-scroller" #scroll [items]="books"> <virtual-scroller *ngIf="books.length > 0" class="virtual-scroller" #scroll [items]="books">
<div class="grid" #container> <div class="grid" #container>
<div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems"> <div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems">
@@ -53,4 +44,14 @@
<p>No books available to display.</p> <p>No books available to display.</p>
</div> </div>
</div> </div>
<div class="book-browser-footer" *ngIf="selectedBooks.size > 0">
<div class="footer-items-container">
<p-button *ngIf="(entityType$ | async) === 'Library'" icon="pi pi-ellipsis-v" label="Options" severity="primary" [outlined]="true" (click)="menu.toggle($event)"></p-button>
<p-button *ngIf="(entityType$ | async) === 'Shelf'" icon="pi pi-minus-circle" label="Unshelf" severity="primary" [outlined]="true" (click)="unshelfBooks()"></p-button>
<p-button icon="pi pi-times" label="Deselect" severity="warning" [outlined]="true" (click)="deselectAllBooks()"></p-button>
</div>
<p-menu #menu [model]="multiSelectItems" [popup]="true" appendTo="body"></p-menu>
</div>
</div> </div>
@@ -1,34 +1,34 @@
.library-header { .book-browser-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 8px 16px 8px 16px; padding: 8px 16px;
background-color: var(--surface-card); background-color: var(--surface-card);
border-radius: 12px 12px 0 0; border-radius: 12px 12px 0 0;
margin-bottom: 15px; margin-bottom: 15px;
align-items: center; align-items: center;
} }
.library-header-dial { .entity-name {
display: flex; margin: 0;
color: var(--text-color);
} }
.library-header-right { .header-right-items {
display: flex; display: flex;
gap: 2rem; gap: 2rem;
align-items: center; align-items: center;
} }
.library-name {
margin: 0;
color: var(--text-color);
}
.zoom-controls { .zoom-controls {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
align-items: center; align-items: center;
} }
.virtual-scroller-container {
position: relative;
}
.virtual-scroller { .virtual-scroller {
width: 100%; width: 100%;
height: calc(100vh - 210px); height: calc(100vh - 210px);
@@ -57,7 +57,19 @@
justify-content: space-around; justify-content: space-around;
} }
.button-container { .book-browser-footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: var(--surface-card);
padding: 1rem;
box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.1);
display: flex; display: flex;
gap: 10px; /* Adds 10px space between buttons */ }
.footer-items-container {
display: flex;
justify-content: space-between;
gap: 1.5rem;
} }
@@ -35,6 +35,7 @@ export class BooksBrowserComponent implements OnInit {
sortOptions: SortOption[] = []; sortOptions: SortOption[] = [];
ref: DynamicDialogRef | undefined; ref: DynamicDialogRef | undefined;
isDrawerVisible: boolean = false;
constructor( constructor(
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
@@ -138,10 +139,12 @@ export class BooksBrowserComponent implements OnInit {
} else { } else {
this.selectedBooks.delete(bookId); this.selectedBooks.delete(bookId);
} }
this.isDrawerVisible = this.selectedBooks.size > 0;
} }
deselectAllBooks(): void { deselectAllBooks(): void {
this.selectedBooks.clear(); this.selectedBooks.clear();
this.isDrawerVisible = false;
} }
isAnyBookSelected(): boolean { isAnyBookSelected(): boolean {