Responsive UI enhancements for mobile device
This commit is contained in:
committed by
Aditya Chandel
parent
99d43bca1e
commit
60e7ff8403
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+53
-21
@@ -12,9 +12,8 @@
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
alt="Image"
|
||||
width="250"
|
||||
[ngClass]="{ 'brightness-50': isUploading }"
|
||||
class="transition-all duration-300 ease-in-out"/>
|
||||
class="w-[200px] md:w-[250px] transition-all duration-300 ease-in-out"/>
|
||||
@if (isUploading) {
|
||||
<p-progressSpinner
|
||||
class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10">
|
||||
@@ -54,7 +53,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col flex-grow pl-2">
|
||||
<div class="flex flex-col flex-grow md:pl-2">
|
||||
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-2/3">
|
||||
@@ -426,7 +425,7 @@
|
||||
</div>
|
||||
<div class="mt-auto">
|
||||
<p-divider></p-divider>
|
||||
<div class="flex flex-col gap-2 px-2 pt-4 md:pb-4 z-10">
|
||||
<div class="flex flex-col gap-2 px-0 md:px-2 pt-4 md:pb-4 z-10">
|
||||
|
||||
<!-- Desktop Buttons -->
|
||||
<div class="hidden sm:flex justify-between w-full gap-4">
|
||||
@@ -473,24 +472,57 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="flex gap-4 items-center flex-wrap ml-auto">
|
||||
<p-button
|
||||
icon="pi pi-bolt"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Auto Fetch"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<div class="flex justify-between items-center w-full gap-4">
|
||||
<div class="flex gap-4">
|
||||
<p-button
|
||||
icon="pi pi-bolt"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Auto Fetch"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Restore" tooltipPosition="top"></p-button>
|
||||
}
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock All" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock All" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button
|
||||
icon="pi pi-refresh"
|
||||
[outlined]="true"
|
||||
severity="danger"
|
||||
(onClick)="restoreMetadata()"
|
||||
pTooltip="Restore"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
|
||||
<p-button
|
||||
icon="pi pi-lock-open"
|
||||
[outlined]="true"
|
||||
severity="success"
|
||||
(onClick)="unlockAll()"
|
||||
pTooltip="Unlock All"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
<p-button
|
||||
icon="pi pi-lock"
|
||||
[outlined]="true"
|
||||
severity="warn"
|
||||
(onClick)="lockAll()"
|
||||
pTooltip="Lock All"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p-button
|
||||
label="Save"
|
||||
icon="pi pi-check"
|
||||
[loading]="isSaving"
|
||||
[disabled]="isSaving"
|
||||
type="submit">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+43
-27
@@ -9,7 +9,7 @@
|
||||
} @else {
|
||||
<form class="flex flex-col w-full h-full pt-2 min-w-full md:min-w-[60rem] pr-0 md:pr-2 pl-0 md:pl-2" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
|
||||
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-4 md:items-end">
|
||||
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-2 md:gap-4 md:items-end">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-3/12">
|
||||
<label for="provider">Providers</label>
|
||||
@@ -50,40 +50,56 @@
|
||||
</div>
|
||||
|
||||
@if (loading) {
|
||||
<div class="flex justify-center items-center mt-8">
|
||||
<p-progress-spinner ariaLabel="loading"/>
|
||||
<div class="flex justify-center items-center flex-col gap-4 h-[40dvh] md:h-[70dvh] text-center">
|
||||
<p-progress-spinner ariaLabel="Loading metadata..."/>
|
||||
<p class="text-gray-300">
|
||||
Fetching metadata from your selected sources.<br/>
|
||||
This may take a few moments...
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading) {
|
||||
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
|
||||
@for (metadata of allFetchedMetadata; track metadata) {
|
||||
<div class="book-item flex flex-col w-full">
|
||||
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 md:py-3 self-center md:self-start"/>
|
||||
<div class="flex flex-col w-full m-2">
|
||||
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
|
||||
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Published: {{ metadata['publishedDate'] }}</p>
|
||||
@if (searchTriggered && allFetchedMetadata.length === 0) {
|
||||
<div class="flex flex-col items-center justify-center h-[50dvh] md:h-[70dvh] text-center">
|
||||
<p class="text-gray-300">No metadata results found.<br/>Try adjusting your search criteria.</p>
|
||||
</div>
|
||||
}
|
||||
@if (!searchTriggered && allFetchedMetadata.length === 0) {
|
||||
<div class="flex flex-col items-center justify-center h-[50dvh] md:h-[70dvh] text-center">
|
||||
<p class="text-gray-300">Start by searching for metadata using the search bar above.</p>
|
||||
</div>
|
||||
}
|
||||
@if (allFetchedMetadata.length > 0) {
|
||||
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
|
||||
@for (metadata of allFetchedMetadata; track metadata) {
|
||||
<div class="book-item flex flex-col w-full">
|
||||
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 md:py-3 self-center md:self-start"/>
|
||||
<div class="flex flex-col w-full m-2">
|
||||
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
|
||||
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Published: {{ metadata['publishedDate'] }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
|
||||
</div>
|
||||
<p class="mt-4 truncate-text p-secondary">
|
||||
{{ sanitizeHtml(metadata['description']) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
|
||||
</div>
|
||||
<p class="mt-4 truncate-text p-secondary">
|
||||
{{ sanitizeHtml(metadata['description']) }}
|
||||
</p>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</form>
|
||||
}
|
||||
|
||||
+2
@@ -40,6 +40,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
|
||||
allFetchedMetadata: BookMetadata[] = [];
|
||||
bookId!: number;
|
||||
loading: boolean = false;
|
||||
searchTriggered = false;
|
||||
|
||||
@Input() book$!: Observable<Book | null>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+75
-73
@@ -187,96 +187,98 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 text-gray-700 dark:text-gray-300 max-w-6xl">
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
<div class="px-1 md:px-0">
|
||||
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 pb-2 text-gray-300 max-w-6xl">
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
{{ book?.metadata?.publisher }}
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
{{ getFileExtension(book?.filePath) || '-' }}
|
||||
</span>
|
||||
</p>
|
||||
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
|
||||
<p>
|
||||
<strong>ISBN:</strong>
|
||||
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
|
||||
{{ book.metadata!.isbn13 }}
|
||||
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
|
||||
/
|
||||
</p>
|
||||
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
|
||||
<p>
|
||||
<strong>ISBN:</strong>
|
||||
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
|
||||
{{ book.metadata!.isbn13 }}
|
||||
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
|
||||
/
|
||||
}
|
||||
{{ book.metadata!.isbn10 }}
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
{{ book.metadata!.isbn10 }}
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
|
||||
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
|
||||
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
{{ getStatusLabel(selectedReadStatus) }}
|
||||
</span>
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center">
|
||||
<span class="font-bold mr-2">Progress:</span>
|
||||
<span class="inline-flex items-center">
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center">
|
||||
<span class="font-bold mr-2">Progress:</span>
|
||||
<span class="inline-flex items-center">
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
||||
[ngClass]="getProgressColorClass(getProgressPercent(book))">
|
||||
{{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }}
|
||||
</span>
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-button
|
||||
pTooltip="Reset progress"
|
||||
tooltipPosition="bottom"
|
||||
icon="pi pi-refresh"
|
||||
size="small"
|
||||
severity="danger"
|
||||
text
|
||||
class="ml-1 custom-button-padding"
|
||||
(onClick)="resetProgress(book)">
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-button
|
||||
pTooltip="Reset progress"
|
||||
tooltipPosition="bottom"
|
||||
icon="pi pi-refresh"
|
||||
size="small"
|
||||
severity="danger"
|
||||
text
|
||||
class="ml-1 custom-button-padding"
|
||||
(onClick)="resetProgress(book)">
|
||||
</p-button>
|
||||
}
|
||||
}
|
||||
</span>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Match:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Match:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
{{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}%
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-semibold text-sm">File Path:</span>
|
||||
<i
|
||||
class="pi cursor-pointer text-sm"
|
||||
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
|
||||
(click)="showFilePath = !showFilePath"
|
||||
></i>
|
||||
@if (showFilePath) {
|
||||
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
|
||||
}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-semibold text-sm">File Path:</span>
|
||||
<i
|
||||
class="pi cursor-pointer text-sm"
|
||||
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
|
||||
(click)="showFilePath = !showFilePath"
|
||||
></i>
|
||||
@if (showFilePath) {
|
||||
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<div class="min-w-[300px] md:min-w-[500px]">
|
||||
|
||||
<section>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-4 py-4">
|
||||
<h2 class="text-xl font-semibold">User Profile</h2>
|
||||
<div class="px-4 py-2">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
|
||||
Reference in New Issue
Block a user