Skip to content

Commit

Permalink
feat(replays): Update replay DTO and view component
Browse files Browse the repository at this point in the history
- Updated the `ReplayDTO` model to change the property name from `miniMapUri` to `minimapUri`.
- Modified the `ReplaysIngestService` class to conditionally set the `MinimapUri` property based on whether the replay has been rendered.
- Updated the `view-post.component.html` template to handle the changes in the `post.replay.minimapUri` property.
- Added a processing message when rendering the replay minimap.

These changes improve consistency and enhance the display of replays in posts.
  • Loading branch information
SakuraIsayeki committed Jul 23, 2023
1 parent fbd7ac9 commit 8f564b6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion WowsKarma.Api/Services/Replays/ReplaysIngestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task<ReplayDTO> GetReplayDTOAsync(Guid id)
.Select(m => m with { Username = replay.Players.FirstOrDefault(p => p.AccountId == m.PlayerId).Name }),
Players = replay.Players.Adapt<IEnumerable<ReplayPlayerDTO>>(),
DownloadUri = $"{_containerClient.Uri}/{ReplayBlobContainer}/{replay.BlobName}",
MiniMapUri = $"{_serviceClient.Uri}{MinimapRenderingService.MinimapBlobContainer}/{replay.Id}.mp4"
MinimapUri = replay.MinimapRendered ? $"{_serviceClient.Uri}{MinimapRenderingService.MinimapBlobContainer}/{replay.Id}.mp4" : null
};
}

Expand Down
2 changes: 1 addition & 1 deletion WowsKarma.Common/Models/DTOs/Replays/ReplayDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public record ReplayDTO

public string DownloadUri { get; init; }

public string MiniMapUri { get; init; }
public string? MinimapUri { get; init; }

public IEnumerable<ReplayPlayerDTO> Players { get; set; }

Expand Down
10 changes: 7 additions & 3 deletions wowskarma.app/src/app/pages/post/view/view-post.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ <h1>View Post</h1>
<app-post [post]="post" [postDisplayType]="'neutral'"></app-post>
</div>

<div *ngIf="post.replay?.miniMapUri as minimapUri" class="col-xl-7 col-md-6">
<div *ngIf="post.replay" class="col-xl-7 col-md-6">
<!-- Display the minimap video -->
<h3 class="mb-5">Minimap</h3>
<h2 class="mb-5">Minimap</h2>

<video class="w-100" controls autoplay muted loop preload="auto">
<video *ngIf="post.replay.minimapUri as minimapUri else minimapProcessing" class="w-100" controls autoplay muted loop preload="auto">
<source [src]="minimapUri" type="video/mp4">
Your browser does not support the video tag.
</video>

<ng-template #minimapProcessing>
<h3 class="text-info"><i>Rendering Replay minimap...</i></h3>
</ng-template>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion wowskarma.app/src/app/services/api/models/replay-dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReplayPlayerDto } from './replay-player-dto';
export interface ReplayDto {
chatMessages?: null | Array<ReplayChatMessageDto>;
downloadUri?: null | string;
miniMapUri?: null | string;
minimapUri?: null | string;
id?: string;
players?: null | Array<ReplayPlayerDto>;
postId?: string;
Expand Down

0 comments on commit 8f564b6

Please sign in to comment.