Support per-library and per-shelf sorting and view preferences

This commit is contained in:
aditya.chandel
2025-05-27 21:05:24 -07:00
committed by Aditya Chandel
parent 9c6d45eecd
commit 9acd062634
21 changed files with 559 additions and 135 deletions
@@ -1,12 +1,29 @@
import {inject, Injectable, Injector} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {BehaviorSubject, Observable, tap, throwError} from 'rxjs';
import {BehaviorSubject, Observable, throwError} from 'rxjs';
import {API_CONFIG} from '../../config/api-config';
import {RxStompService} from '../../shared/websocket/rx-stomp.service';
import {Library} from '../../book/model/library.model';
import {catchError} from 'rxjs/operators';
import {CbxPageSpread, CbxPageViewMode} from '../../book/model/book.model';
export interface EntityViewPreferences {
global: EntityViewPreference;
overrides: EntityViewPreferenceOverride[];
}
export interface EntityViewPreference {
sortKey: string;
sortDir: 'ASC' | 'DESC';
view: 'GRID' | 'TABLE';
}
export interface EntityViewPreferenceOverride {
entityType: 'LIBRARY' | 'SHELF';
entityId: number;
preferences: EntityViewPreference;
}
export interface SidebarLibrarySorting {
field: string;
order: string;
@@ -49,7 +66,8 @@ export interface UserSettings {
epubReaderSetting: EpubReaderSetting;
cbxReaderSetting: CbxReaderSetting;
sidebarLibrarySorting: SidebarLibrarySorting;
sidebarShelfSorting: SidebarShelfSorting
sidebarShelfSorting: SidebarShelfSorting;
entityViewPreferences: EntityViewPreferences;
}
export interface User {