Fix client lint

This commit is contained in:
Chocobozzz 2022-11-15 15:16:41 +01:00
parent 99b757488c
commit 7dcd7d8140
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
9 changed files with 14 additions and 14 deletions

View File

@ -1,13 +1,13 @@
import { Observable, of as ofObservable, timer as observableTimer } from 'rxjs' import { Observable, of as ofObservable, timer as observableTimer } from 'rxjs'
import { switchMap } from 'rxjs/operators' import { switchMap } from 'rxjs/operators'
import { PreloadingStrategy, Route } from '@angular/router'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { PreloadingStrategy, Route } from '@angular/router'
@Injectable() @Injectable()
export class PreloadSelectedModulesList implements PreloadingStrategy { export class PreloadSelectedModulesList implements PreloadingStrategy {
preload (route: Route, load: () => Observable<any>): Observable<any> { preload (route: Route, load: () => Observable<any>): Observable<any> {
if (!route.data || !route.data.preload) return ofObservable(null) if (!route.data?.preload) return ofObservable(null)
if (typeof route.data.preload === 'number') { if (typeof route.data.preload === 'number') {
return observableTimer(route.data.preload).pipe(switchMap(() => load())) return observableTimer(route.data.preload).pipe(switchMap(() => load()))

View File

@ -13,7 +13,7 @@ export class NumberFormatterPipe implements PipeTransform {
static getDecimalForNumber (x: number, n = 1) { static getDecimalForNumber (x: number, n = 1) {
const v = x.toString().split('.') const v = x.toString().split('.')
const f = v[1] || '' const f = v[1] || ''
if (f.length > n) return +f.substr(0, n) if (f.length > n) return +f.substring(0, n)
return +f return +f
} }

View File

@ -74,7 +74,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
} }
buildRouterQuery () { buildRouterQuery () {
if (!this.playlistElement || !this.playlistElement.video) return {} if (!this.playlistElement?.video) return {}
return { return {
playlistPosition: this.playlistElement.position, playlistPosition: this.playlistElement.position,

View File

@ -32,7 +32,7 @@ export class PlaylistTracker {
const next = this.playlistElements.find(e => e.position === position) const next = this.playlistElements.find(e => e.position === position)
if (!next || !next.video) { if (!next?.video) {
return this.getNextPlaylistElement(position + 1) return this.getNextPlaylistElement(position + 1)
} }
@ -52,7 +52,7 @@ export class PlaylistTracker {
const prev = this.playlistElements.find(e => e.position === position) const prev = this.playlistElements.find(e => e.position === position)
if (!prev || !prev.video) { if (!prev?.video) {
return this.getNextPlaylistElement(position - 1) return this.getNextPlaylistElement(position - 1)
} }
@ -68,7 +68,7 @@ export class PlaylistTracker {
setPosition (position: number) { setPosition (position: number) {
this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) this.currentPlaylistElement = this.playlistElements.find(e => e.position === position)
if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) { if (!this.currentPlaylistElement?.video) {
logger.error('Current playlist element is not valid.', this.currentPlaylistElement) logger.error('Current playlist element is not valid.', this.currentPlaylistElement)
this.currentPlaylistElement = this.getNextPlaylistElement() this.currentPlaylistElement = this.getNextPlaylistElement()
} }

View File

@ -1,7 +1,7 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.json",
"include": [ "include": [
"src/standalone/videos/embed.ts", "./embed.ts",
"src/standalone/videos/test-embed.ts" "./test-embed.ts"
] ]
} }