Skip to content

Commit

Permalink
don't render video in ssr, fix download click
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosack committed Jun 28, 2023
1 parent 9fb3e66 commit d80e629
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/game/detail/stats/stats.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
></ng-table>
</div>
</div>
<div *ngIf="game.gameVideoUrl" class="row">
<div *ngIf="game.gameVideoUrl && isBrowser" class="row">
<div class="col-md-12">
<vg-player>
<video [vgMedia]="media" #media id="replay" preload="auto" controls style="width: 100%">
Expand Down
11 changes: 10 additions & 1 deletion src/app/game/detail/stats/stats.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, OnInit } from "@angular/core";
import { Game, GamePlayer, ProfileCacheService, CivGame, MetadataCacheService } from "pydt-shared";
import { Utility } from "../../../shared/utility";
import { BrowserDataService } from "../../../shared/browser-data.service";

export interface TableColumn {
title: string;
Expand Down Expand Up @@ -28,12 +29,20 @@ export class GameDetailStatsComponent implements OnInit {
tableData: Array<unknown>;
games: CivGame[] = [];

constructor(private profileCache: ProfileCacheService, private metadataCache: MetadataCacheService) {}
constructor(
private profileCache: ProfileCacheService,
private metadataCache: MetadataCacheService,
private browserData: BrowserDataService,
) {}

get civGame(): CivGame {
return this.games.find(x => x.id === this.game.gameType);
}

get isBrowser() {
return this.browserData.isBrowser();
}

async ngOnInit(): Promise<void> {
this.games = (await this.metadataCache.getCivGameMetadata()).civGames;
if (this.civGame.turnTimerSupported) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/game/detail/turns/turns.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class GameDetailTurnsComponent implements OnInit {
timeTaken: timeTaken.toString(),
skipped: turn.skipped ? "Skipped!" : "",
download: canDownload(turn)
? `<a href='#' *ngIf="false" onClick="window.dispatchEvent(new CustomEvent('DownloadTurn', { detail: ${turn.turn} }));return false;">Download</a>`
? `<a href='#' onMousedown="console.log('hi');window.dispatchEvent(new CustomEvent('DownloadTurn', { detail: ${turn.turn} }));return false;">Download</a>`
: "",
};
});
Expand Down

0 comments on commit d80e629

Please sign in to comment.