-

-
{{housePoints.ravenclaw | number}}
-
-
-
-

+
+

+
{{factionPoints.starfleet | number}}
+
+
+
+
-
-

-
{{housePoints.hufflepuff | number}}
-
-
-
-

-
-
-

-
{{housePoints.slytherin | number}}
-
-
-
-

+
+

+
{{factionPoints.romulan | number}}
+
+
+
+
diff --git a/src/app/app.component.sass b/src/app/app.component.sass
index cf3a897..b2f0616 100644
--- a/src/app/app.component.sass
+++ b/src/app/app.component.sass
@@ -1,7 +1,7 @@
body
background-color: #000000
-.house-column
+.faction-column
display: table-cell !important
float: none !important
border-style: solid
@@ -21,19 +21,15 @@ body
img.crest
display: none !important
-#slytherin
+#romulan
background-color: #011803
border-color: #033807
color: #a2bea4
-#gryffindor
+#klingon
background-color: #640c02
border-color: #9c1203
color: #dfc06b
-#hufflepuff
- background-color: #664700
- border-color: #e3a000
- color: #e8b941
-#ravenclaw
+#starfleet
background-color: #000c33
border-color: #00165e
color: #77b7d2
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 43e363b..ac37585 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
-import { HousePoints } from './HousePoints';
-import { HousePointsRemoteService } from './house-points-remote.service';
+import { FactionPoints } from './FactionPoints';
+import { FactionPointsRemoteService } from './faction-points-remote.service';
@Component({
selector: 'app-root',
@@ -9,68 +9,59 @@ import { HousePointsRemoteService } from './house-points-remote.service';
})
export class AppComponent implements OnInit {
- constructor(private housePointsService: HousePointsRemoteService) { }
+ constructor(private factionPointsService: FactionPointsRemoteService) { }
ngOnInit() {
- this.getHousePoints();
- setInterval(()=>{this.getHousePoints();}, 10000);
+ this.getFactionPoints();
+ setInterval(()=>{this.getFactionPoints();}, 10000);
}
- getHousePoints(): void {
- this.housePointsService.getPoints$()
- .subscribe(points => this.housePoints = points);
+ getFactionPoints(): void {
+ this.factionPointsService.getPoints$()
+ .subscribe(points => this.factionPoints = points);
}
- updateHousePoints(housePoints: HousePoints): void {
- this.housePointsService.updatePoints$(housePoints)
+ updateFactionPoints(factionPoints: FactionPoints): void {
+ this.factionPointsService.updatePoints$(factionPoints)
.subscribe(result => {
console.log(result);
- this.getHousePoints();
+ this.getFactionPoints();
});
}
- title = 'Hogwart\'s Point Keeper';
+ title = 'Galaxy Point';
- housePoints: HousePoints;
+ factionPoints: FactionPoints;
- changeGryffindorPoints($event) {
- this.housePointsService.getPoints$()
+ changeKlingonPoints($event) {
+ this.factionPointsService.getPoints$()
.subscribe(points => {
- points.gryffindor += $event;
- this.updateHousePoints(points);
+ points.klingon += $event;
+ this.updateFactionPoints(points);
});
}
- changeRavenclawPoints($event) {
- this.housePointsService.getPoints$()
+ changeStarfleetPoints($event) {
+ this.factionPointsService.getPoints$()
.subscribe(points => {
- points.ravenclaw += $event;
- this.updateHousePoints(points);
+ points.starfleet += $event;
+ this.updateFactionPoints(points);
});
}
- changeHufflepuffPoints($event) {
- this.housePointsService.getPoints$()
+ changeRomulanPoints($event) {
+ this.factionPointsService.getPoints$()
.subscribe(points => {
- points.hufflepuff += $event;
- this.updateHousePoints(points);
- });
- }
-
- changeSlytherinPoints($event) {
- this.housePointsService.getPoints$()
- .subscribe(points => {
- points.slytherin += $event;
- this.updateHousePoints(points);
+ points.romulan += $event;
+ this.updateFactionPoints(points);
});
}
resetPoints() {
- this.updateHousePoints({
- gryffindor:0,
- ravenclaw:0,
- hufflepuff:0,
- slytherin:0
+ this.updateFactionPoints({
+ klingon:0,
+ starfleet:0,
+ romulan:0
});
}
}
diff --git a/src/app/house-points-remote.service.spec.ts b/src/app/faction-points-remote.service.spec.ts
similarity index 100%
rename from src/app/house-points-remote.service.spec.ts
rename to src/app/faction-points-remote.service.spec.ts
diff --git a/src/app/house-points-remote.service.ts b/src/app/faction-points-remote.service.ts
similarity index 60%
rename from src/app/house-points-remote.service.ts
rename to src/app/faction-points-remote.service.ts
index 6dcb202..bf420a5 100644
--- a/src/app/house-points-remote.service.ts
+++ b/src/app/faction-points-remote.service.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
// import { BehaviorSubject } from 'rxjs';
-import { HousePoints } from './HousePoints';
+import { FactionPoints } from './FactionPoints';
import { HttpClient } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
@@ -14,7 +14,7 @@ const httpOptions = {
@Injectable({
providedIn: 'root'
})
-export class HousePointsRemoteService {
+export class FactionPointsRemoteService {
url : string;
@@ -22,11 +22,11 @@ export class HousePointsRemoteService {
this.url = "https://api.myjson.com/bins/l1mki";
}
- getPoints$(): Observable
{
- return this.http.get(this.url);
+ getPoints$(): Observable {
+ return this.http.get(this.url);
}
- updatePoints$(points: HousePoints): Observable {
- return this.http.put(this.url, points, httpOptions);
+ updatePoints$(points: FactionPoints): Observable {
+ return this.http.put(this.url, points, httpOptions);
}
}
diff --git a/src/app/house-points.service.spec.ts b/src/app/faction-points.service.spec.ts
similarity index 50%
rename from src/app/house-points.service.spec.ts
rename to src/app/faction-points.service.spec.ts
index dc2ff62..27ddffb 100644
--- a/src/app/house-points.service.spec.ts
+++ b/src/app/faction-points.service.spec.ts
@@ -1,12 +1,12 @@
import { TestBed } from '@angular/core/testing';
-import { HousePointsService } from './house-points.service';
+import { FactionPointsService } from './faction-points.service';
-describe('HousePointsService', () => {
+describe('FactionPointsService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
- const service: HousePointsService = TestBed.get(HousePointsService);
+ const service: FactionPointsService = TestBed.get(FactionPointsService);
expect(service).toBeTruthy();
});
});
diff --git a/src/app/faction-points.service.ts b/src/app/faction-points.service.ts
new file mode 100644
index 0000000..d293cd2
--- /dev/null
+++ b/src/app/faction-points.service.ts
@@ -0,0 +1,20 @@
+import { Injectable } from '@angular/core';
+import { Observable, of } from 'rxjs';
+import { FactionPoints } from './FactionPoints';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class FactionPointsService {
+
+ constructor() { }
+
+ getPoints$(): Observable {
+
+ return of ({
+ klingon:0,
+ starfleet:0,
+ romulan:0
+ });
+ }
+}
diff --git a/src/app/house-points.service.ts b/src/app/house-points.service.ts
deleted file mode 100644
index 6c1452e..0000000
--- a/src/app/house-points.service.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Injectable } from '@angular/core';
-import { Observable, of } from 'rxjs';
-import { HousePoints } from './HousePoints';
-
-@Injectable({
- providedIn: 'root'
-})
-export class HousePointsService {
-
- constructor() { }
-
- getPoints$(): Observable {
-
- return of ({
- gryffindor:0,
- ravenclaw:0,
- hufflepuff:0,
- slytherin:0
- });
- }
-}