chore(ui): clear reader settings prefer-inject bucket

Convert reader settings and shared setup/custom-font components to field injection so these UI surfaces follow the project inject() convention without changing behavior.

Validation: just ui lint
This commit is contained in:
James Cox
2026-04-22 17:26:49 -04:00
committed by Zach Yale
parent b3fe4fd598
commit 4f7d38a306
6 changed files with 21 additions and 29 deletions
@@ -1,4 +1,4 @@
import {Component, EventEmitter, Inject, Input, OnInit, Output, Renderer2} from '@angular/core';
import {Component, EventEmitter, inject, Input, OnInit, Output, Renderer2} from '@angular/core';
import {DecimalPipe, DOCUMENT} from '@angular/common';
import {TranslocoDirective} from '@jsverse/transloco';
import {ReaderStateService} from '../state/reader-state.service';
@@ -39,13 +39,10 @@ export class ReaderSettingsDialogComponent implements OnInit {
{name: 'orange', value: '#FFD580', label: 'Orange'}
];
constructor(
private bookService: BookService,
private customFontService: EpubCustomFontService,
private renderer: Renderer2,
@Inject(DOCUMENT) private document: Document
) {
}
private bookService = inject(BookService);
private customFontService = inject(EpubCustomFontService);
private renderer = inject(Renderer2);
private document = inject(DOCUMENT);
ngOnInit() {
this.customFontService.injectCustomFontsStylesheet(this.renderer, this.document);
@@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, inject, Input, Output} from '@angular/core';
import {DecimalPipe} from '@angular/common';
import {TranslocoDirective} from '@jsverse/transloco';
import {ReaderStateService} from '../../state/reader-state.service';
@@ -19,7 +19,7 @@ export class ReaderQuickSettingsComponent {
@Output() closed = new EventEmitter<void>();
@Output() openFullSettings = new EventEmitter<void>();
constructor(private bookService: BookService) {}
private bookService = inject(BookService);
get state() {
return this.stateService.state();
@@ -25,6 +25,8 @@ export interface ReaderState {
providedIn: 'root'
})
export class ReaderStateService {
private bookService = inject(BookService);
private userService = inject(UserService);
private epubCustomFontService = inject(EpubCustomFontService);
private readonly BASE_FONTS = [
@@ -62,7 +64,7 @@ export class ReaderStateService {
private readonly _fonts = signal<{ name: string; value: string | null }[]>(this.BASE_FONTS);
readonly fonts = this._fonts.asReadonly();
constructor(private bookService: BookService, private userService: UserService) {
constructor() {
this.loadCustomFontsIntoList();
}
@@ -29,15 +29,12 @@ export class CustomFontsComponent implements OnInit {
readonly maxFonts = 10;
private customFontService = inject(CustomFontService);
private messageService = inject(MessageService);
private confirmationService = inject(ConfirmationService);
private dialogService = inject(DialogService);
private t = inject(TranslocoService);
constructor(
private customFontService: CustomFontService,
private messageService: MessageService,
private confirmationService: ConfirmationService,
private dialogService: DialogService
) {}
ngOnInit(): void {
this.loadFonts();
}
@@ -18,6 +18,9 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
})
export class FontUploadDialogComponent implements OnDestroy {
@ViewChild('fileInput') fileInput!: ElementRef<HTMLInputElement>;
private customFontService = inject(CustomFontService);
private messageService = inject(MessageService);
private dialogRef = inject(DynamicDialogRef);
private readonly t = inject(TranslocoService);
isUploading = false;
@@ -32,12 +35,6 @@ export class FontUploadDialogComponent implements OnDestroy {
readonly maxFonts = 10;
readonly acceptedFormats = ['.ttf', '.otf', '.woff', '.woff2'];
constructor(
private customFontService: CustomFontService,
private messageService: MessageService,
private dialogRef: DynamicDialogRef
) {}
onUploadZoneClick(): void {
if (this.isUploading) {
return;
@@ -22,17 +22,16 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
]
})
export class SetupComponent {
private fb = inject(FormBuilder);
private setupService = inject(SetupService);
private router = inject(Router);
setupForm: FormGroup;
loading = false;
error: string | null = null;
success = false;
private readonly t = inject(TranslocoService);
constructor(
private fb: FormBuilder,
private setupService: SetupService,
private router: Router
) {
constructor() {
this.setupForm = this.fb.group({
name: ['', [Validators.required]],
username: ['', [Validators.required]],