Added late read module

This commit is contained in:
aditya.chandel
2024-12-13 15:42:14 -07:00
parent baff376b9c
commit 1e9249b257
20 changed files with 346 additions and 69 deletions
@@ -1,11 +1,18 @@
<div class="dashboard">
<h1 *ngIf="isLibrariesEmpty" class="no-library-header">
Looks like you haven't added a library yet. Let's add one!
</h1>
<p-button *ngIf="isLibrariesEmpty"
label="Add a Library"
icon="pi pi-plus"
styleClass="p-button-rounded p-button-outlined"
(click)="createNewLibrary($event)">
</p-button>
<div *ngIf="isLibrariesEmpty; else dashboardScroller">
<h1 class="no-library-header">
Looks like you haven't added a library yet. Let's add one!
</h1>
<p-button
label="Add a Library"
icon="pi pi-plus"
styleClass="p-button-rounded p-button-outlined"
(click)="createNewLibrary($event)">
</p-button>
</div>
<ng-template #dashboardScroller>
<app-dashboard-scroller></app-dashboard-scroller>
</ng-template>
</div>
@@ -1,27 +1,25 @@
.dashboard {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 5rem;
text-align: center;
}
.no-library-header {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--text-color)
}
.p-dialog {
max-width: 90%; /* Ensure the dialog doesn't overflow the viewport */
}
.dashboard .no-library-header {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--text-color);
}
.dashboard .p-dialog {
max-width: 90%;
}
::ng-deep .p-dialog-mask {
background-color: rgba(0, 0, 0, 0.5); /* Darken the background with 50% opacity */
background-color: rgba(0, 0, 0, 0.5);
}
/* You can also adjust the blur if you want */
::ng-deep .p-dialog-mask {
backdrop-filter: blur(3px); /* Optional: Apply blur to the background */
backdrop-filter: blur(3px);
}
@@ -5,16 +5,18 @@ import { Button } from 'primeng/button';
import { NgIf } from '@angular/common';
import { LibraryCreatorComponent } from '../library-creator/library-creator.component';
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
import {DashboardScrollerComponent} from '../dashboard-scroller/dashboard-scroller.component';
@Component({
selector: 'app-home-page',
templateUrl: './dashboard.component.html',
imports: [
Button,
NgIf
NgIf,
DashboardScrollerComponent
],
styleUrls: ['./dashboard.component.scss'],
providers: [DialogService], // Ensure the DialogService is available
providers: [DialogService],
})
export class DashboardComponent {
private libraries: WritableSignal<Library[]>;
@@ -25,7 +27,7 @@ export class DashboardComponent {
}
get isLibrariesEmpty(): boolean {
return this.libraries()?.length === 1;
return this.libraries()?.length === 0;
}
createNewLibrary(event: MouseEvent) {
@@ -39,12 +41,12 @@ export class DashboardComponent {
this.ref = this.dialogService.open(LibraryCreatorComponent, {
modal: true,
width: `${dialogWidthPercentage}%`, // Dynamic width
height: 'auto', // Let height adapt to content
width: `${dialogWidthPercentage}%`,
height: 'auto',
style: {
position: 'absolute',
top: `${buttonRect.bottom + 10}px`, // Position below the button
left: `${Math.max(leftPosition, 0)}px`, // Ensure it stays within the viewport
top: `${buttonRect.bottom + 10}px`,
left: `${Math.max(leftPosition, 0)}px`
},
});
}