Use tailwind for shelf assigner

This commit is contained in:
aditya.chandel
2025-01-17 11:44:06 -07:00
parent f5e1c1e7c8
commit 1029a56012
5 changed files with 34 additions and 83 deletions
@@ -321,8 +321,6 @@ export class BookBrowserComponent implements OnInit {
header: `Update Books Shelves`,
modal: true,
closable: true,
width: '30%',
height: '60%',
contentStyle: {overflow: 'auto'},
baseZIndex: 10,
style: {
@@ -84,10 +84,13 @@ export class BookCardComponent implements OnInit {
this.dialogService.open(ShelfAssignerComponent, {
header: `Update Shelves: ${book.metadata?.title}`,
modal: true,
width: '30%',
height: '70%',
closable: true,
contentStyle: {overflow: 'auto'},
baseZIndex: 10,
style: {
position: 'absolute',
top: '15%',
},
data: {
book: this.book
},
@@ -4,14 +4,10 @@ import {catchError, debounceTime, distinctUntilChanged, switchMap} from 'rxjs/op
import {Book} from '../../model/book.model';
import {FormsModule} from '@angular/forms';
import {InputTextModule} from 'primeng/inputtext';
import {Router} from '@angular/router';
import {BookService} from '../../service/book.service';
import {BookMetadataCenterComponent} from '../../../metadata/book-metadata-center/book-metadata-center.component';
import {DialogService} from 'primeng/dynamicdialog';
import {Button} from 'primeng/button';
import {NgForOf, NgIf} from '@angular/common';
import {MetadataDialogService} from '../../../metadata/service/metadata-dialog.service';
import {LibraryShelfMenuService} from '../../service/library-shelf-menu.service';
@Component({
selector: 'app-book-searcher',
@@ -1,38 +1,41 @@
<div class="dialog-container">
<div class="checkbox-list">
<div *ngFor="let shelf of (shelfState$ | async)?.shelves" class="flex items-center">
<p-checkbox [inputId]="shelf.name" name="group" [value]="shelf" [(ngModel)]="selectedShelves"></p-checkbox>
<label [for]="shelf.id" class="ml-2">{{ shelf.name }}</label>
</div>
</div>
<div class="p-4 min-w-[26rem] min-h-[30rem] flex flex-col">
<div class="bottom-section">
<p-divider></p-divider>
<div class="bottom-container">
<div class="flex flex-col flex-grow">
<!-- Dynamic shelves content -->
<div *ngFor="let shelf of (shelfState$ | async)?.shelves">
<div class="flex flex-row items-center gap-4 py-2">
<p-checkbox [inputId]="shelf.name" name="group" [value]="shelf" [(ngModel)]="selectedShelves"></p-checkbox>
<label [for]="shelf.id">{{ shelf.name }}</label>
</div>
</div>
<!-- Button section, anchored to the bottom -->
<div class="flex justify-between items-center pt-4 mt-auto">
<p-button outlined="true" label="Create Shelf" (onClick)="createShelfDialog()"></p-button>
<div>
<p-button class="spacing-right" severity="secondary" label="Cancel" (onClick)="closeDialog()"></p-button>
<div class="flex gap-4">
<p-button severity="secondary" label="Cancel" (onClick)="closeDialog()"></p-button>
<p-button label="Save" (onClick)="updateBooksShelves()"></p-button>
</div>
</div>
</div>
<!-- Icon picker component -->
<app-icon-picker (iconSelected)="onIconSelected($event)"></app-icon-picker>
<p-dialog [(visible)]="displayShelfDialog" header="Create Shelf" [modal]="true" [draggable]="false" [closable]="true" (onHide)="closeShelfDialog()" [style]="{ width: '400px', height: 'auto' }">
<div class="p-fluid">
<div class="field">
<label for="shelfName">Shelf Name</label>
<input id="shelfName" type="text" pInputText [(ngModel)]="shelfName" />
<!-- Shelf dialog component -->
<p-dialog [style]="{ width: '26rem', height: '30rem' }" [(visible)]="displayShelfDialog" header="Create Shelf" [modal]="true" [draggable]="false" [closable]="true" (onHide)="closeShelfDialog()">
<div class="py-2">
<label for="shelfName">Shelf Name</label>
<input id="shelfName" type="text" pInputText [(ngModel)]="shelfName" class="w-full"/>
</div>
<div class="py-4">
<label>Shelf Icon</label>
<div *ngIf="!selectedIcon">
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
</div>
<div class="field">
<label>Shelf Icon</label>
<div *ngIf="!selectedIcon">
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
</div>
<div *ngIf="selectedIcon" class="mt-2 flex items-center">
<i [class]="selectedIcon" class="mr-2"></i>
<p-button label="Remove" icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
</div>
<div *ngIf="selectedIcon" class="flex items-center gap-4">
<i [class]="selectedIcon"></i>
<p-button icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
</div>
</div>
<ng-template pTemplate="footer">
@@ -1,49 +0,0 @@
.dialog-container {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
}
.bottom-section {
margin-top: auto;
}
.bottom-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1rem;
}
p-divider {
margin: 1rem 0;
border-color: var(--text-color-secondary);
}
.spacing-right {
margin-right: 1rem;
}
p-dialog .p-dialog-content {
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 1rem; /* Adds space between elements inside the dialog */
}
p-dialog .p-dialog-footer {
display: flex;
justify-content: flex-end;
}
.dialog-container .checkbox-list {
display: flex;
flex-direction: column;
gap: 1rem; /* Adds gap between each checkbox row */
padding: 1rem;
}
.checkbox-list .flex {
margin-bottom: 0.5rem; /* Optional: adds a smaller gap between each checkbox item */
}