Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…e end of playlist behaviour to work well on both pod and spa mode. Added a loading spinner to there are no horrid white screens
  • Loading branch information
InBrewJ committed Dec 13, 2019
1 parent 57bbf64 commit 77abe4a
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 45 deletions.
90 changes: 56 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lrpi_tablet_ui",
"version": "1.0.1",
"version": "1.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
Expand Down
6 changes: 5 additions & 1 deletion src/app/app.component.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
html {
background-color: black;
}

.settings-room-name {
padding: 0.6em 0 0.6em 10vw;
background-color: black;
Expand All @@ -12,7 +16,7 @@

p.slave-prompt {
padding: 0.6em 0 0.6em 10vw
}
}

.pair-button button {
margin-left: 0.3em;
Expand Down
8 changes: 2 additions & 6 deletions src/app/pages/track-control/track-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class TrackControlComponent implements OnInit {
this.now = this.hhmmss(this.ticks += 1);
} else if (this.ticks >= +this.totalTicks && this.ticks != 0 && this.playing) {
this.resetProgressBar()
this.autoSkip();
this.next(undefined);;
}
this.i_progress = Math.floor((this.ticks/this.totalTicks)*100)
}, 1000);
Expand All @@ -160,11 +160,6 @@ export class TrackControlComponent implements OnInit {
this.playing = false;
this.skipped = false;
this.duration = 'XX:XX:XX';
if (this.hrId === 0) this.started = false;
}

autoSkip() {
if (this.endOfPlaylist() === false) this.next(undefined);
}

play() {
Expand Down Expand Up @@ -199,6 +194,7 @@ export class TrackControlComponent implements OnInit {
next(interval) {
if(!this.loading) {
this.hrId = ((++this.hrId) % (this.numTracks));
if (this.hrId === 0) this.started = false;
this.fadeToTrack(
this.hrId,
this.playing ? interval : 0
Expand Down
11 changes: 8 additions & 3 deletions src/app/pages/track-selector/track-selector.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- <router-outlet></router-outlet> -->
<div *ngIf="serverData != null; else elseBlock">
<div id="mainBox" [ngStyle]="styleObject()" *ngIf="loading">
<h2>Please wait...</h2>
<mat-spinner class="white"></mat-spinner>
</div>

<div *ngIf="serverData != null; else error">
<div id="mainBox" [ngStyle]="styleObject()">
<div class="selector-heading">Select treatment:</div>
<div *ngFor="let item of serverData | async" [ngStyle]="itemStyleObject()">
Expand All @@ -18,12 +23,12 @@
<mat-icon>arrow_right_alt</mat-icon>
</div>
</div>
</a>
</a>
</ng-template>

</div>
</div>
</div>
<ng-template #elseBlock>
<ng-template #error>
<div class="error">{{ errorResponse.message }}</div>
</ng-template>
3 changes: 3 additions & 0 deletions src/app/pages/track-selector/track-selector.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class TrackSelectorComponent implements OnInit {
folderId = null;
settings: any;
roomName: string = '?';
loading = true;

constructor(
private httpClient: HttpClient,
Expand Down Expand Up @@ -55,6 +56,7 @@ export class TrackSelectorComponent implements OnInit {
ngOnInit() {

this.folderId = this.route.snapshot.queryParamMap.get("id");
this.loading = true;

this.getTracksService.getStatus().pipe(
switchMap((status: any) => {
Expand Down Expand Up @@ -87,6 +89,7 @@ export class TrackSelectorComponent implements OnInit {
console.log('In the playlist processor');

let data: any = d;
this.loading = false;

console.log('tracks: ', data, ' length: ', data.length);

Expand Down
4 changes: 4 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ a {
font-weight: bold;
}

.mat-spinner.white circle {
stroke: white;
}


.mat-progress-spinner circle, .mat-spinner circle {
stroke: black;
Expand Down

0 comments on commit 77abe4a

Please sign in to comment.