Skip to content

Commit

Permalink
Update detailed match to include match thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Jan 7, 2023
1 parent dca1376 commit 4095acc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions website/src/components/website/match/DetailedMatchStat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
<div class="stat mb-2" v-if="shouldShow">
<div class="stat-a"><slot></slot></div>
<div class="stat-b" v-if="raw" v-html="formattedTargetData"></div>
<div class="" v-if="$slots.content">
<slot name="content"></slot>
</div>
<div class="stat-b" v-else-if="time">{{ prettyDate(targetData) }}</div>
<div class="stat-b" v-else-if="players">
<LinkedPlayers :players="targetData" :show-tally="showTally" />
</div>
<div class="stat-b" v-else-if="externalLink">
<a class="ct-active" :href="targetData" target="_blank">{{ targetData.replace('https://', '') }}</a>
</div>
<div class="stat-b" v-else>{{ formattedTargetData }}</div>
<div class="stat-b" v-else-if="formattedTargetData">{{ formattedTargetData }}</div>
</div>
</template>

Expand All @@ -31,7 +34,7 @@ export default {
return this.override || this.match[this.data];
},
shouldShow() {
return this.targetData && this.targetData?.length !== 0;
return this.$slots.content || (this.targetData && this.targetData?.length !== 0);
},
formattedTargetData() {
return this.format ? this.format(this.targetData) : this.targetData;
Expand Down
12 changes: 12 additions & 0 deletions website/src/views/DetailedMatch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@
{{ relGroup.items.length === 1 ? relGroup.meta.singular_name : relGroup.meta.plural_name }}
</stat>
<stat :match="match" data="replay_codes" :raw="true" :format="(t) => t[0].replace(/\n/g, '<br>')">Replay codes</stat>
<stat :match="match">
Match Thumbnails
<template v-slot:content class="d-inline">
<a :href="matchThumbnailURL(match, 720)" rel="nofollow" target="_blank">720p</a>,
<a :href="matchThumbnailURL(match, 1080)" rel="nofollow" target="_blank">1080p</a>
</template>
</stat>
</div>
</div>
</div>
Expand All @@ -172,6 +179,7 @@ import Markdown from "@/components/website/Markdown";
import { resizedImage, resizedImageNoWrap } from "@/utils/images";
import CopyTextButton from "@/components/website/CopyTextButton";
import BracketImplications from "@/components/website/dashboard/BracketImplications.vue";
import { getDataServerAddress } from "@/utils/fetch";
export default {
name: "DetailedMatch",
Expand Down Expand Up @@ -230,6 +238,10 @@ export default {
},
showLimitedPlayers(team) {
return ((team.players || [])?.length === 0) && (team.limited_players || []).length !== 0;
},
matchThumbnailURL(match, size) {
const dataServerURL = getDataServerAddress();
return `${dataServerURL}/match.png?id=${match.id}&size=${size || "720"}&padding=30`;
}
},
computed: {
Expand Down

0 comments on commit 4095acc

Please sign in to comment.