Only show transactions and bullpen on team page if viewing current season team

This commit is contained in:
Peter 2024-11-09 12:34:09 -06:00
parent a8f6fdd255
commit 5fa26726ff

View File

@ -131,31 +131,38 @@
</table>
</div>
<h3 id="transactions-header">Week {{ transactionsWeekNumber }} Transactions ({{ transactionsWar.toFixed(2) }})
</h3>
<div class="table-responsive-xl">
<table class="table table-sm table-striped" id="table-transactions">
<thead class="thead-dark">
<tr>
<th>Week</th>
<th>Player</th>
<th>Old Team</th>
<th>New Team</th>
<template v-if="currentSeasonNumber === seasonNumber">
<h3 id="transactions-header">Week {{ transactionsWeekNumber }} Transactions ({{ transactionsWar.toFixed(2) }})
</h3>
<div class="table-responsive-xl">
<table class="table table-sm table-striped" id="table-transactions">
<thead class="thead-dark">
<tr>
<th>Week</th>
<th>Player</th>
<th>Old Team</th>
<th>New Team</th>
</tr>
</thead>
<tbody id="transactions-body"></tbody>
<tr v-for="row in transactionRows" :key="row.week">
<td>{{ row.week }}</td>
<td>{{ row.playerName }}</td>
<td>{{ row.oldTeam }}</td>
<td>{{ row.newTeam }}</td>
</tr>
</thead>
<tbody id="transactions-body"></tbody>
<tr v-for="row in transactionRows" :key="row.week">
<td>{{ row.week }}</td>
<td>{{ row.playerName }}</td>
<td>{{ row.oldTeam }}</td>
<td>{{ row.newTeam }}</td>
</tr>
</table>
</div>
</table>
</div>
</template>
</div>
</div>
<BullpenTable v-if="weekNumber && team?.id" :season-number="seasonNumber" :week-number="weekNumber" :team-id="team.id" />
<BullpenTable
v-if="currentSeasonNumber === seasonNumber && weekNumber && team?.id"
:season-number="seasonNumber"
:week-number="weekNumber"
:team-id="team.id"
/>
<!-- Schedule -->
<TeamScheduleTable v-if="!isFreeAgentTeam && team" :season-number="seasonNumber" :team-id="team.id" />
@ -184,7 +191,7 @@
<script lang="ts">
import type { Team } from '@/services/apiResponseTypes'
import { fetchCurrentLeagueInfo } from '@/services/currentService'
import { fetchCurrentLeagueInfo, type LeagueInfo } from '@/services/currentService'
import { fetchPlayersByTeam, type Player } from '@/services/playersService'
import { fetchStandings, type TeamStanding } from '@/services/standingsService'
import { fetchTeam } from '@/services/teamsService'
@ -214,7 +221,8 @@ export default {
playersMinors: [] as Player[],
playersInjuredList: [] as Player[],
transactions: [] as Transaction[],
weekNumber: undefined as number | undefined
weekNumber: undefined as number | undefined,
currentSeasonNumber: undefined as number | undefined
}
},
props: {
@ -300,7 +308,9 @@ export default {
}
this.teamStanding = (await fetchStandings(this.seasonNumber)).find(ts => ts.teamName === this.team?.sname)
this.weekNumber = (await fetchCurrentLeagueInfo()).week
const leagueInfo: LeagueInfo = await fetchCurrentLeagueInfo()
this.currentSeasonNumber = leagueInfo.season
this.weekNumber = leagueInfo.week
this.players = await fetchPlayersByTeam(this.seasonNumber, this.team?.id)
if (!this.isFreeAgentTeam) {