added missing src files

This commit is contained in:
Joachim 2018-09-08 21:52:36 +02:00
parent 199d66c169
commit 227226d89e
9 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,8 @@
import { SecondsPipe } from './seconds.pipe';
describe('SecondsPipe', () => {
it('create an instance', () => {
const pipe = new SecondsPipe();
expect(pipe).toBeTruthy();
});
});

16
src/app/seconds.pipe.ts Normal file
View File

@ -0,0 +1,16 @@
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'seconds'
})
export class SecondsPipe implements PipeTransform {
transform(value: any, args?: any): any {
if (value) {
return ((value / 1000) % 60).toFixed(2);
} else {
return null;
}
}
}

View File

@ -0,0 +1,2 @@
<span *ngIf="prefix && theNumber">{{prefix}}</span><span class="number">{{theNumber}}</span><span class="unit" *ngIf="theNumber">{{theUnit}}</span>

View File

@ -0,0 +1,7 @@
.unit {
font-size: 60%;
}
span {
font-family: monospace;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TimespanComponent } from './timespan.component';
describe('TimespanComponent', () => {
let component: TimespanComponent;
let fixture: ComponentFixture<TimespanComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TimespanComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TimespanComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,25 @@
import {Component, Input, OnInit} from '@angular/core';
@Component({
selector: 'app-timespan',
templateUrl: './timespan.component.html',
styleUrls: ['./timespan.component.scss']
})
export class TimespanComponent implements OnInit {
@Input()
prefix: string;
@Input()
theNumber: number;
@Input()
theUnit: string;
constructor() {
}
ngOnInit() {
}
}

View File

@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';
import { TopmenuService } from './topmenu.service';
describe('TopmenuService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [TopmenuService]
});
});
it('should be created', inject([TopmenuService], (service: TopmenuService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -0,0 +1,39 @@
import {Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class TopmenuService {
public poules$: BehaviorSubject<number[]> = new BehaviorSubject<number[]>([]);
public tier$: BehaviorSubject<number> = new BehaviorSubject<number>(null);
public poule$ = new BehaviorSubject<number>(null);
public championship$ = new BehaviorSubject<number>(null);
constructor() {
}
setPoules(poules: number[]) {
this.poules$.next(poules);
}
setTier(tier: number) {
console.log('setting tier...');
if (this.tier$.value !== tier) {
console.log('overriding tier now.');
this.tier$.next(tier);
}
}
setPoule(poule: number) {
if (this.poule$.value !== poule)
this.poule$.next(poule);
}
setChampionship(championship: number) {
if (this.championship$.value !== championship)
this.championship$.next(championship);
}
}

1
src/globals.scss Normal file
View File

@ -0,0 +1 @@
$reclameheight: 100px;