Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion components/tournament/SimpleTournamentDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ import MapDisplay from "~/components/MapDisplay.vue";
variant="outline"
class="text-xs bg-black/70 text-white border-white/30 backdrop-blur-sm"
>
{{ stageCount }} {{ $t("tournament.stage.stages") }}
<template v-if="currentStage">
{{
$t("tournament.stage.stage_tab", { stage: currentStage.order })
}}
</template>
<template v-else>
{{ stageCount }} {{ $t("tournament.stage.stages") }}
</template>
</Badge>
<Badge
v-if="singleStageType"
Expand Down Expand Up @@ -108,6 +115,7 @@ import MapDisplay from "~/components/MapDisplay.vue";
<script lang="ts">
import { generateQuery } from "~/graphql/graphqlGen";
import { tournamentPlayerRankLabel } from "~/utilities/tournamentPlayerRank";
import { tournamentCurrentStage } from "~/utilities/tournamentCurrentStage";

export default {
props: {
Expand Down Expand Up @@ -149,6 +157,9 @@ export default {
stageCount() {
return this.tournament?.stages?.length || 0;
},
currentStage() {
return tournamentCurrentStage(this.tournament);
},
singleStageType() {
if (
this.stageCount === 1 &&
Expand Down
10 changes: 10 additions & 0 deletions components/tournament/TournamentCompactCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n";
import {
CalendarClock,
GitBranch,
RadioTower,
TicketCheck,
Trophy,
Expand All @@ -13,6 +14,7 @@ import AwardBadge from "~/components/award/AwardBadge.vue";
import TournamentMapMosaic from "~/components/tournament/TournamentMapMosaic.vue";
import { tournamentMapPosters } from "~/utilities/tournamentMapPosters";
import { tournamentPlayerRankLabel } from "~/utilities/tournamentPlayerRank";
import { tournamentCurrentStage } from "~/utilities/tournamentCurrentStage";

const { t } = useI18n();

Expand Down Expand Up @@ -150,6 +152,8 @@ const primaryStage = computed(() => {
)[0];
});

const currentStage = computed(() => tournamentCurrentStage(props.tournament));

// When the tournament organizer disabled awards, fall back to plain
// rank boxes (1ST / 2ND / 3RD) instead of the procedural award art.
const awardsEnabled = computed(
Expand Down Expand Up @@ -438,6 +442,12 @@ const runnerUps = computed(() => {
<span class="text-foreground">{{ teamsCount }}</span>
{{ $t("tournament.compact_card.teams") }}
</span>
<span v-if="currentStage" class="inline-flex items-center gap-1.5">
<GitBranch class="h-3 w-3" />
<span class="text-foreground">
{{ $t("tournament.stage.stage_tab", { stage: currentStage.order }) }}
</span>
</span>
<span class="inline-flex items-center gap-1.5">
<CalendarClock class="h-3 w-3" />
<span class="text-foreground">
Expand Down
3 changes: 3 additions & 0 deletions components/tournament/TournamentDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,9 @@ export default {
name: true,
start: true,
status: true,
// Cast: current_stage is a new computed field; drop it once
// `yarn codegen` has run against a migrated stack.
...({ current_stage: true } as {}),
auto_start: true,
scheduling_mode: true,
awards_enabled: true,
Expand Down
10 changes: 8 additions & 2 deletions components/tournament/TournamentFeatureCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import TournamentMapMosaic from "~/components/tournament/TournamentMapMosaic.vue
import { formatPrizePool } from "~/utilities/prizePool";
import { tournamentMapPosters } from "~/utilities/tournamentMapPosters";
import { tournamentPlayerRankLabel } from "~/utilities/tournamentPlayerRank";
import { tournamentCurrentStage } from "~/utilities/tournamentCurrentStage";

type TournamentStatusVariant = "default" | "finished" | "live" | "registration";

Expand Down Expand Up @@ -83,8 +84,10 @@ const primaryStage = computed(() => {
)[0];
});

const currentStage = computed(() => tournamentCurrentStage(props.tournament));

const stageLabel = computed(() => {
const stage = primaryStage.value;
const stage = currentStage.value ?? primaryStage.value;
const stageType =
stage?.e_tournament_stage_type?.description ||
stage?.type ||
Expand All @@ -93,7 +96,10 @@ const stageLabel = computed(() => {
stage?.options?.best_of ||
stage?.default_best_of ||
props.tournament?.options?.best_of;
return bestOf ? `${stageType} · BO${bestOf}` : stageType;
const label = bestOf ? `${stageType} · BO${bestOf}` : stageType;
return currentStage.value
? `${t("tournament.stage.stage_tab", { stage: stage.order })} · ${label}`
: label;
});

const playerRankLabel = computed(() =>
Expand Down
18 changes: 18 additions & 0 deletions components/tournament/TournamentStageBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ import {
v-if="shouldShowTabs"
v-model="activeTab"
default-value="stage-1"
@update:model-value="stagePicked = true"
class="w-full"
>
<!-- The stage strip scrolls horizontally rather than wrapping, so the
Expand Down Expand Up @@ -698,6 +699,7 @@ export default {
editStageDialogs: {} as Record<number, boolean>,
deleteAlertDialogs: {} as Record<number, boolean>,
activeTab: "stage-1",
stagePicked: false,
};
},
computed: {
Expand Down Expand Up @@ -750,6 +752,22 @@ export default {
}
},
},
// Land on the stage being played, and keep following it until the viewer
// picks a tab themselves.
"tournament.current_stage": {
immediate: true,
handler(stage: number | null) {
if (
this.stagePicked ||
this.activeTab === "add-stage" ||
stage == null ||
!this.stageNumbers.includes(stage)
) {
return;
}
this.activeTab = `stage-${stage}`;
},
},
},
methods: {
getFirstStageForTab(stageNumber: number) {
Expand Down
16 changes: 16 additions & 0 deletions generated/zeus/const.full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39033,6 +39033,7 @@ export const AllTypesProps: Record<string,any> = {
check_in_setting:"e_check_in_settings_enum_comparison_exp",
check_in_started:"Boolean_comparison_exp",
created_at:"timestamptz_comparison_exp",
current_stage:"Int_comparison_exp",
description:"String_comparison_exp",
discord_guild_id:"String_comparison_exp",
discord_notifications_enabled:"Boolean_comparison_exp",
Expand Down Expand Up @@ -39097,6 +39098,7 @@ export const AllTypesProps: Record<string,any> = {
stages_aggregate:"tournament_stages_aggregate_bool_exp",
start:"timestamptz_comparison_exp",
status:"e_tournament_status_enum_comparison_exp",
substitutes_enabled:"Boolean_comparison_exp",
teams:"tournament_teams_bool_exp",
teams_aggregate:"tournament_teams_aggregate_bool_exp"
},
Expand Down Expand Up @@ -39228,6 +39230,7 @@ export const AllTypesProps: Record<string,any> = {
check_in_setting:"order_by",
check_in_started:"order_by",
created_at:"order_by",
current_stage:"order_by",
description:"order_by",
discord_guild_id:"order_by",
discord_notifications_enabled:"order_by",
Expand Down Expand Up @@ -39284,6 +39287,7 @@ export const AllTypesProps: Record<string,any> = {
stages_aggregate:"tournament_stages_aggregate_order_by",
start:"order_by",
status:"order_by",
substitutes_enabled:"order_by",
teams_aggregate:"tournament_teams_aggregate_order_by"
},
tournaments_pk_columns_input:{
Expand Down Expand Up @@ -66703,6 +66707,7 @@ export const ReturnTypes: Record<string,any> = {
check_in_setting:"e_check_in_settings_enum",
check_in_started:"Boolean",
created_at:"timestamptz",
current_stage:"Int",
description:"String",
discord_guild_id:"String",
discord_notifications_enabled:"Boolean",
Expand Down Expand Up @@ -66767,6 +66772,7 @@ export const ReturnTypes: Record<string,any> = {
stages_aggregate:"tournament_stages_aggregate",
start:"timestamptz",
status:"e_tournament_status_enum",
substitutes_enabled:"Boolean",
teams:"tournament_teams",
teams_aggregate:"tournament_teams_aggregate"
},
Expand All @@ -66790,6 +66796,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_avg_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66807,6 +66814,7 @@ export const ReturnTypes: Record<string,any> = {
check_in_ends_at:"timestamptz",
check_in_opens_before_minutes:"Int",
created_at:"timestamptz",
current_stage:"Int",
description:"String",
discord_guild_id:"String",
discord_role_id:"String",
Expand Down Expand Up @@ -66837,6 +66845,7 @@ export const ReturnTypes: Record<string,any> = {
check_in_ends_at:"timestamptz",
check_in_opens_before_minutes:"Int",
created_at:"timestamptz",
current_stage:"Int",
description:"String",
discord_guild_id:"String",
discord_role_id:"String",
Expand Down Expand Up @@ -66866,6 +66875,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_stddev_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66878,6 +66888,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_stddev_pop_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66890,6 +66901,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_stddev_samp_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66902,6 +66914,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_sum_fields:{
check_in_closes_before_minutes:"Int",
check_in_opens_before_minutes:"Int",
current_stage:"Int",
latitude:"float8",
longitude:"float8",
max_elo:"Int",
Expand All @@ -66914,6 +66927,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_var_pop_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66926,6 +66940,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_var_samp_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand All @@ -66938,6 +66953,7 @@ export const ReturnTypes: Record<string,any> = {
tournaments_variance_fields:{
check_in_closes_before_minutes:"Float",
check_in_opens_before_minutes:"Float",
current_stage:"Int",
latitude:"Float",
longitude:"Float",
max_elo:"Float",
Expand Down
2 changes: 1 addition & 1 deletion generated/zeus/const.ts

Large diffs are not rendered by default.

Loading
Loading