chore(ui): clear settings and stats any bucket
Replace low-risk any usages in settings flows, paginator state handling, and chart helper code with concrete local types. Leave the remaining no-explicit-any backlog isolated to reader-specific files for the next passes. Validation: just ui lint
This commit is contained in:
+1
-1
@@ -129,7 +129,7 @@ export class EpubReaderPreferencesComponent implements OnDestroy {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = value;
|
||||
} else {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = null as any;
|
||||
this.userSettings.ebookReaderSetting.fontFamily = null;
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['ebookReaderSetting', 'fontFamily'], value);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import {User, UserService, UserSettings} from '../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type MutableSettingsBranch = Record<string, unknown>;
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class ReaderPreferencesService {
|
||||
private readonly userService = inject(UserService);
|
||||
@@ -22,9 +24,13 @@ export class ReaderPreferencesService {
|
||||
updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target: any = this.currentUser.userSettings;
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
target[path[i]] = {};
|
||||
}
|
||||
target = target[path[i]] as MutableSettingsBranch;
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
|
||||
+7
-2
@@ -10,6 +10,7 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
|
||||
const MIN_VISIBLE_FILTERS = 5;
|
||||
const MAX_VISIBLE_FILTERS = 20;
|
||||
type MutableSettingsBranch = Record<string, unknown>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-filter-preferences',
|
||||
@@ -71,9 +72,13 @@ export class FilterPreferencesComponent {
|
||||
private updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target: any = this.currentUser.userSettings;
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
target[path[i]] = {};
|
||||
}
|
||||
target = target[path[i]] as MutableSettingsBranch;
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
|
||||
+8
-2
@@ -7,6 +7,8 @@ import {FormsModule} from '@angular/forms';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type MutableSettingsBranch = Record<string, unknown>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-sidebar-sorting-preferences',
|
||||
imports: [
|
||||
@@ -76,9 +78,13 @@ export class SidebarSortingPreferencesComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
let target: any = this.currentUser.userSettings;
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
target[path[i]] = {};
|
||||
}
|
||||
target = target[path[i]] as MutableSettingsBranch;
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user