Progressive UI Refinements for Mobile and Desktop Layouts

This commit is contained in:
aditya.chandel
2025-07-19 15:43:49 -06:00
committed by Aditya Chandel
parent fe2d307d2a
commit 06e58233b1
22 changed files with 275 additions and 238 deletions
@@ -1,7 +1,7 @@
<div class="relative flex flex-row"> <div class="relative flex flex-row">
<div class="flex flex-col w-full"> <div class="flex flex-col w-full">
<div class="flex items-center justify-between w-full gap-4 py-2 px-2 md:px-4 rounded-t-xl mb-4 bg-[var(--card-background)]"> <div class="flex items-center justify-between w-full gap-4 py-2 px-2 md:px-4 rounded-t-xl md:mb-4 mb-2 bg-[var(--card-background)]">
<div class="flex items-center min-w-0 max-w-full flex-shrink"> <div class="flex items-center min-w-0 max-w-full flex-shrink">
@if (entityType$ | async; as entityType) { @if (entityType$ | async; as entityType) {
<p class="text-xl whitespace-nowrap overflow-hidden text-ellipsis w-full"> <p class="text-xl whitespace-nowrap overflow-hidden text-ellipsis w-full">
@@ -252,7 +252,6 @@
</div> </div>
} }
@if (bookState?.books; as books) { @if (bookState?.books; as books) {
<div class="book-card-container">
@if (currentViewMode === 'table' && books.length > 0) { @if (currentViewMode === 'table' && books.length > 0) {
<app-book-table <app-book-table
[books]="books" [books]="books"
@@ -285,7 +284,6 @@
</div> </div>
</virtual-scroller> </virtual-scroller>
} }
</div>
} }
@if (selectedBooks.size > 0) { @if (selectedBooks.size > 0) {
@if (userService.userState$ | async; as userData) { @if (userService.userState$ | async; as userData) {
@@ -18,6 +18,12 @@
overflow-y: auto; overflow-y: auto;
} }
@media (max-width: 768px) {
.virtual-scroller {
height: calc(100dvh - 9rem);
}
}
.grid { .grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(1px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(1px, 1fr));
@@ -10,7 +10,7 @@
showGridlines showGridlines
stripedRows stripedRows
[scrollable]="true" [scrollable]="true"
[scrollHeight]="'calc(100dvh - 160px)'" [scrollHeight]="scrollHeight"
[virtualScroll]="true" [virtualScroll]="true"
[virtualScrollItemSize]="46" [virtualScrollItemSize]="46"
[(selection)]="selectedBooks" [(selection)]="selectedBooks"
@@ -70,6 +70,8 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
{field: 'hardcoverReviewCount', header: 'HC #'} {field: 'hardcoverReviewCount', header: 'HC #'}
]; ];
scrollHeight = 'calc(100dvh - 160px)';
ngOnInit(): void { ngOnInit(): void {
this.userService.userState$ this.userService.userState$
.pipe( .pipe(
@@ -79,6 +81,16 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
.subscribe(user => { .subscribe(user => {
this.metadataCenterViewMode = user?.userSettings.metadataCenterViewMode ?? 'route'; this.metadataCenterViewMode = user?.userSettings.metadataCenterViewMode ?? 'route';
}); });
this.setScrollHeight();
window.addEventListener('resize', this.setScrollHeight.bind(this));
}
setScrollHeight() {
const isMobile = window.innerWidth <= 768;
this.scrollHeight = isMobile
? 'calc(100dvh - 125px)'
: 'calc(100dvh - 150px)';
} }
ngOnChanges() { ngOnChanges() {
@@ -255,5 +267,6 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
ngOnDestroy(): void { ngOnDestroy(): void {
this.destroy$.next(); this.destroy$.next();
this.destroy$.complete(); this.destroy$.complete();
window.removeEventListener('resize', this.setScrollHeight.bind(this));
} }
} }
@@ -9,7 +9,7 @@
<div class="epub-header"> <div class="epub-header">
<div> <div>
<p-button size="small" class="menu-toggle-button" (click)="toggleDrawer()" icon="pi pi-bars" severity="secondary"></p-button> <p-button size="small" class="menu-toggle-button" (click)="toggleDrawer()" icon="pi pi-bars" severity="secondary"></p-button>
<p-drawer [(visible)]="isDrawerVisible" [modal]="false" [position]="'left'" header="Chapters"> <p-drawer [(visible)]="isDrawerVisible" [modal]="true" [position]="'left'" header="Chapters">
<ul class="chapter-list"> <ul class="chapter-list">
@for (chapter of chapters; track chapter) { @for (chapter of chapters; track chapter) {
<li (click)="navigateToChapter(chapter); $event.stopPropagation()" class="chapter-item"> <li (click)="navigateToChapter(chapter); $event.stopPropagation()" class="chapter-item">
@@ -29,7 +29,7 @@
} }
<div> <div>
<p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button> <p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button>
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="false" [position]="'right'" header="Settings"> <p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="true" [position]="'right'" header="Settings">
<div class="flex flex-col gap-4 max-w-md mx-auto"> <div class="flex flex-col gap-4 max-w-md mx-auto">
<div class="flex items-center gap-4"> <div class="flex items-center gap-4">
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<div class="p-4"> <div class="p-4">
<p class="text-lg gap-2 pb-4 pt-4">Internal Authentication:</p> <p class="text-lg gap-2 pb-4 pt-4">Internal Authentication:</p>
@@ -3,6 +3,12 @@
overflow-y: auto; overflow-y: auto;
} }
@media (max-width: 768px) {
.dashboard-container {
height: calc(100dvh - 5rem);
}
}
.dashboard { .dashboard {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -1,5 +1,5 @@
<div class="rounded-xl overflow-hidden"> <div class="rounded-xl overflow-hidden">
<p-tabs [value]="tab" lazy="true" scrollable > <p-tabs [value]="tab" lazy="true" scrollable>
<p-tablist> <p-tablist>
<p-tab value="view"> <p-tab value="view">
<i [class]="'pi pi-book'"></i> <i [class]="'pi pi-book'"></i>
@@ -18,7 +18,7 @@
</p-tab> </p-tab>
} }
</p-tablist> </p-tablist>
<p-tabpanels class="overflow-auto" style="height: calc(100dvh - 9.7rem);"> <p-tabpanels class="tabpanels-responsive overflow-auto">
<p-tabpanel value="view"> <p-tabpanel value="view">
<app-metadata-viewer [book$]="book$" [recommendedBooks]="recommendedBooks"></app-metadata-viewer> <app-metadata-viewer [book$]="book$" [recommendedBooks]="recommendedBooks"></app-metadata-viewer>
</p-tabpanel> </p-tabpanel>
@@ -1 +1,9 @@
.tabpanels-responsive {
height: calc(100vh - 9.7rem);
}
@media (max-width: 768px) {
.tabpanels-responsive {
height: calc(100vh - 8.5rem);
}
}
@@ -1,9 +1,9 @@
<div class="p-0 md:p-2 flex flex-col h-full w-full rounded-xl"> <div class="p-0 md:p-2 flex flex-col h-full w-full rounded-xl">
@if (book$ | async; as book) { @if (book$ | async; as book) {
<div class="flex flex-col md:flex-row gap-6 pb-8"> <div class="flex flex-col md:flex-row gap-4 md:gap-6 pb-8">
<div class="flex justify-center md:justify-start"> <div class="flex justify-center md:justify-start">
<div class="relative w-[250px] min-w-[250px] md:w-[250px]"> <div class="relative w-[175px] md:w-[250px]">
<img <img
[attr.src]="urlHelper.getCoverUrl(book?.metadata!.bookId, book?.metadata!.coverUpdatedOn)" [attr.src]="urlHelper.getCoverUrl(book?.metadata!.bookId, book?.metadata!.coverUpdatedOn)"
class="rounded-xl w-full object-cover" class="rounded-xl w-full object-cover"
@@ -53,7 +53,7 @@
<div class="flex flex-col items-center md:items-start gap-1"> <div class="flex flex-col items-center md:items-start gap-1">
<div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left"> <div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left">
<h2 class="text-3xl font-extrabold leading-tight"> <h2 class="text-2xl md:text-3xl font-extrabold leading-tight">
{{ book?.metadata!.title }} {{ book?.metadata!.title }}
</h2> </h2>
<i <i
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg p-4 enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg p-4 enclosing-container">
<div class="pt-2"> <div class="pt-2">
<app-email-provider></app-email-provider> <app-email-provider></app-email-provider>
</div> </div>
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<div class="px-4 pt-4 pb-2"> <div class="px-4 pt-4 pb-2">
<div class="flex items-center gap-2 pb-4 pt-4"> <div class="flex items-center gap-2 pb-4 pt-4">
@@ -130,14 +130,6 @@
<p-divider></p-divider> <p-divider></p-divider>
</div> </div>
<div class="px-4 py-2">
<app-opds-settings></app-opds-settings>
</div>
<div class="pt-2 pb-4">
<p-divider></p-divider>
</div>
<div class="px-4 py-2"> <div class="px-4 py-2">
<app-file-upload-pattern></app-file-upload-pattern> <app-file-upload-pattern></app-file-upload-pattern>
</div> </div>
@@ -36,15 +36,16 @@
<form [formGroup]="form"> <form [formGroup]="form">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-4 gap-x-6"> <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-4 gap-x-6">
@for (key of orderedKeys; track key) { @for (key of orderedKeys; track key) {
<div class="flex items-center gap-2"> <div class="flex text-sm items-center gap-2">
<label class="capitalize w-full max-w-[150px]"> <label class="capitalize w-full max-w-[150px]">
{{ labelMap[key] }} {{ labelMap[key] }}
</label> </label>
<input <input
pSize="small"
type="number" type="number"
pInputText pInputText
[formControlName]="key" [formControlName]="key"
class="w-20 text-center" class="w-16 text-center"
/> />
</div> </div>
} }
@@ -1,4 +1,5 @@
<p class="text-lg flex items-center gap-2"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<p class="text-lg flex items-center gap-2 px-4 pt-4 pb-2">
OPDS Server Settings OPDS Server Settings
<i <i
class="pi pi-info-circle text-sky-600" class="pi pi-info-circle text-sky-600"
@@ -6,8 +7,8 @@
tooltipPosition="right" tooltipPosition="right"
style="cursor: pointer;"> style="cursor: pointer;">
</i> </i>
</p> </p>
<div class="flex flex-col space-y-6 p-4 m-4 custom-border"> <div class="flex flex-col space-y-6 p-4 m-4 custom-border">
<div class="flex items-center gap-4"> <div class="flex items-center gap-4">
<p class="py-1">OPDS Server Enabled:</p> <p class="py-1">OPDS Server Enabled:</p>
@@ -100,9 +101,8 @@
</div> </div>
</div> </div>
} }
</div> </div>
<p-dialog
<p-dialog
header="Create New OPDS User" header="Create New OPDS User"
[(visible)]="createUserDialogVisible" [(visible)]="createUserDialogVisible"
[modal]="true" [modal]="true"
@@ -141,9 +141,8 @@
</p-button> </p-button>
</div> </div>
</div> </div>
</p-dialog> </p-dialog>
<p-dialog
<p-dialog
header="Reset User Password" header="Reset User Password"
[(visible)]="resetPasswordDialogVisible" [(visible)]="resetPasswordDialogVisible"
[modal]="true" [modal]="true"
@@ -178,4 +177,5 @@
</p-button> </p-button>
</div> </div>
</div> </div>
</p-dialog> </p-dialog>
</div>
@@ -1,3 +1,7 @@
.enclosing-container {
border-color: var(--p-content-border-color);
}
.custom-border { .custom-border {
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: var(--card-border); border-radius: var(--card-border);
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<div class="p-4 pt-6 min-w-[50rem]"> <div class="p-4 pt-6 min-w-[50rem]">
<p class="text-lg pb-4 pt-2">Auto-Download Metadata for Files in BookDrop Folder:</p> <p class="text-lg pb-4 pt-2">Auto-Download Metadata for Files in BookDrop Folder:</p>
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<div class="p-4"> <div class="p-4">
<p class="text-lg pb-4 pt-4 "> <p class="text-lg pb-4 pt-4 ">
Book Reader Settings: Global or Per-Book Book Reader Settings: Global or Per-Book
@@ -4,27 +4,30 @@
<p-tabs [(value)]="activeTab" scrollable> <p-tabs [(value)]="activeTab" scrollable>
<p-tablist> <p-tablist>
<p-tab [value]="SettingsTab.ReaderSettings"> <p-tab [value]="SettingsTab.ReaderSettings">
<i class="pi pi-book"></i> Reader Preferences <i class="pi pi-book"></i> Reader
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.ViewPreferences"> <p-tab [value]="SettingsTab.ViewPreferences">
<i class="pi pi-desktop"></i> View Preferences <i class="pi pi-desktop"></i> View
</p-tab> </p-tab>
@if (userData.permissions.admin) { @if (userData.permissions.admin) {
<p-tab [value]="SettingsTab.MetadataSettings"> <p-tab [value]="SettingsTab.MetadataSettings">
<i class="pi pi-sliders-h"></i> Metadata Settings <i class="pi pi-sliders-h"></i> Metadata
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.ApplicationSettings"> <p-tab [value]="SettingsTab.ApplicationSettings">
<i class="pi pi-cog"></i> Application Settings <i class="pi pi-cog"></i> Application
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.UserManagement"> <p-tab [value]="SettingsTab.UserManagement">
<i class="pi pi-users"></i> User Management <i class="pi pi-users"></i> User
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.EmailSettings"> <p-tab [value]="SettingsTab.EmailSettings">
<i class="pi pi-envelope"></i> Email Settings <i class="pi pi-envelope"></i> Email
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.AuthenticationSettings"> <p-tab [value]="SettingsTab.AuthenticationSettings">
<i class="pi pi-lock"></i> Authentication <i class="pi pi-lock"></i> Authentication
</p-tab> </p-tab>
<p-tab [value]="SettingsTab.Opds">
<i class="pi pi-globe"></i> OPDS
</p-tab>
} }
</p-tablist> </p-tablist>
<p-tabpanels> <p-tabpanels>
@@ -50,6 +53,9 @@
<p-tabpanel [value]="SettingsTab.AuthenticationSettings"> <p-tabpanel [value]="SettingsTab.AuthenticationSettings">
<app-authentication-settings></app-authentication-settings> <app-authentication-settings></app-authentication-settings>
</p-tabpanel> </p-tabpanel>
<p-tabpanel [value]="SettingsTab.Opds">
<app-opds-settings></app-opds-settings>
</p-tabpanel>
} }
</p-tabpanels> </p-tabpanels>
</p-tabs> </p-tabs>
@@ -11,6 +11,7 @@ import {AuthenticationSettingsComponent} from '../core/security/oauth2-managemen
import {ViewPreferencesParentComponent} from './view-preferences-parent/view-preferences-parent.component'; import {ViewPreferencesParentComponent} from './view-preferences-parent/view-preferences-parent.component';
import {ReaderPreferences} from './reader-preferences/reader-preferences.component'; import {ReaderPreferences} from './reader-preferences/reader-preferences.component';
import {MetadataSettingsComponent} from './metadata-settings-component/metadata-settings-component'; import {MetadataSettingsComponent} from './metadata-settings-component/metadata-settings-component';
import {OpdsSettingsComponent} from './global-preferences/opds-settings/opds-settings.component';
export enum SettingsTab { export enum SettingsTab {
ReaderSettings = 'reader-settings', ReaderSettings = 'reader-settings',
@@ -19,7 +20,8 @@ export enum SettingsTab {
EmailSettings = 'email-settings', EmailSettings = 'email-settings',
MetadataSettings = 'metadata-settings', MetadataSettings = 'metadata-settings',
ApplicationSettings = 'app-settings', ApplicationSettings = 'app-settings',
AuthenticationSettings = 'auth-settings' AuthenticationSettings = 'auth-settings',
Opds = 'opds-settings'
} }
@Component({ @Component({
@@ -37,8 +39,9 @@ export enum SettingsTab {
AuthenticationSettingsComponent, AuthenticationSettingsComponent,
ViewPreferencesParentComponent, ViewPreferencesParentComponent,
ReaderPreferences, ReaderPreferences,
MetadataSettingsComponent MetadataSettingsComponent,
], OpdsSettingsComponent
],
templateUrl: './settings.component.html', templateUrl: './settings.component.html',
styleUrl: './settings.component.scss' styleUrl: './settings.component.scss'
}) })
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg p-4 enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg p-4 enclosing-container">
<div class="flex justify-between items-center pb-2 pt-2"> <div class="flex justify-between items-center pb-2 pt-2">
<h2 class="text-lg flex items-center gap-2"> <h2 class="text-lg flex items-center gap-2">
@@ -1,4 +1,4 @@
<div class="w-full h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container">
<app-view-preferences></app-view-preferences> <app-view-preferences></app-view-preferences>
<p-divider></p-divider> <p-divider></p-divider>
<app-sidebar-sorting-preferences></app-sidebar-sorting-preferences> <app-sidebar-sorting-preferences></app-sidebar-sorting-preferences>
@@ -65,7 +65,7 @@
.layout-wrapper { .layout-wrapper {
.layout-main-container { .layout-main-container {
padding: 4.75rem 0.75rem 0.75rem 0.75rem; padding: 4.4rem 0.5rem 0.5rem 0.5rem;
} }
.layout-sidebar { .layout-sidebar {