Skip to content

Commit

Permalink
V3.17.0 beta2 (#173)
Browse files Browse the repository at this point in the history
* Add external game host 'extend' endpoint

* Change default cancel button color on the default confirm dialog

* Incorporate advanced score into scoreboard. Fix bugs with manual bonuses and scoreboard.

* Start on #392.

* Finish. Resolves #392.

* Add date filters to challenges report (just filters stat data, not records).

* Try to have external game page scroll to bottom on iframe load.

* flex wrap on team active challenges

* Style scoreboard

* Refine ready player/session start in player admin.

* Style scoreboard

* Remove unused models and properties. Pull logging

* Allow games with end dates in the future as advance targets.

* Start admin enroll team

* Better hints for admin overview clicks

* Minor styling

* Fix a bug that prevented the 'start session' option from appearing in Game -
> players
  • Loading branch information
sei-bstein committed Mar 12, 2024
1 parent c338d4e commit 8c48cf7
Show file tree
Hide file tree
Showing 46 changed files with 419 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,39 @@
<!-- Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. -->

<ng-container *ngIf="team$ | async as team; else loading">
<h4 class="px-3">Timeline</h4>
<div class="timeline-container px-3">
<div>Timeline <span class="badge badge-info">[BETA]</span></div>
<app-team-event-horizon [teamId]="team.teamId"></app-team-event-horizon>
</div>

<app-error-div [errors]="errors"></app-error-div>

<h4 class="mt-4">Session Extension</h4>
<div *ngIf="team.advancedFromGame" class="advancement-container px-3">
<h4 class="mt-4">Advancement</h4>
<div class="d-flex justify-content-between">
<div class="advancement-info">
<h6>Advanced from</h6>
<div>{{team.advancedFromGame.name}}</div>
</div>

<div class="advancement-info">
<h6>Played as</h6>
<div>{{team.advancedFromPlayer?.name}}</div>
</div>

<div *ngIf="team.advancedFromTeamId && team.isAdvancedFromTeamGame" class="advancement-info">
<h6>Team</h6>
<div>{{team.advancedFromPlayer?.name}}</div>
</div>

<div class="advancement-info">
<h6>Score</h6>
<div>{{team.advancedWithScore || 0}}</div>
</div>
</div>
</div>

<h4 class="mt-4 px-3">Session Extension</h4>
<div class="form-group d-flex" *ngIf="!isExtending; else loading">
<div class="extend-by-duration flex-grow-1 mr-2">

Expand Down Expand Up @@ -39,12 +64,12 @@ <h4 class="mt-4">Session Extension</h4>
</div>
</div>

<app-announce [teamId]="team.teamId" placeholderText="Your message (sends only to this player/team)"></app-announce>

<div class="other-tools-container mb-2">
<h4 class="mb-2">Other tools</h4>
<h4 class="mb-2 px-3">Other tools</h4>

<app-announce [teamId]="team.teamId" placeholderText="Your message (sends only to this player/team)"></app-announce>

<div class="other-tools-buttons d-flex">
<div class="other-tools-buttons d-flex px-3">
<button class="btn btn-info btn-sm mr-2" (click)="toggleRawView(!showRaw)">
<fa-icon [icon]="faInfo"></fa-icon>
<span>{{ (showRaw ? "Hide" : "View") }} Data</span>
Expand All @@ -54,8 +79,9 @@ <h4 class="mb-2">Other tools</h4>
<app-confirm-button btnClass="btn btn-sm btn-danger" *ngIf="canUnenroll"
(confirm)="onUnenrollRequest.emit(team.teamId)">Unenroll</app-confirm-button>
<app-confirm-button btnClass="btn btn-sm btn-danger mr-2" *ngIf="!canUnenroll"
(confirm)="onResetSessionRequest.emit({ player, unenrollTeam: false })">Reset
Session</app-confirm-button>
(confirm)="onResetSessionRequest.emit({ player, unenrollTeam: false })">
Reset Session
</app-confirm-button>
<app-confirm-button btnClass="btn btn-sm btn-danger" *ngIf="!canUnenroll"
(confirm)="onResetSessionRequest.emit({ player, unenrollTeam: true })">Reset Session &amp;
Unenroll</app-confirm-button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
.yaml-container {
margin: 1.5rem 0 0 1.5rem;
padding-bottom: 1.5rem;
}
margin: 1.5rem 0 0 1.5rem;
padding-bottom: 1.5rem;
}

.advancement-container {
h6 {
font-size: 0.9rem;
font-weight: bold;
text-transform: uppercase;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { Observable, firstValueFrom } from 'rxjs';
import { first, tap } from 'rxjs/operators';
import { Player, Team, TimeWindow } from '../../api/player-models';
import { PlayerService } from '../../api/player.service';
import { GameSessionService } from '../../services/game-session.service';
import { Player, Team, TimeWindow } from '@/api/player-models';
import { PlayerService } from '@/api/player.service';
import { GameSessionService } from '@/services/game-session.service';
import { TeamAdminContextMenuSessionResetRequest } from '../components/team-admin-context-menu/team-admin-context-menu.component';
import { DateTime } from 'luxon';
import { ModalConfirmService } from '@/services/modal-confirm.service';
Expand Down
2 changes: 2 additions & 0 deletions projects/gameboard-ui/src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { SupportSettingsComponent } from './components/support-settings/support-
import { FeedbackEditorComponent } from './components/feedback-editor/feedback-editor.component';
import { ExtendTeamsModalComponent } from './components/extend-teams-modal/extend-teams-modal.component';
import { ActiveTeamsModalComponent } from './components/active-teams-modal/active-teams-modal.component';
import { AdminEnrollTeamModalComponent } from './components/admin-enroll-team-modal/admin-enroll-team-modal.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -109,6 +110,7 @@ import { ActiveTeamsModalComponent } from './components/active-teams-modal/activ
FeedbackEditorComponent,
ExtendTeamsModalComponent,
ActiveTeamsModalComponent,
AdminEnrollTeamModalComponent,
],
imports: [
CommonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4 class="game-link">
</a>
</h4>

<ul class="d-flex">
<ul class="d-flex flex-wrap">
<li *ngFor="let challenge of spec.challenges" class="card challenge-card my-3 mr-3">
<div class="card-body">
<h5 class="overflow-ellipsis">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ h5 {
}

li {
flex-basis: 32%;
flex-basis: 30%;
min-width: 250px;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="modal-content" *ngIf="game">
<div class="modal-header">
<h2 class="modal-title">Add {{game.isTeamGame ? "Team" : "Player"}}</h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" (click)="close()">
<span aria-hidden="true">&times;</span>
</button>
</div>

<div class="modal-body" *ngIf="!isWorking; else loading">
<app-error-div [errors]="errors"></app-error-div>
<div class="form-group">
<input type="text" class="form-control" [(ngModel)]="addUserId"
placeholder="This is totally the final interface, just so you know.">
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn link-button" (click)="close()">Cancel</button>
<button type="button" class="btn btn-success" (click)="handleAddClick(addUserId)">Add this player</button>
</div>
</div>

<ng-template #loading>
<app-spinner></app-spinner>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { TeamService } from '@/api/team.service';
import { ModalConfirmService } from '@/services/modal-confirm.service';
import { Component, OnInit } from '@angular/core';
import { firstValueFrom } from 'rxjs';

@Component({
selector: 'app-admin-enroll-team-modal',
templateUrl: './admin-enroll-team-modal.component.html',
styleUrls: ['./admin-enroll-team-modal.component.scss']
})
export class AdminEnrollTeamModalComponent implements OnInit {
game?: {
id: string;
name: string;
isTeamGame: boolean;
};

protected addUserId = "";
protected errors: any[] = [];
protected isWorking = false;

constructor(
private modalConfirmService: ModalConfirmService,
private teamService: TeamService) { }

ngOnInit(): void {
if (!this.game)
throw new Error("Can't resolve the game.");
}

protected close() {
this.modalConfirmService.hide();
}

protected async handleAddClick(userId: string) {
this.errors = [];
if (!this.game?.id)
return;

try {
await firstValueFrom(this.teamService.adminEnroll({ userIds: [this.addUserId], gameId: this.game.id }));
this.modalConfirmService.hide();
}
catch (err: any) {
this.errors.push(err);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="btn-group" *ngIf="team" dropdown>
|<div class="btn-group" *ngIf="team" dropdown>
<button [id]="'external-game-admin-context-menu-' + team.id" dropdownToggle type="button"
class="btn ctx-menu-button rounded-circle" aria-controls="dropdown-basic"
tooltip="Additional actions for this team">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { fa } from "@/services/font-awesome.service";
import { PlayerService } from '@/api/player.service';
import { firstValueFrom } from 'rxjs';
import { ClipboardService } from '@/utility/services/clipboard.service';
import { ToastService } from '@/utility/services/toast.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ <h6>{{ challengeSummary.score.totalScore }}</h6>
<strong>Manual Team Bonus</strong>
<div>{{bonus.description}}</div>
<div>
<em>({{bonus.enteredBy.name}}, {{ bonus.enteredOn | shortdate}} @ {{ bonus.enteredOn |
friendlyTime }})</em>
<em>
({{bonus.enteredBy.name}}, {{ bonus.enteredOn | shortdate}} @ {{ bonus.enteredOn |
friendlyTime }})
</em>
</div>
</td>
<td class="vertical-align-cell">
Expand All @@ -76,6 +78,17 @@ <h6>{{ challengeSummary.score.totalScore }}</h6>
<td class="text-center">{{bonus.pointValue}}</td>
</tr>

<tr *ngIf="teamScoreData.score.overallScore.advancedScore" class="advance-score-row">
<td>
<strong>Score from the previous game</strong>
</td>
<td></td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-center">{{teamScoreData.score.overallScore.advancedScore}}</td>
</tr>

<tr class="table-info h6">
<td></td>
<td></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ li {
vertical-align: middle;
}

tr.team-bonuses-row > td {
tr.team-bonuses-row > td,
tr.advance-score-row > td {
border-top: solid 1px $info;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</button>
<ul id="dropdown-basic" *dropdownMenu class="dropdown-menu" role="menu" aria-labelledby="button-basic">
<li role="menuitem">
<button class="dropdown-item btn" (click)="onViewRequest.emit(player)">
<button class="dropdown-item btn" (click)="viewRequest.emit(player)">
{{ isViewing ? "Collapse" : "View" }}
</button>
</li>
Expand All @@ -16,27 +16,45 @@
<button class="dropdown-item btn" (click)="copy(player.teamId, 'team ID')">Copy Team ID</button>
</li>
<li role="menuitem">
<button class="dropdown-item btn" (click)="onBonusManageRequest.emit(player)">
<button class="dropdown-item btn" (click)="bonusManageRequest.emit(player)">
Manual Bonuses
</button>
</li>
<ng-container *ngIf="!isSyncStartGame && !hasStartedSession">
<li class="divider dropdown-divider"></li>
<li role="menuitem" *ngIf="!isSyncStartGame; else syncStartGameItems">
<button class="dropdown-item btn btn-warning" (click)="handleStartSession(player)">
Start <strong>{{ player.approvedName }}'s</strong> Session
</button>
</li>
</ng-container>
<li class="divider dropdown-divider"></li>
<li role="menuitem" *ngIf="isResettingSession; else unenroll">
<button class="dropdown-item btn btn-danger"
(click)="onSessionResetRequest.emit({ player, unenrollTeam: false})">
(click)="sessionResetRequest.emit({ player, unenrollTeam: false})">
Reset Session
</button>

<button class="dropdown-item btn btn-danger"
(click)="onSessionResetRequest.emit({ player, unenrollTeam: true})">
(click)="sessionResetRequest.emit({ player, unenrollTeam: true})">
Reset Session &amp; Unenroll
</button>
</li>
<ng-template #unenroll>
<li role="menuitem">
<button type="button" class="dropdown-item btn btn-danger"
(click)="onUnenrollRequest.emit(player)">Unenroll</button>
(click)="unenrollRequest.emit(player)">Unenroll</button>
</li>
</ng-template>
</ul>
</div>

<ng-template #syncStartGameItems>
<button class="dropdown-item btn btn-warning" [disabled]="hasStartedSession"
(click)="handleUpdatePlayerReady(player, !player.isReady)">
<strong>
{{ player.isReady ? "Unready" : "Ready" }}
{{ player.approvedName }}
</strong>
</button>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
@import "../../../../scss/variables";

.ctx-menu-button {
aspect-ratio: 1 / 1;
aspect-ratio: 1 / 1;
}

.btn-danger {
font-weight: bold;
color: red;
color: red;
font-weight: bold;
}

.btn-warning {
color: $warning;
}

0 comments on commit 8c48cf7

Please sign in to comment.