From 9281fd9559e1a9b8fc28733753ff888ab1e0c84f Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Wed, 3 Dec 2025 20:11:48 -0700 Subject: [PATCH] Improve the UI of the shelf edit dialog --- .../shelf-edit-dialog.component.html | 79 +++++-- .../shelf-edit-dialog.component.scss | 203 ++++++++++++++++++ .../shelf-edit-dialog.component.ts | 10 +- .../service/library-shelf-menu.service.ts | 12 +- .../library-creator.component.html | 4 +- .../component/magic-shelf-component.html | 4 +- .../component/magic-shelf-component.ts | 2 + 7 files changed, 285 insertions(+), 29 deletions(-) diff --git a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.html b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.html index 6e0b10253..b85c2c686 100644 --- a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.html +++ b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.html @@ -1,25 +1,66 @@ -
-
-
-

Shelf Name:

- +
+
+
+
-
-

Shelf Icon:

- @if (!selectedIcon) { -
- +
+

Edit Shelf

+

+ Customize your shelf name and icon +

+
+ + +
+ +
+
+
+ + +
+ +
+ +
+ @if (!selectedIcon) { + + } + + @if (selectedIcon) { +
+
+ +
+ +
+ }
- } - @if (selectedIcon) { -
- - -
- } +
-
- + +
diff --git a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.scss b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.scss index e69de29bb..9b4a187e2 100644 --- a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.scss +++ b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.scss @@ -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; + } + } +} diff --git a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.ts b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.ts index d29a7b965..bd72adc93 100644 --- a/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.ts +++ b/booklore-ui/src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.ts @@ -16,12 +16,12 @@ import {IconPickerService} from '../../../../shared/service/icon-picker.service' InputText, ReactiveFormsModule, FormsModule -], + ], templateUrl: './shelf-edit-dialog.component.html', standalone: true, styleUrl: './shelf-edit-dialog.component.scss' }) -export class ShelfEditDialogComponent implements OnInit{ +export class ShelfEditDialogComponent implements OnInit { private shelfService = inject(ShelfService); private dynamicDialogConfig = inject(DynamicDialogConfig); @@ -36,7 +36,7 @@ export class ShelfEditDialogComponent implements OnInit{ ngOnInit(): void { const shelfId = this.dynamicDialogConfig?.data.shelfId; this.shelf = this.shelfService.getShelfById(shelfId); - if(this.shelf) { + if (this.shelf) { this.shelfName = this.shelf.name; this.selectedIcon = 'pi pi-' + this.shelf.icon; } @@ -71,4 +71,8 @@ export class ShelfEditDialogComponent implements OnInit{ } }); } + + closeDialog() { + this.dynamicDialogRef.close(); + } } diff --git a/booklore-ui/src/app/features/book/service/library-shelf-menu.service.ts b/booklore-ui/src/app/features/book/service/library-shelf-menu.service.ts index 1ea0da27b..8d3ff71e1 100644 --- a/booklore-ui/src/app/features/book/service/library-shelf-menu.service.ts +++ b/booklore-ui/src/app/features/book/service/library-shelf-menu.service.ts @@ -45,6 +45,7 @@ export class LibraryShelfMenuService { header: 'Edit Library', modal: true, closable: true, + showHeader: false, styleClass: 'dynamic-dialog-minimal', data: { mode: 'edit', @@ -164,13 +165,11 @@ export class LibraryShelfMenuService { header: 'Edit Shelf', modal: true, closable: true, + showHeader: false, + styleClass: 'dynamic-dialog-minimal', data: { shelfId: entity?.id }, - style: { - position: 'absolute', - top: '15%', - } }) } }, @@ -228,8 +227,11 @@ export class LibraryShelfMenuService { header: 'Edit Magic Shelf', modal: true, closable: true, + showHeader: false, + styleClass: 'dynamic-dialog-minimal', data: { - id: entity?.id + id: entity?.id, + editMode: true, } }) } diff --git a/booklore-ui/src/app/features/library-creator/library-creator.component.html b/booklore-ui/src/app/features/library-creator/library-creator.component.html index 0ba44cb9a..520d00716 100644 --- a/booklore-ui/src/app/features/library-creator/library-creator.component.html +++ b/booklore-ui/src/app/features/library-creator/library-creator.component.html @@ -4,7 +4,9 @@
-

Library Creator

+

+ {{ mode === 'edit' ? 'Edit Library' : 'Create New Library' }} +

Set up a new library to organize and manage your book collection

-

Magic Shelf Builder

+

+ {{ editMode ? 'Edit Magic Shelf' : 'Magic Shelf Builder' }} +

Create smart shelves with custom rules to automatically organize your books