feat(dashboard): implement player

This commit is contained in:
ZloiY 2017-08-06 15:51:07 +03:00 committed by tibing
parent 223c13ad99
commit 124f9c15a8
17 changed files with 545 additions and 254 deletions

View file

@ -1,3 +1,4 @@
export * from './capitalize.pipe';
export * from './plural.pipe';
export * from './round.pipe';
export * from './timing.pipe';

View file

@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'timing' })
export class TimingPipe implements PipeTransform {
transform(time: number): string {
if (time) {
const minutes = Math.floor(time / 60);
const seconds = Math.floor(time % 60);
return `${this.initZero(minutes)}${minutes}:${this.initZero(seconds)}${seconds}`;
}
return '00:00';
}
private initZero(time: number): string {
return time < 10 ? '0' : '';
}
}

View file

@ -24,7 +24,7 @@ import {
ThemeSettingsComponent,
TinyMCEComponent,
} from './components';
import { CapitalizePipe, PluralPipe, RoundPipe } from './pipes';
import { CapitalizePipe, PluralPipe, RoundPipe, TimingPipe } from './pipes';
import {
OneColumnLayoutComponent,
SampleLayoutComponent,
@ -62,7 +62,12 @@ const COMPONENTS = [
TwoColumnsLayoutComponent,
];
const PIPES = [CapitalizePipe, PluralPipe, RoundPipe];
const PIPES = [
CapitalizePipe,
PluralPipe,
RoundPipe,
TimingPipe,
];
const NB_THEME_PROVIDERS = [
...NbThemeModule.forRoot(