From b3af1723df8dbadb46e6a063f4125bd8f1459e3c Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:41:15 -0600 Subject: [PATCH] Polish main dashboard UI and improve aesthetics --- .../controller/BookReviewController.java | 6 +- .../dashboard-scroller.component.html | 62 +++--- .../dashboard-scroller.component.scss | 177 ++++++++++++++++-- .../dashboard-scroller.component.ts | 3 +- .../main-dashboard.component.html | 36 ++-- .../main-dashboard.component.scss | 51 ++++- .../main-dashboard.component.ts | 8 +- 7 files changed, 272 insertions(+), 71 deletions(-) diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/controller/BookReviewController.java b/booklore-api/src/main/java/com/adityachandel/booklore/controller/BookReviewController.java index fc9ce8b1f..3ea144463 100644 --- a/booklore-api/src/main/java/com/adityachandel/booklore/controller/BookReviewController.java +++ b/booklore-api/src/main/java/com/adityachandel/booklore/controller/BookReviewController.java @@ -22,20 +22,20 @@ public class BookReviewController { } @PostMapping("/book/{bookId}/refresh") - @PreAuthorize("@securityUtil.canManipulateLibrary() or @securityUtil.isAdmin()") + @PreAuthorize("@securityUtil.canEditMetadata() or @securityUtil.isAdmin()") public List refreshReviews(@PathVariable Long bookId) { return bookReviewService.refreshReviews(bookId); } @DeleteMapping("/{id}") - @PreAuthorize("@securityUtil.canManipulateLibrary() or @securityUtil.isAdmin()") + @PreAuthorize("@securityUtil.canEditMetadata() or @securityUtil.isAdmin()") public ResponseEntity delete(@PathVariable Long id) { bookReviewService.delete(id); return ResponseEntity.noContent().build(); } @DeleteMapping("/book/{bookId}") - @PreAuthorize("@securityUtil.canManipulateLibrary() or @securityUtil.isAdmin()") + @PreAuthorize("@securityUtil.canEditMetadata() or @securityUtil.isAdmin()") public ResponseEntity deleteAllByBookId(@PathVariable Long bookId) { bookReviewService.deleteAllByBookId(bookId); return ResponseEntity.noContent().build(); diff --git a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.html b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.html index c6ed44f52..a1cc548c3 100644 --- a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.html +++ b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.html @@ -1,30 +1,38 @@ -

{{ title }}

+
+

{{ title }}

-@if (!books || books.length === 0) { -
-

- {{ bookListType === 'lastRead' ? "You haven't read any books yet!" : "No books have been added to BookLore!" }} -

-
-} - -@if (books) { -
- @for (book of books; track book) { -
- + @if (!books || books.length === 0) { +
+
+
- } -
-} +

+ {{ bookListType === 'lastRead' ? "You haven't read any books yet! Start your reading journey." : "No books have been added to BookLore yet! Add your first book to get started." }} +

+
+ } -@if ( books === null) { -
-

Failed to load books! :(

-
-} + @if (books) { +
+ @for (book of books; track book) { +
+ +
+ } +
+ } + + @if (books === null) { +
+
+ +
+

Failed to load books! Please try refreshing the page.

+
+ } +
diff --git a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.scss b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.scss index f71eb74b8..15c255ce9 100644 --- a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.scss +++ b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.scss @@ -1,16 +1,74 @@ +.dashboard-scroller-container { + border-radius: 20px; + padding: 1rem 2rem 0rem 2rem; + margin-bottom: 2rem; + position: relative; + overflow: hidden; + backdrop-filter: blur(20px); + border: color-mix(in srgb, var(--p-surface-500), transparent 50%) 1px solid; +} + .dashboard-scroller-title { text-align: left; font-size: 1.5rem; - margin-bottom: 0.625rem; - padding: 0.3125rem; + font-weight: 800; + margin-bottom: 1rem; + padding: 0; + background: linear-gradient(135deg, #ffffff, #e2e8f0, #3b82f6); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + position: relative; + z-index: 2; + letter-spacing: -0.02em; + + &::after { + content: ''; + position: absolute; + bottom: -6px; + left: 0; + width: 80px; + height: 4px; + background: linear-gradient(90deg, var(--primary-color), var(--primary-color)); + border-radius: 2px; + } } .dashboard-scroller-no-books { - padding-top: 5rem; - padding-bottom: 5rem; + padding: 3rem 2rem; display: flex; + flex-direction: column; justify-content: center; align-items: center; + text-align: center; + position: relative; + z-index: 2; + + .empty-state-icon { + width: 25px; + height: 25px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 2rem; + position: relative; + + i { + font-size: 2rem; + color: white; + filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); + } + } + + p { + color: #e2e8f0; + font-size: 1rem; + font-weight: 500; + max-width: 400px; + line-height: 1.7; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); + } } .dashboard-scroller-infinite { @@ -18,35 +76,122 @@ overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; - padding: 0.25rem; - gap: 1.25rem; + padding: 1rem 0.5rem 1rem 0.5rem; + gap: 2rem; height: 100%; width: 100%; + position: relative; + z-index: 2; + + scrollbar-color: var(--primary-color) rgba(20, 20, 30, 0.5); } .dashboard-scroller-card { - height: 220px; - width: 135px; + height: 200px; + width: 116px; + flex-basis: 124px; flex-shrink: 0; flex-grow: 0; - flex-basis: 135px; scroll-snap-align: start; + transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); + position: relative; + + &:hover { + transform: translateY(-4px) scale(1.04); + filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.4)); + + &::after { + opacity: 1; + transform: scale(1.2); + } + + &::before { + opacity: 0.8; + } + } + + &::before { + content: ''; + position: absolute; + inset: -2px; + background: linear-gradient( + 135deg, + color-mix(in srgb, var(--p-primary-400), transparent 70%), + color-mix(in srgb, var(--p-primary-800), transparent 70%) + ); + border-radius: 12px; + z-index: -1; + opacity: 0; + transition: opacity 0.4s ease; + filter: blur(8px); + } + + &::after { + content: ''; + position: absolute; + bottom: -12px; + left: 15%; + right: 15%; + height: 5px; + background: linear-gradient( + 90deg, + transparent, + var(--p-primary-500), + transparent + ); + border-radius: 50%; + opacity: 0; + transition: all 0.4s ease; + filter: blur(6px); + } } @media (max-width: 767px) { + .dashboard-scroller-container { + padding: 1.5rem; + margin-bottom: 2rem; + border-radius: 16px; + } + .dashboard-scroller-title { - font-size: 1.25rem; - padding: 0.25rem; + font-size: 1.75rem; + margin-bottom: 1rem; + + &::after { + width: 50px; + height: 3px; + } } .dashboard-scroller-card { - height: 200px; - width: 120px; - flex-basis: 110px; + height: 230px; + width: 135px; + flex-basis: 135px; } .dashboard-scroller-infinite { - gap: 1rem; - padding: 0.25rem 0.5rem; + gap: 1.5rem; + padding: 0.75rem 0.25rem 1.5rem 0.25rem; + + &::-webkit-scrollbar { + height: 8px; + } + } + + .dashboard-scroller-no-books { + padding: 4rem 1rem; + + .empty-state-icon { + width: 80px; + height: 80px; + + i { + font-size: 2rem; + } + } + + p { + font-size: 1.1rem; + } } } diff --git a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts index 10de34eab..2c59536c7 100644 --- a/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts +++ b/booklore-ui/src/app/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts @@ -13,7 +13,7 @@ import {Book} from '../../../book/model/book.model'; InfiniteScrollDirective, BookCardComponent, ProgressSpinnerModule -], + ], standalone: true }) export class DashboardScrollerComponent { @@ -23,5 +23,4 @@ export class DashboardScrollerComponent { @Input() books!: Book[] | null; @ViewChild('scrollContainer') scrollContainer!: ElementRef; - } diff --git a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html index 5278b071d..7dcaadc9d 100644 --- a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html +++ b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html @@ -1,19 +1,33 @@
@if ((bookState$ | async)?.loaded === false) { - +
+ + +
} @if ((bookState$ | async)?.loaded === true) {
-
+
@if (isLibrariesEmpty$ | async) {
@if ((userService.userState$ | async)?.user?.permissions; as permissions) {
@if (permissions.admin || permissions.canManipulateLibrary) {
-

Looks like you haven't added a library yet. Let's add one!

+

+ Welcome to BookLore! 📚
+ Let's create your first library +

+

+ A library is where all your books live. Start building your digital collection today! +

@@ -27,21 +41,17 @@ + [title]="'Continue Reading'"> -
- -
+ + [title]="'Recently Added'"> -
- -
+ + [title]="'Discover Something New'"> }
diff --git a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss index 256d5a145..12895e9aa 100644 --- a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss +++ b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss @@ -1,11 +1,39 @@ .dashboard-container { height: calc(100dvh - 6.7rem); overflow-y: auto; + position: relative; + + &::before { + content: ''; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + pointer-events: none; + z-index: 0; + } + + &::-webkit-scrollbar { + width: 12px; + } + + &::-webkit-scrollbar-track { + background: rgba(20, 20, 30, 0.5); + border-radius: 10px; + } + + scrollbar-width: thin; + scrollbar-color: var(--primary-color) rgba(20, 20, 30, 0.5); } @media (max-width: 768px) { .dashboard-container { height: calc(100dvh - 5rem); + + &::-webkit-scrollbar { + width: 8px; + } } } @@ -14,17 +42,30 @@ align-items: center; justify-content: center; text-align: center; + position: relative; + z-index: 1; } .dashboard .no-library-header { - font-size: 1.5rem; - font-weight: 600; - margin-bottom: 1rem; - color: var(--text-color); + font-size: 2rem; + font-weight: 700; + margin-bottom: 2rem; + background: linear-gradient(135deg, #ffffff, #e2e8f0, var(--p-primary-500)); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); + letter-spacing: -0.02em; } .dashboard-no-library { - margin-top: 3rem; + padding: 3rem; + background: var(--p-surface-900); + border-radius: 24px; + border: 1px solid rgba(255, 255, 255, 0.1); + backdrop-filter: blur(20px); + position: relative; + overflow: hidden; } .dashboard .p-dialog { diff --git a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.ts b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.ts index 0dab0d4e6..9b6e4cbff 100644 --- a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.ts +++ b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.ts @@ -2,15 +2,14 @@ import {Component, inject, OnInit} from '@angular/core'; import {LibraryCreatorComponent} from '../../../book/components/library-creator/library-creator.component'; import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog'; import {LibraryService} from '../../../book/service/library.service'; -import {filter, Observable, take} from 'rxjs'; +import {Observable} from 'rxjs'; import {map} from 'rxjs/operators'; import {Button} from 'primeng/button'; -import { AsyncPipe } from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {DashboardScrollerComponent} from '../dashboard-scroller/dashboard-scroller.component'; import {BookService} from '../../../book/service/book.service'; import {BookState} from '../../../book/model/state/book-state.model'; import {Book} from '../../../book/model/book.model'; -import {Divider} from 'primeng/divider'; import {UserService} from '../../../settings/user-management/user.service'; import {ProgressSpinner} from 'primeng/progressspinner'; @@ -22,9 +21,8 @@ import {ProgressSpinner} from 'primeng/progressspinner'; Button, DashboardScrollerComponent, AsyncPipe, - Divider, ProgressSpinner -], + ], providers: [DialogService], standalone: true })