Files
grimmory/frontend/src/app/shared/service/page-title.service.ts
T
James Cox 874b013f75 refactor(frontend): rename booklore-ui to frontend
- Frontend path:
  - rename the tracked Angular app tree from `booklore-ui/` to `frontend/`
  - preserve file contents during the move so this commit stays focused on the path change itself
- Frontend docs:
  - update the moved frontend README and contribution guide where they refer to the renamed folder
  - keep those edits limited to path references introduced by the directory rename
2026-04-22 17:26:39 -04:00

26 lines
919 B
TypeScript

import {inject, Injectable} from "@angular/core";
import {Title} from "@angular/platform-browser";
import {Book} from "../../features/book/model/book.model";
@Injectable({providedIn: 'root'})
export class PageTitleService {
protected titleService = inject(Title)
private appName = 'Grimmory'
setBookPageTitle(book: Book) {
const title = [
`${book.libraryName}/${book.metadata?.title || book.fileName}`,
book.metadata?.seriesName ? `(${book.metadata.seriesName} series)` : false,
book.metadata?.authors?.length ? `- by ${new Intl.ListFormat('en').format(book.metadata?.authors)}` : false,
`(${book.primaryFile?.bookType})`
].filter(part => part);
this.setPageTitle(title.join(' '));
}
setPageTitle(pageTitle: string) {
this.titleService.setTitle([pageTitle, this.appName].filter(part => part).join(' - '));
}
}