Refactored naming convention to match rest of the project.

This commit is contained in:
Joseph Milazzo 2025-06-08 05:44:28 -05:00
parent b372efaada
commit d417a0a610
7 changed files with 33 additions and 21 deletions

View file

@ -31,7 +31,9 @@ import {ChapterService} from "./chapter.service";
import {VolumeService} from "./volume.service";
import {DefaultModalOptions} from "../_models/default-modal-options";
import {MatchSeriesModalComponent} from "../_single-module/match-series-modal/match-series-modal.component";
import {BulkSetReadingProfileComponent} from "../cards/_modals/bulk-set-reading-profile/bulk-set-reading-profile.component";
import {
BulkSetReadingProfileModalComponent
} from "../cards/_modals/bulk-set-reading-profile-modal/bulk-set-reading-profile-modal.component";
export type LibraryActionCallback = (library: Partial<Library>) => void;
@ -822,7 +824,7 @@ export class ActionService {
setReadingProfileForMultiple(series: Array<Series>, callback?: BooleanActionCallback) {
if (this.readingListModalRef != null) { return; }
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileModalComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
this.readingListModalRef.componentInstance.seriesIds = series.map(s => s.id)
this.readingListModalRef.componentInstance.title = ""
@ -848,7 +850,7 @@ export class ActionService {
setReadingProfileForLibrary(library: Library, callback?: BooleanActionCallback) {
if (this.readingListModalRef != null) { return; }
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileModalComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
this.readingListModalRef.componentInstance.libraryId = library.id;
this.readingListModalRef.componentInstance.title = ""

View file

@ -35,7 +35,7 @@ export class ReadingProfileService {
return this.httpClient.post<ReadingProfile>(this.baseUrl + "reading-profile/series?seriesId="+seriesId, profile);
}
all() {
getAllProfiles() {
return this.httpClient.get<ReadingProfile[]>(this.baseUrl + 'reading-profile/all');
}

View file

@ -1,10 +1,10 @@
<ng-container *transloco="let t; prefix: 'bulk-set-reading-profile'">
<ng-container *transloco="let t; prefix: 'bulk-set-reading-profile-modal'">
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">{{t('title')}}</h4>
<button type="button" class="btn-close" [attr.aria-label]="t('close')" (click)="close()"></button>
</div>
<form style="width: 100%" [formGroup]="profileForm">
<form [formGroup]="profileForm">
<div class="modal-body">
@if (profiles.length >= MaxItems) {
<div class="mb-3">
@ -18,16 +18,16 @@
<ul class="list-group">
@for(profile of profiles | filter: filterList; let i = $index; track profile.name) {
<li class="list-group-item clickable" tabindex="0" role="option" (click)="addToProfile(profile)">
<li class="list-group-item clickable" tabindex="0" role="option" (click)="addToProfile(profile)">
{{profile.name}}
</li>
}
@if (profiles.length === 0 && !loading) {
@if (profiles.length === 0 && !isLoading) {
<li class="list-group-item">{{t('no-data')}}</li>
}
@if (loading) {
@if (isLoading) {
<li class="list-group-item">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">{{t('loading')}}</span>
@ -36,8 +36,14 @@
}
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="close()">{{t('close')}}</button>
</div>
</form>
</ng-container>

View file

@ -8,22 +8,25 @@ import {ReadingProfile} from "../../../_models/preferences/reading-profiles";
import {FilterPipe} from "../../../_pipes/filter.pipe";
@Component({
selector: 'app-bulk-set-reading-profile',
selector: 'app-bulk-set-reading-profile-modal',
imports: [
ReactiveFormsModule,
FilterPipe,
TranslocoDirective
],
templateUrl: './bulk-set-reading-profile.component.html',
styleUrl: './bulk-set-reading-profile.component.scss'
templateUrl: './bulk-set-reading-profile-modal.component.html',
styleUrl: './bulk-set-reading-profile-modal.component.scss'
})
export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
export class BulkSetReadingProfileModalComponent implements OnInit, AfterViewInit {
private readonly modal = inject(NgbActiveModal);
private readonly readingProfileService = inject(ReadingProfileService);
private readonly toastr = inject(ToastrService);
private readonly cdRef = inject(ChangeDetectorRef);
protected readonly MaxItems = 8;
/**
* Modal Header - since this code is used for multiple flows
*/
@Input({required: true}) title!: string;
/**
* Series Ids to add to Reading Profile
@ -33,19 +36,20 @@ export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
@ViewChild('title') inputElem!: ElementRef<HTMLInputElement>;
profiles: Array<ReadingProfile> = [];
loading: boolean = false;
profileForm: FormGroup = new FormGroup({});
isLoading: boolean = false;
profileForm: FormGroup = new FormGroup({
filterQuery: new FormControl('', []), // Used for inline filtering when too many RPs
});
ngOnInit(): void {
this.profileForm.addControl('title', new FormControl(this.title, []));
this.profileForm.addControl('filterQuery', new FormControl('', []));
this.loading = true;
this.isLoading = true;
this.cdRef.markForCheck();
this.readingProfileService.all().subscribe(profiles => {
this.readingProfileService.getAllProfiles().subscribe(profiles => {
this.profiles = profiles;
this.loading = false;
this.isLoading = false;
this.cdRef.markForCheck();
});
}

View file

@ -129,7 +129,7 @@ export class ManageReadingProfilesComponent implements OnInit {
}
});
this.readingProfileService.all().subscribe(profiles => {
this.readingProfileService.getAllProfiles().subscribe(profiles => {
this.readingProfiles = profiles;
this.loading = false;
this.setupForm();

View file

@ -1276,7 +1276,7 @@
"create": "{{common.create}}"
},
"bulk-set-reading-profile": {
"bulk-set-reading-profile-modal": {
"title": "Set Reading profile",
"close": "{{common.close}}",
"filter-label": "{{common.filter}}",