From 60e7ff8403a221dd2de66a37396f7687ff2a62f0 Mon Sep 17 00:00:00 2001 From: "aditya.chandel" Date: Mon, 21 Jul 2025 18:08:18 -0600 Subject: [PATCH] Responsive UI enhancements for mobile device --- .../book-browser/book-browser.component.scss | 7 + .../layout-menu/app.menu.component.ts | 8 +- .../layout-topbar/app.topbar.component.ts | 11 +- .../book-metadata-center.component.scss | 4 +- .../metadata-editor.component.html | 74 ++++++--- .../metadata-searcher.component.html | 70 +++++---- .../metadata-searcher.component.ts | 2 + .../metadata-viewer.component.html | 148 +++++++++--------- .../user-profile-dialog.component.html | 2 +- 9 files changed, 198 insertions(+), 128 deletions(-) diff --git a/booklore-ui/src/app/book/components/book-browser/book-browser.component.scss b/booklore-ui/src/app/book/components/book-browser/book-browser.component.scss index da45311fa..53f9bb82d 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-browser.component.scss +++ b/booklore-ui/src/app/book/components/book-browser/book-browser.component.scss @@ -50,6 +50,13 @@ border-width: 1px 1px 0px 1px; } +@media (max-width: 768px) { + .book-browser-footer { + left: 0%; + right: 0%; + } +} + .topbar-item { display: inline-flex; align-items: center; diff --git a/booklore-ui/src/app/layout/component/layout-menu/app.menu.component.ts b/booklore-ui/src/app/layout/component/layout-menu/app.menu.component.ts index 3edd18ab1..62fccd6b4 100644 --- a/booklore-ui/src/app/layout/component/layout-menu/app.menu.component.ts +++ b/booklore-ui/src/app/layout/component/layout-menu/app.menu.component.ts @@ -1,6 +1,6 @@ import {Component, inject, OnInit} from '@angular/core'; import {AppMenuitemComponent} from './app.menuitem.component'; -import { AsyncPipe } from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {MenuModule} from 'primeng/menu'; import {LibraryService} from '../../../book/service/library.service'; import {Observable, of} from 'rxjs'; @@ -141,6 +141,7 @@ export class AppMenuComponent implements OnInit { } openChangelogDialog() { + const isMobile = window.innerWidth <= 768; this.dynamicDialogRef = this.dialogService.open(VersionChangelogDialogComponent, { header: 'What’s New', modal: true, @@ -149,8 +150,9 @@ export class AppMenuComponent implements OnInit { position: 'absolute', top: '10%', bottom: '10%', - minWidth: '800px', - maxWidth: '800px', + width: isMobile ? '90vw' : '800px', + maxWidth: isMobile ? '90vw' : '800px', + minWidth: isMobile ? '90vw' : '800px', }, }); } diff --git a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts index ed4cb77bf..9534591d6 100644 --- a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts +++ b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.ts @@ -140,11 +140,20 @@ export class AppTopBarComponent implements OnDestroy { } private openDialog(component: any, header: string, top: string) { + const isMobile = window.innerWidth <= 768; this.ref = this.dialogService.open(component, { header, modal: true, closable: true, - style: { position: 'absolute', top }, + style: { + position: 'absolute', + top, + ...(isMobile && { + width: '90vw', + maxWidth: '90vw', + minWidth: '90vw', + }), + }, }); } diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/book-metadata-center.component.scss b/booklore-ui/src/app/metadata/book-metadata-center-component/book-metadata-center.component.scss index b768465b3..8526a7bc2 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/book-metadata-center.component.scss +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/book-metadata-center.component.scss @@ -1,9 +1,9 @@ .tabpanels-responsive { - height: calc(100vh - 9.7rem); + height: calc(100dvh - 9.7rem); } @media (max-width: 768px) { .tabpanels-responsive { - height: calc(100vh - 8.5rem); + height: calc(100dvh - 8.5rem); } } diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html index 8615fe7d8..388b3901d 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html @@ -12,9 +12,8 @@ Image + class="w-[200px] md:w-[250px] transition-all duration-300 ease-in-out"/> @if (isUploading) { @@ -54,7 +53,7 @@ } -
+
@@ -426,7 +425,7 @@
-
+
} -
- - +
+
+ + - @if (book.bookType === 'PDF' || book.bookType === 'EPUB') { - - } - - - - + @if (book.bookType === 'PDF' || book.bookType === 'EPUB') { + + + } + + + + + + +
+ +
+ + +
diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.html b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.html index afa4a5f1b..31d30ed31 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.html +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.html @@ -9,7 +9,7 @@ } @else {
-
+
@@ -50,40 +50,56 @@
@if (loading) { -
- +
+ +

+ Fetching metadata from your selected sources.
+ This may take a few moments... +

} @if (!loading) { -
- @for (metadata of allFetchedMetadata; track metadata) { -
-
- Image -
-
-

{{ truncateText(metadata['title']!, 90) }}

-
-

ISBN: {{ metadata['isbn10'] || metadata['asin'] }}

- -

Published: {{ metadata['publishedDate'] }}

+ @if (searchTriggered && allFetchedMetadata.length === 0) { +
+

No metadata results found.
Try adjusting your search criteria.

+
+ } + @if (!searchTriggered && allFetchedMetadata.length === 0) { +
+

Start by searching for metadata using the search bar above.

+
+ } + @if (allFetchedMetadata.length > 0) { +
+ @for (metadata of allFetchedMetadata; track metadata) { +
+
+ Image +
+
+

{{ truncateText(metadata['title']!, 90) }}

+
+

ISBN: {{ metadata['isbn10'] || metadata['asin'] }}

+ +

Published: {{ metadata['publishedDate'] }}

+
+
+

by {{ truncateText(metadata['authors']!.join(', '), 70) }}

+ +

Source:

+
+

+ {{ sanitizeHtml(metadata['description']) }} +

-
-

by {{ truncateText(metadata['authors']!.join(', '), 70) }}

- -

Source:

-
-

- {{ sanitizeHtml(metadata['description']) }} -

+
- -
- } -
+ } +
+ } } } diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.ts b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.ts index de573a791..466d46292 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.ts +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-searcher/metadata-searcher.component.ts @@ -40,6 +40,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy { allFetchedMetadata: BookMetadata[] = []; bookId!: number; loading: boolean = false; + searchTriggered = false; @Input() book$!: Observable; @@ -120,6 +121,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy { } onSubmit(): void { + this.searchTriggered = true; if (this.form.valid) { const providerKeys = this.form.get('provider')?.value; if (!providerKeys) return; diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-viewer/metadata-viewer.component.html b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-viewer/metadata-viewer.component.html index 0fd371cbc..db37d7185 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-viewer/metadata-viewer.component.html +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-viewer/metadata-viewer.component.html @@ -187,96 +187,98 @@
} -
-

- Publisher: - @if (book?.metadata?.publisher) { - +

+
+

+ Publisher: + @if (book?.metadata?.publisher) { + {{ book?.metadata?.publisher }} - } @else { - - - } -

-

Published: {{ book?.metadata!.publishedDate || '-' }}

-

Language: {{ book?.metadata!.language || '-' }}

-

- File Type: - + } @else { + - + } +

+

Published: {{ book?.metadata!.publishedDate || '-' }}

+

Language: {{ book?.metadata!.language || '-' }}

+

+ File Type: + {{ getFileExtension(book?.filePath) || '-' }} -

-

File Size: {{ getFileSizeInMB(book) }}

-

- ISBN: - @if (book?.metadata?.isbn13 || book?.metadata?.isbn10) { - {{ book.metadata!.isbn13 }} - @if (book?.metadata?.isbn13 && book?.metadata?.isbn10) { - / +

+

File Size: {{ getFileSizeInMB(book) }}

+

+ ISBN: + @if (book?.metadata?.isbn13 || book?.metadata?.isbn10) { + {{ book.metadata!.isbn13 }} + @if (book?.metadata?.isbn13 && book?.metadata?.isbn10) { + / + } + {{ book.metadata!.isbn10 }} + } @else { + - } - {{ book.metadata!.isbn10 }} - } @else { - - - } -

-

- Read Status: - +

+

+ Read Status: + {{ getStatusLabel(selectedReadStatus) }} - -

-

- Progress: - + +

+

+ Progress: + {{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }} - @if (getProgressPercent(book) !== null) { - + @if (getProgressPercent(book) !== null) { + - } + } -

-

- Metadata Match: - @if (book?.metadataMatchScore != null) { - +

+

+ Metadata Match: + @if (book?.metadataMatchScore != null) { + {{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}% - } @else { - - - } -

-
+ } @else { + - + } +

+
-
- File Path: - - @if (showFilePath) { - {{ book?.filePath }} - } +
+ File Path: + + @if (showFilePath) { + {{ book?.filePath }} + } +
diff --git a/booklore-ui/src/app/settings/global-preferences/user-profile-dialog/user-profile-dialog.component.html b/booklore-ui/src/app/settings/global-preferences/user-profile-dialog/user-profile-dialog.component.html index 81dbe9f74..09622c9ec 100644 --- a/booklore-ui/src/app/settings/global-preferences/user-profile-dialog/user-profile-dialog.component.html +++ b/booklore-ui/src/app/settings/global-preferences/user-profile-dialog/user-profile-dialog.component.html @@ -3,7 +3,7 @@
-
+

User Profile