Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

1.1 KB
Raw Blame
import { Pipe, PipeTransform } from '@angular/core';
import {SortField} from "../_models/metadata/series-filter";
import {TranslocoService} from "@ngneat/transloco";

@Pipe({
  name: 'sortField',
  standalone: true
})
export class SortFieldPipe implements PipeTransform {

  constructor(private translocoService: TranslocoService) {
  }

  transform(value: SortField): string {
    switch (value) {
      case SortField.SortName:
        return this.translocoService.translate('sort-field-pipe.sort-name')
      case SortField.Created:
        return this.translocoService.translate('sort-field-pipe.created')
      case SortField.LastModified:
        return this.translocoService.translate('sort-field-pipe.last-modified')
      case SortField.LastChapterAdded:
        return this.translocoService.translate('sort-field-pipe.last-chapter-added')
      case SortField.TimeToRead:
        return this.translocoService.translate('sort-field-pipe.time-to-read')
      case SortField.ReleaseYear:
        return this.translocoService.translate('sort-field-pipe.release-year')
    }

  }

}