Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
Add an end screen for participants
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed May 28, 2021
1 parent 721dfe8 commit 55463d0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ <h2>{{activeItem?.question}}</h2>

<!-- Waiting for presenter -->
<nz-result
*ngIf="poll && !poll.currentItem"
*ngIf="poll && !poll.currentItem && !pollOver"
nzStatus="403"
nzTitle="Waiting for presenter"
nzSubTitle="Waiting for the presenter to start the poll ...">
</nz-result>

<!-- End screen -->
<nz-result
*ngIf="pollOver"
nzStatus="success"
nzTitle="Poll finished"
nzSubTitle="Congrats! You completed the poll. Thanks for participating!">
</nz-result>

<!-- Poll not found -->
<nz-result
*ngIf="!loading && !poll"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class PollParticipantsComponent implements OnInit, OnDestroy {
answer = null;
sent = false;
loading = true;
pollOver = false;

/**
* Initialize component
Expand Down Expand Up @@ -86,6 +87,7 @@ export class PollParticipantsComponent implements OnInit, OnDestroy {
} else {
this.poll.currentItem = null;
}
if (this.activeItemType !== '') this.pollOver = true;
this.activeItem = null;
this.activeItemType = '';
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/pages/presentation/presentation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ <h2>{{activeItem?.question}}</h2>
class="chart" [view]="[700, 400]"
[results]="chartData"
legend="true"
doughnut="true"
arcWidth="0.35"
scheme="forest">
</ngx-charts-pie-chart>
<ngx-charts-pie-chart *ngIf="activeItem.type === 'quiz'"
class="chart" [view]="[700, 400]"
[results]="chartData"
legend="true"
doughnut="true"
arcWidth="0.35"
scheme="forest">
</ngx-charts-pie-chart>
<button class="next-button" nz-button nzType="primary" (click)="next()">Next question</button>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/presentation/presentation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class PresentationComponent implements OnInit {
// Connect to WebSocket
const subscription = this.websocketService.establishConnectionPresentation(this.pollId);
subscription.subscribe(pollItem => {
console.log('PollItem' + JSON.stringify(pollItem));
if (Object.keys(pollItem).length > 1) {
// Update UI
this.activeItem = pollItem;
Expand All @@ -81,6 +80,7 @@ export class PresentationComponent implements OnInit {
} else {
this.activeItem = pollItem;
this.poll.currentItem = pollItem.itemId;
this.chartData = this.getChartData();
}
});
}
Expand Down

0 comments on commit 55463d0

Please sign in to comment.