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="library-header-dial">
<h4 class="library-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h4>
<div class="book-browser-header">
<div class="flex">
<h4 class="entity-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h4>
<p-speedDial
[model]="speedDialItems!"
direction="right"
@@ -11,16 +11,7 @@
</p-speedDial>
</div>
<div *ngIf="isAnyBookSelected()">
<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">
<div class="header-right-items">
<p-dropdown
[options]="sortOptions"
optionLabel="label"
@@ -35,8 +26,8 @@
</div>
</div>
<div class="content-container">
<div class="card-container" *ngIf="books$ | async as books">
<div class="virtual-scroller-container">
<div class="book-card-container" *ngIf="books$ | async as books">
<virtual-scroller *ngIf="books.length > 0" class="virtual-scroller" #scroll [items]="books">
<div class="grid" #container>
<div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems">
@@ -53,4 +44,14 @@
<p>No books available to display.</p>
</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>
@@ -1,34 +1,34 @@
.library-header {
.book-browser-header {
display: flex;
justify-content: space-between;
padding: 8px 16px 8px 16px;
padding: 8px 16px;
background-color: var(--surface-card);
border-radius: 12px 12px 0 0;
margin-bottom: 15px;
align-items: center;
}
.library-header-dial {
display: flex;
.entity-name {
margin: 0;
color: var(--text-color);
}
.library-header-right {
.header-right-items {
display: flex;
gap: 2rem;
align-items: center;
}
.library-name {
margin: 0;
color: var(--text-color);
}
.zoom-controls {
display: flex;
gap: 1rem;
align-items: center;
}
.virtual-scroller-container {
position: relative;
}
.virtual-scroller {
width: 100%;
height: calc(100vh - 210px);
@@ -57,7 +57,19 @@
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;
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[] = [];
ref: DynamicDialogRef | undefined;
isDrawerVisible: boolean = false;
constructor(
private activatedRoute: ActivatedRoute,
@@ -138,10 +139,12 @@ export class BooksBrowserComponent implements OnInit {
} else {
this.selectedBooks.delete(bookId);
}
this.isDrawerVisible = this.selectedBooks.size > 0;
}
deselectAllBooks(): void {
this.selectedBooks.clear();
this.isDrawerVisible = false;
}
isAnyBookSelected(): boolean {