diff --git a/components.d.ts b/components.d.ts index a248be0..12df73b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -9,6 +9,7 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { + CardImagesDisplay: typeof import('./src/components/CardImagesDisplay.vue')['default'] IconCommunity: typeof import('./src/components/icons/IconCommunity.vue')['default'] IconDocumentation: typeof import('./src/components/icons/IconDocumentation.vue')['default'] IconEcosystem: typeof import('./src/components/icons/IconEcosystem.vue')['default'] diff --git a/src/components/CardImagesDisplay.vue b/src/components/CardImagesDisplay.vue new file mode 100644 index 0000000..1bbb806 --- /dev/null +++ b/src/components/CardImagesDisplay.vue @@ -0,0 +1,125 @@ + + + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 5f3577c..0ed039e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,11 @@ import './assets/oldSite.css' const app = createApp(App as any) +app.directive('visible', function (el, binding) { + // eslint-disable-next-line no-extra-boolean-cast + el.style.visibility = !!binding?.value ? 'visible' : 'hidden' +}) + app.use(router) app.mount('#app') diff --git a/src/views/GameView.vue b/src/views/GameView.vue index 7cfb07b..3aedc66 100644 --- a/src/views/GameView.vue +++ b/src/views/GameView.vue @@ -15,6 +15,9 @@

Season {{ seasonNumber }} - Week {{ weekNumber }} - Game {{ gameNumber }}

+

+ +

b.xCheckCount - a.xCheckCount) + }, + sheetsUrl(): string | undefined { + return this.game?.scorecard_url } }, created() { diff --git a/src/views/PlayerView.vue b/src/views/PlayerView.vue index 8ad1a3c..9a7a5a8 100644 --- a/src/views/PlayerView.vue +++ b/src/views/PlayerView.vue @@ -5,10 +5,10 @@

{{ playerName }}{{ injuryReturnDate }}

-

{{ player?.wara }} sWAR

+

{{ player?.wara }} sWAR

-
+
-
+ -
+

Summary

@@ -158,6 +175,7 @@ import PlayerCareerPitchingTable from '@/components/PlayerCareerPitchingTable.vu import PlayerCareerFieldingTable from '@/components/PlayerCareerFieldingTable.vue' import PlayerBattingSummaryTable from '@/components/PlayerBattingSummaryTable.vue' import PlayerPitchingSummaryTable from '@/components/PlayerPitchingSummaryTable.vue' +import CardImagesDisplay from '@/components/CardImagesDisplay.vue' import { fetchPitchingStatsBySeasonAndPlayerId, fetchPitchingStatsForLastFourGamesBySeasonAndPlayerId, type PitchingStat } from '@/services/pitchingStatsService' import { fetchFieldingStatsBySeasonAndPlayerId, fetchFieldingStatsForLastFourGamesBySeasonAndPlayerId, type FieldingStat } from '@/services/fieldingStatsService' import { fetchTransactionsForCurrentSeasonByPlayerName, type Transaction } from '@/services/transactionsService' @@ -169,6 +187,7 @@ export default { return { isAuthenticated: false, player: undefined as Player | undefined, + playerSeasons: [] as Player[], last2Decisions: [] as Decision[], // Batting stats regularSeasonBattingStats: [] as BattingStat[], @@ -198,19 +217,14 @@ export default { PlayerPitchingSummaryTable, PlayerCareerPitchingTable, LastFourGamesPitchingTable, - PlayerCareerFieldingTable + PlayerCareerFieldingTable, + CardImagesDisplay }, props: { seasonNumber: { type: Number, required: true }, playerName: { type: String, required: true } }, computed: { - playerSeasonNumber(): number | undefined { - return this.player?.season - }, - isCurrentPlayer(): boolean { - return this.seasonNumber === this.playerSeasonNumber - }, isBatter(): boolean { return !this.player?.pos_1.includes('P') }, @@ -313,13 +327,16 @@ export default { // TODO: this should change, either with an api that can take a player name for every season, a way // to get multiple seasons stats at once, or a players ids across all seasons at once - const playerSeasons = await Promise.all(Array.from(Array(CURRENT_SEASON), (element, index) => index + 1).map(seasonNumber => fetchPlayerByName(seasonNumber, this.player!.name))) - this.regularSeasonBattingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchBattingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).filter(isNotUndefined) - this.postSeasonBattingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchBattingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).filter(isNotUndefined) - this.regularSeasonPitchingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchPitchingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).filter(isNotUndefined) - this.postSeasonPitchingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchPitchingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).filter(isNotUndefined) - this.regularSeasonFieldingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchFieldingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).flatMap(stat => stat).filter(isNotUndefined) - this.postSeasonFieldingStats = (await Promise.all(playerSeasons.filter(isNotUndefined).map(player => fetchFieldingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).flatMap(stat => stat).filter(isNotUndefined) + this.playerSeasons = (await Promise.all(Array.from(Array(CURRENT_SEASON), (element, index) => index + 1).map(seasonNumber => fetchPlayerByName(seasonNumber, this.player!.name)))).filter(isNotUndefined) + this.regularSeasonBattingStats = (await Promise.all(this.playerSeasons.map(player => fetchBattingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).filter(isNotUndefined) + this.postSeasonBattingStats = (await Promise.all(this.playerSeasons.map(player => fetchBattingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).filter(isNotUndefined) + this.regularSeasonPitchingStats = (await Promise.all(this.playerSeasons.map(player => fetchPitchingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).filter(isNotUndefined) + this.postSeasonPitchingStats = (await Promise.all(this.playerSeasons.map(player => fetchPitchingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).filter(isNotUndefined) + this.regularSeasonFieldingStats = (await Promise.all(this.playerSeasons.map(player => fetchFieldingStatsBySeasonAndPlayerId(player!.season, player!.id, true)))).flatMap(stat => stat).filter(isNotUndefined) + this.postSeasonFieldingStats = (await Promise.all(this.playerSeasons.map(player => fetchFieldingStatsBySeasonAndPlayerId(player!.season, player!.id, false)))).flatMap(stat => stat).filter(isNotUndefined) + + // const images = playerSeasons.map(ps => ps.) + // console.log(images.length, Array.from(new Set(images)).length, images, Array.from(new Set(images))) this.transactions = await fetchTransactionsForCurrentSeasonByPlayerName(this.player.name) this.awards = await fetchAwardsByPlayerName(this.player.name)