Skip to content

Commit

Permalink
Better visibility on last submission for #604.
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Feb 17, 2025
1 parent 026162e commit ed279f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>

<div *ngIf="!!this.pending" class="small-spinner">
<app-spinner></app-spinner>
<app-spinner size="small"></app-spinner>
</div>
<span *ngIf="this.session.endDate">
<strong><app-countdown [countdownTo]="this.session.endDate.valueOf()"></app-countdown></strong>
Expand All @@ -66,11 +66,13 @@
<div><strong>Score: </strong> {{state.challenge.score}} of {{state.challenge.maxPoints}}</div>
</div>

<div class="d-flex my-2" *ngIf="state.challenge.questions?.length">
<div class="d-flex align-items-center my-2" *ngIf="state.challenge.questions?.length">
<div class="flex-grow-1">
<span *ngIf="state.challenge.maxAttempts && state.challenge.attempts + 1 === state.challenge.maxAttempts"
class="fw-bold text-warning">
This is last your attempt.
<span class="font-weight-bold cursor-pointer text-dashed-underline"
(click)="handleLastSubmissionHelp()">[?]</span>
</span>
</div>
<app-confirm-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { UnsubscriberService } from '@/services/unsubscriber.service';
import { ChallengeSubmissionAnswers, ChallengeSubmissionViewModelLegacy, GetChallengeSubmissionsResponseLegacy } from '@/api/challenges.models';
import { ToastService } from '@/utility/services/toast.service';
import { ChallengeSubmissionsService } from '@/api/challenge-submissions.service';
import { ModalConfirmService } from '@/services/modal-confirm.service';

interface PendingSubmissionsUpdate {
challengeId: string;
Expand Down Expand Up @@ -50,6 +51,7 @@ export class GamespaceQuizComponent implements OnInit, OnChanges {
private api: BoardService,
private challengesService: ChallengesService,
private challengeSubmissionsService: ChallengeSubmissionsService,
private modalService: ModalConfirmService,
private teamHub: NotificationService,
private toastsService: ToastService,
private unsub: UnsubscriberService) { }
Expand Down Expand Up @@ -162,6 +164,15 @@ export class GamespaceQuizComponent implements OnInit, OnChanges {
});
}

protected handleLastSubmissionHelp() {
this.modalService.openConfirm({
title: "Last Submission",
bodyContent: "This is your last submission. Win or lose, after you confirm your answers here, your consoles will become unavailable, and the challenge will end. Good luck!",
cancelButtonText: "Got it!",
hideCancel: true
});
}

private async handleChallengeUpdated(challenge: Challenge) {
this.spec.instance = challenge;
this.api.setColor(this.spec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export class ModalConfirmService implements OnDestroy {
}

private openWithDefaultStyles<TComponent>(config: ModalConfig<TComponent>) {
if (this.bsModalRef)
if (this.bsModalRef) {
this.hide();
}

return this.bsModalService.show(config.content, {
initialState: config.context as unknown as Partial<TComponent>,
Expand Down

0 comments on commit ed279f4

Please sign in to comment.