Responsive UI enhancements for mobile device

This commit is contained in:
aditya.chandel
2025-07-21 18:08:50 -06:00
committed by Aditya Chandel
parent 99d43bca1e
commit 60e7ff8403
9 changed files with 198 additions and 128 deletions
@@ -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',
}),
},
});
}
@@ -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);
}
}
@@ -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,7 +472,8 @@
</div>
}
<div class="flex gap-4 items-center flex-wrap ml-auto">
<div class="flex justify-between items-center w-full gap-4">
<div class="flex gap-4">
<p-button
icon="pi pi-bolt"
[outlined]="true"
@@ -485,12 +485,44 @@
</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-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>
<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>
@@ -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,12 +50,27 @@
</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) {
@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">
@@ -85,5 +100,6 @@
}
</div>
}
}
</form>
}
@@ -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;
@@ -187,7 +187,8 @@
</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">
<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) {
@@ -279,6 +280,7 @@
}
</div>
</div>
</div>
@if (userService.userState$ | async; as userData) {
<div class="flex flex-wrap gap-3 pt-6">
@@ -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">