Improve the UI of the shelf edit dialog
This commit is contained in:
+56
-15
@@ -1,25 +1,66 @@
|
|||||||
<div class="flex flex-col py-4 px-4 gap-6 h-96 w-96">
|
<div class="shelf-form">
|
||||||
<div class="flex flex-col gap-10">
|
<div class="panel-header">
|
||||||
<div class="flex items-center gap-4">
|
<div class="header-icon-wrapper">
|
||||||
<p>Shelf Name: </p>
|
<i class="pi pi-pencil header-icon"></i>
|
||||||
<input type="text" pInputText [(ngModel)]="shelfName" placeholder="Enter shelf name..."/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-5">
|
<div class="header-text">
|
||||||
<p>Shelf Icon:</p>
|
<h2 class="panel-title">Edit Shelf</h2>
|
||||||
|
<p class="panel-description">
|
||||||
|
Customize your shelf name and icon
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<p-button
|
||||||
|
icon="pi pi-times"
|
||||||
|
[text]="true"
|
||||||
|
[rounded]="true"
|
||||||
|
severity="secondary"
|
||||||
|
(onClick)="closeDialog()"
|
||||||
|
styleClass="close-button">
|
||||||
|
</p-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="shelf-container">
|
||||||
|
<div class="shelf-fields">
|
||||||
|
<div class="shelf-row">
|
||||||
|
<label class="label">Shelf Name:</label>
|
||||||
|
<input type="text" pInputText [(ngModel)]="shelfName" placeholder="Enter shelf name..." class="input"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="shelf-row">
|
||||||
|
<label class="label">Shelf Icon:</label>
|
||||||
|
<div class="icon-section">
|
||||||
@if (!selectedIcon) {
|
@if (!selectedIcon) {
|
||||||
<div>
|
<p-button label="Select Icon" icon="pi pi-search" [outlined]="true" severity="info" (onClick)="openIconPicker()"></p-button>
|
||||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (selectedIcon) {
|
@if (selectedIcon) {
|
||||||
<div>
|
<div class="icon-container">
|
||||||
<i [class]="selectedIcon" class="text-xl mr-3"></i>
|
<div class="icon-wrapper">
|
||||||
<p-button icon="pi pi-times" (onClick)="clearSelectedIcon()" [rounded]="true" [text]="true" [outlined]="true" severity="danger"></p-button>
|
<i [class]="selectedIcon" class="icon"></i>
|
||||||
|
</div>
|
||||||
|
<p-button icon="pi pi-times" (onClick)="clearSelectedIcon()" [rounded]="true" [text]="true" severity="danger"></p-button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end">
|
</div>
|
||||||
<p-button label="Save" icon="pi pi-check" (onClick)="save()"></p-button>
|
</div>
|
||||||
|
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<div></div>
|
||||||
|
<div class="footer-actions">
|
||||||
|
<p-button
|
||||||
|
label="Cancel"
|
||||||
|
severity="secondary"
|
||||||
|
[outlined]="true"
|
||||||
|
(onClick)="closeDialog()"
|
||||||
|
/>
|
||||||
|
<p-button
|
||||||
|
label="Save Changes"
|
||||||
|
icon="pi pi-check"
|
||||||
|
severity="success"
|
||||||
|
(onClick)="save()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+203
@@ -0,0 +1,203 @@
|
|||||||
|
.shelf-form {
|
||||||
|
width: 550px;
|
||||||
|
max-width: 550px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-header {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.5rem 1.5rem 1.25rem 1.5rem;
|
||||||
|
border-radius: 10px 10px 0 0;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-bottom: none;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
|
.header-icon-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
background: var(--primary-color);
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
.header-icon {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: var(--primary-contrast-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.panel-title {
|
||||||
|
margin: 0 0 0.25rem 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-description {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
padding: 1rem 3rem 1rem 1rem;
|
||||||
|
|
||||||
|
.header-icon-wrapper {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
.header-icon {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text {
|
||||||
|
.panel-title {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-description {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .close-button {
|
||||||
|
top: 0.5rem;
|
||||||
|
right: 0.5rem;
|
||||||
|
|
||||||
|
.p-button {
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelf-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.75rem;
|
||||||
|
background: var(--card-background);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||||
|
min-height: 200px;
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelf-fields {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelf-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 7rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
color: var(--text-color);
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-section {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
background: var(--ground-background);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
|
.icon-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
background: var(--primary-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: var(--primary-contrast-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 1.25rem 1.5rem;
|
||||||
|
background: var(--card-background);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-top: none;
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
|
||||||
|
.footer-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 1rem;
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
.footer-actions {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+4
@@ -71,4 +71,8 @@ export class ShelfEditDialogComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeDialog() {
|
||||||
|
this.dynamicDialogRef.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export class LibraryShelfMenuService {
|
|||||||
header: 'Edit Library',
|
header: 'Edit Library',
|
||||||
modal: true,
|
modal: true,
|
||||||
closable: true,
|
closable: true,
|
||||||
|
showHeader: false,
|
||||||
styleClass: 'dynamic-dialog-minimal',
|
styleClass: 'dynamic-dialog-minimal',
|
||||||
data: {
|
data: {
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
@@ -164,13 +165,11 @@ export class LibraryShelfMenuService {
|
|||||||
header: 'Edit Shelf',
|
header: 'Edit Shelf',
|
||||||
modal: true,
|
modal: true,
|
||||||
closable: true,
|
closable: true,
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: 'dynamic-dialog-minimal',
|
||||||
data: {
|
data: {
|
||||||
shelfId: entity?.id
|
shelfId: entity?.id
|
||||||
},
|
},
|
||||||
style: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: '15%',
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -228,8 +227,11 @@ export class LibraryShelfMenuService {
|
|||||||
header: 'Edit Magic Shelf',
|
header: 'Edit Magic Shelf',
|
||||||
modal: true,
|
modal: true,
|
||||||
closable: true,
|
closable: true,
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: 'dynamic-dialog-minimal',
|
||||||
data: {
|
data: {
|
||||||
id: entity?.id
|
id: entity?.id,
|
||||||
|
editMode: true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<i class="pi pi-book"></i>
|
<i class="pi pi-book"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="main-header-content">
|
<div class="main-header-content">
|
||||||
<h1 class="main-header-title">Library Creator</h1>
|
<h1 class="main-header-title">
|
||||||
|
{{ mode === 'edit' ? 'Edit Library' : 'Create New Library' }}
|
||||||
|
</h1>
|
||||||
<p class="main-header-subtitle">Set up a new library to organize and manage your book collection</p>
|
<p class="main-header-subtitle">Set up a new library to organize and manage your book collection</p>
|
||||||
</div>
|
</div>
|
||||||
<p-button
|
<p-button
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<i class="pi pi-sparkles header-icon"></i>
|
<i class="pi pi-sparkles header-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-text">
|
<div class="header-text">
|
||||||
<h2 class="panel-title">Magic Shelf Builder</h2>
|
<h2 class="panel-title">
|
||||||
|
{{ editMode ? 'Edit Magic Shelf' : 'Magic Shelf Builder' }}
|
||||||
|
</h2>
|
||||||
<p class="panel-description">Create smart shelves with custom rules to automatically organize your books</p>
|
<p class="panel-description">Create smart shelves with custom rules to automatically organize your books</p>
|
||||||
</div>
|
</div>
|
||||||
<p-button
|
<p-button
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
|
|
||||||
shelfId: number | null = null;
|
shelfId: number | null = null;
|
||||||
isAdmin: boolean = false;
|
isAdmin: boolean = false;
|
||||||
|
editMode!: boolean;
|
||||||
|
|
||||||
libraryService = inject(LibraryService);
|
libraryService = inject(LibraryService);
|
||||||
magicShelfService = inject(MagicShelfService);
|
magicShelfService = inject(MagicShelfService);
|
||||||
@@ -216,6 +217,7 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.isAdmin = this.userService.getCurrentUser()?.permissions.admin ?? false;
|
this.isAdmin = this.userService.getCurrentUser()?.permissions.admin ?? false;
|
||||||
const id = this.config?.data?.id;
|
const id = this.config?.data?.id;
|
||||||
|
this.editMode = !!this.config?.data?.editMode;
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
this.shelfId = id;
|
this.shelfId = id;
|
||||||
|
|||||||
Reference in New Issue
Block a user