Add ESLint with basic rules
This commit is contained in:
parent
65d68200ac
commit
0976150ebe
35
.eslintrc.json
Normal file
35
.eslintrc.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:vue/vue3-essential"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint",
|
||||||
|
"vue"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"linebreak-style": 0,
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
1397
package-lock.json
generated
1397
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,9 +20,13 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.12",
|
"@types/node": "^18.11.12",
|
||||||
"@types/tryghost__content-api": "1.3.11",
|
"@types/tryghost__content-api": "1.3.11",
|
||||||
|
"@typescript-eslint/eslint-plugin": "6.7.5",
|
||||||
|
"@typescript-eslint/parser": "6.7.5",
|
||||||
"@vicons/fluent": "0.12.0",
|
"@vicons/fluent": "0.12.0",
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
"@vue/tsconfig": "^0.1.3",
|
"@vue/tsconfig": "^0.1.3",
|
||||||
|
"eslint": "8.51.0",
|
||||||
|
"eslint-plugin-vue": "9.17.0",
|
||||||
"naive-ui": "2.34.3",
|
"naive-ui": "2.34.3",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"typescript": "~4.7.4",
|
"typescript": "~4.7.4",
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="last4-batting">
|
<tbody id="last4-batting">
|
||||||
|
<!-- eslint-disable-next-line vue/require-v-for-key -->
|
||||||
<tr v-for="gameStat in last4GamesBatting">
|
<tr v-for="gameStat in last4GamesBatting">
|
||||||
<td>{{ makeWxGyFromGame(gameStat.game) }}</td>
|
<td>{{ makeWxGyFromGame(gameStat.game) }}</td>
|
||||||
<td>{{ gameStat.pa }}</td>
|
<td>{{ gameStat.pa }}</td>
|
||||||
@ -85,7 +86,7 @@ interface MinimalAggregateFieldingStat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LastFourGamesBattingTable",
|
name: 'LastFourGamesBattingTable',
|
||||||
props: {
|
props: {
|
||||||
last4GamesBatting: { type: Array<BattingStat>, required: true },
|
last4GamesBatting: { type: Array<BattingStat>, required: true },
|
||||||
last4GamesFielding: { type: Array<FieldingStat>, required: true }
|
last4GamesFielding: { type: Array<FieldingStat>, required: true }
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="last4-pitching">
|
<tbody id="last4-pitching">
|
||||||
|
<!-- eslint-disable-next-line vue/require-v-for-key -->
|
||||||
<tr v-for="gameStat in last4GamesPitching">
|
<tr v-for="gameStat in last4GamesPitching">
|
||||||
<td>{{ makeWxGyFromGame(gameStat.game) }}</td>
|
<td>{{ makeWxGyFromGame(gameStat.game) }}</td>
|
||||||
<td>{{ gameStat.win }}</td>
|
<td>{{ gameStat.win }}</td>
|
||||||
@ -56,7 +57,7 @@ import type { PitchingStat } from '@/services/pitchingStatsService'
|
|||||||
import { outsToInnings } from '@/services/utilities'
|
import { outsToInnings } from '@/services/utilities'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LastFourGamesPitchingTable",
|
name: 'LastFourGamesPitchingTable',
|
||||||
props: {
|
props: {
|
||||||
last4GamesPitching: { type: Array<PitchingStat>, required: true }
|
last4GamesPitching: { type: Array<PitchingStat>, required: true }
|
||||||
},
|
},
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
<form class="form-inline" @submit.stop.prevent="searchPlayers">
|
<form class="form-inline" @submit.stop.prevent="searchPlayers">
|
||||||
<input type="text" name="name" placeholder="Player Search" list="player-names" v-model="searchPlayerName">
|
<input type="text" name="name" placeholder="Player Search" list="player-names" v-model="searchPlayerName">
|
||||||
<datalist id="player-names">
|
<datalist id="player-names">
|
||||||
<option v-for=" name in sortedPlayerNames " :value="name">{{ name }}</option>
|
<option v-for="name in sortedPlayerNames" :key="name" :value="name">{{ name }}</option>
|
||||||
</datalist>
|
</datalist>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -77,13 +77,16 @@ import { fetchPlayers, type Player } from '@/services/playersService'
|
|||||||
import { CURRENT_SEASON } from '@/services/utilities'
|
import { CURRENT_SEASON } from '@/services/utilities'
|
||||||
import type { Team } from '@/services/apiResponseTypes'
|
import type { Team } from '@/services/apiResponseTypes'
|
||||||
import { fetchActiveTeamByOwnerId } from '@/services/teamsService'
|
import { fetchActiveTeamByOwnerId } from '@/services/teamsService'
|
||||||
import { authenticate, clearCookie, completeAuthentication, getOwnerId, isDiscordAuthenticated, parseCookie } from '@/services/authenticationService'
|
import { authenticate, clearCookie, completeAuthentication, getOwnerId, isDiscordAuthenticated } from '@/services/authenticationService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NavBar',
|
name: 'NavBar',
|
||||||
|
components: {
|
||||||
|
RouterLink
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isAuthenticated: false as Boolean,
|
isAuthenticated: false as boolean,
|
||||||
userTeam: undefined as Team | undefined,
|
userTeam: undefined as Team | undefined,
|
||||||
players: [] as Player[],
|
players: [] as Player[],
|
||||||
searchPlayerName: undefined
|
searchPlayerName: undefined
|
||||||
@ -282,7 +285,7 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
sortedPlayerNames(): string[] {
|
sortedPlayerNames(): string[] {
|
||||||
return this.players.sort((p1, p2) => p2.wara - p1.wara).map(p => p.name)
|
return [...this.players].sort((p1, p2) => p2.wara - p1.wara).map(p => p.name)
|
||||||
},
|
},
|
||||||
ownerId(): string | undefined {
|
ownerId(): string | undefined {
|
||||||
return getOwnerId()
|
return getOwnerId()
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="row in firstHalfRows">
|
<tr v-for="row in firstHalfRows" :key="row.week">
|
||||||
<td>{{ row.week }}</td>
|
<td>{{ row.week }}</td>
|
||||||
<td>
|
<td>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="row in secondHalfRows">
|
<tr v-for="row in secondHalfRows" :key="row.week">
|
||||||
<td>{{ row.week }}</td>
|
<td>{{ row.week }}</td>
|
||||||
<td>
|
<td>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
@ -108,7 +108,7 @@ interface ScheduleRow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TeamScheduleTable",
|
name: 'TeamScheduleTable',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
schedule: [] as Game[]
|
schedule: [] as Game[]
|
||||||
|
|||||||
@ -44,21 +44,21 @@ export const routes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
function castTeamsRouteParams(route: any) {
|
function castTeamsRouteParams(route: { params: { teamAbbreviation: string, seasonNumber: string } }) {
|
||||||
return {
|
return {
|
||||||
teamAbbreviation: route.params.teamAbbreviation,
|
teamAbbreviation: route.params.teamAbbreviation,
|
||||||
seasonNumber: Number(route.params.seasonNumber)
|
seasonNumber: Number(route.params.seasonNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function castPlayersRouteParams(route: any) {
|
function castPlayersRouteParams(route: { params: { playerName: string, seasonNumber: string } }) {
|
||||||
return {
|
return {
|
||||||
playerName: route.params.playerName,
|
playerName: route.params.playerName,
|
||||||
seasonNumber: Number(route.params.seasonNumber)
|
seasonNumber: Number(route.params.seasonNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function castScheduleRouteParams(route: any) {
|
function castScheduleRouteParams(route: { params: { seasonNumber: string, weekNumber: string } }) {
|
||||||
return {
|
return {
|
||||||
seasonNumber: Number.isNaN(Number.parseInt(route.params.seasonNumber)) ? undefined : Number(route.params.seasonNumber),
|
seasonNumber: Number.isNaN(Number.parseInt(route.params.seasonNumber)) ? undefined : Number(route.params.seasonNumber),
|
||||||
weekNumber: Number.isNaN(Number.parseInt(route.params.weekNumber)) ? undefined : Number(route.params.weekNumber)
|
weekNumber: Number.isNaN(Number.parseInt(route.params.weekNumber)) ? undefined : Number(route.params.weekNumber)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
export interface Team {
|
export interface Team {
|
||||||
abbrev: string
|
abbrev: string
|
||||||
auto_draft: any
|
// auto_draft: any
|
||||||
color: string // hex code
|
color: string // hex code
|
||||||
dice_color: string // hex code
|
dice_color: string // hex code
|
||||||
division: Division
|
division: Division
|
||||||
division_legacy: any
|
// division_legacy: any
|
||||||
gmid: number
|
gmid: number
|
||||||
gmid2: number
|
gmid2: number
|
||||||
gsheet: any
|
// gsheet: any
|
||||||
id: number
|
id: number
|
||||||
lname: string
|
lname: string
|
||||||
manager1: Manager
|
manager1: Manager
|
||||||
manager2: Manager
|
manager2: Manager
|
||||||
manager_legacy: any
|
// manager_legacy: any
|
||||||
mascot: any
|
// mascot: any
|
||||||
season: number
|
season: number
|
||||||
sname: string
|
sname: string
|
||||||
stadium: string
|
stadium: string
|
||||||
|
|||||||
@ -67,5 +67,5 @@ export function saveOwnerIdCookie(ownerId: string): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function clearCookie(): void {
|
export function clearCookie(): void {
|
||||||
document.cookie = "discord=;-1;path=/"
|
document.cookie = 'discord=;-1;path=/'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,7 +137,7 @@ export async function fetchBattingStatsForLastFourGamesBySeasonAndPlayerId(seaso
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function aggregateBattingStats(battingStats: BattingStat[]): BattingStat {
|
export function aggregateBattingStats(battingStats: BattingStat[]): BattingStat {
|
||||||
let totalStat: BattingStat = {
|
const totalStat: BattingStat = {
|
||||||
player: battingStats[0].player,
|
player: battingStats[0].player,
|
||||||
team: battingStats[0].team,
|
team: battingStats[0].team,
|
||||||
game: 'TOT',
|
game: 'TOT',
|
||||||
|
|||||||
@ -28,16 +28,16 @@ interface FieldingStatRaw {
|
|||||||
player: Player
|
player: Player
|
||||||
team: Team
|
team: Team
|
||||||
pos: 'P' | 'C' | '1B' | '2B' | '3B' | 'SS' | 'LF' | 'CF' | 'RF' | 'TOT'
|
pos: 'P' | 'C' | '1B' | '2B' | '3B' | 'SS' | 'LF' | 'CF' | 'RF' | 'TOT'
|
||||||
"x-ch": number
|
'x-ch': number
|
||||||
hit: number
|
hit: number
|
||||||
error: number
|
error: number
|
||||||
"sb-ch": number
|
'sb-ch': number
|
||||||
sb: number
|
sb: number
|
||||||
cs: number
|
cs: number
|
||||||
pb: number
|
pb: number
|
||||||
wpa: number
|
wpa: number
|
||||||
"wf%": number
|
'wf%': number
|
||||||
"cs%": number | ''
|
'cs%': number | ''
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LegacyFieldingStat {
|
interface LegacyFieldingStat {
|
||||||
@ -166,7 +166,7 @@ export function aggregateFieldingStats(fieldingStats: FieldingStat[]): FieldingS
|
|||||||
export function totaledFieldingStats(fieldingStats: FieldingStat[]): FieldingStat | undefined {
|
export function totaledFieldingStats(fieldingStats: FieldingStat[]): FieldingStat | undefined {
|
||||||
if (fieldingStats.length === 0) return undefined
|
if (fieldingStats.length === 0) return undefined
|
||||||
|
|
||||||
let totalStat: FieldingStat = {
|
const totalStat: FieldingStat = {
|
||||||
game: 'TOT',
|
game: 'TOT',
|
||||||
player: fieldingStats[0].player,
|
player: fieldingStats[0].player,
|
||||||
team: fieldingStats[0].team,
|
team: fieldingStats[0].team,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { MODERN_STAT_ERA_START, SITE_URL } from './utilities'
|
|||||||
|
|
||||||
export async function fetchGamesBySeasonAndTeamId(seasonNumber: number, teamId: number): Promise<Game[]> {
|
export async function fetchGamesBySeasonAndTeamId(seasonNumber: number, teamId: number): Promise<Game[]> {
|
||||||
if (seasonNumber < MODERN_STAT_ERA_START) {
|
if (seasonNumber < MODERN_STAT_ERA_START) {
|
||||||
console.warn(`Cannot use games endpoint to fetch stats before season 8`)
|
console.warn('Cannot use games endpoint to fetch stats before season 8')
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export async function fetchGamesBySeasonAndTeamId(seasonNumber: number, teamId:
|
|||||||
|
|
||||||
export async function fetchGamesBySeasonAndWeek(seasonNumber: number, weekNumber: number): Promise<Game[]> {
|
export async function fetchGamesBySeasonAndWeek(seasonNumber: number, weekNumber: number): Promise<Game[]> {
|
||||||
if (seasonNumber < MODERN_STAT_ERA_START) {
|
if (seasonNumber < MODERN_STAT_ERA_START) {
|
||||||
console.warn(`Cannot use games endpoint to fetch stats before season 8`)
|
console.warn('Cannot use games endpoint to fetch stats before season 8')
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export async function getPosts() {
|
|||||||
const newsApi = new GhostContentAPI({
|
const newsApi = new GhostContentAPI({
|
||||||
url: 'https://sbanews.manticorum.com',
|
url: 'https://sbanews.manticorum.com',
|
||||||
key: '37abf30917ce55d6d9155b537d',
|
key: '37abf30917ce55d6d9155b537d',
|
||||||
version: "v5.0"
|
version: 'v5.0'
|
||||||
})
|
})
|
||||||
|
|
||||||
const posts: PostsOrPages = await newsApi.posts.browse({
|
const posts: PostsOrPages = await newsApi.posts.browse({
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { Game, Team } from './apiResponseTypes'
|
import type { Game, Team } from './apiResponseTypes'
|
||||||
import type { Player } from './playersService'
|
import type { Player } from './playersService'
|
||||||
import { MODERN_STAT_ERA_START, SITE_URL, avg, obp, ops, slg, woba } from './utilities'
|
import { MODERN_STAT_ERA_START, SITE_URL, avg, slg, woba } from './utilities'
|
||||||
|
|
||||||
// TODO make a stats object that has properties for current regular season, current post season,
|
// TODO make a stats object that has properties for current regular season, current post season,
|
||||||
// last 4 games, historical seasons, career totals
|
// last 4 games, historical seasons, career totals
|
||||||
@ -101,9 +101,9 @@ interface PitchingStatRaw {
|
|||||||
slg: number
|
slg: number
|
||||||
ops: number
|
ops: number
|
||||||
woba: number
|
woba: number
|
||||||
"k/9": number
|
'k/9': number
|
||||||
"bb/9": number
|
'bb/9': number
|
||||||
"k/bb": number
|
'k/bb': number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LegacyPitchingStat {
|
interface LegacyPitchingStat {
|
||||||
@ -203,7 +203,7 @@ export async function fetchPitchingStatsForLastFourGamesBySeasonAndPlayerId(seas
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function aggregatePitchingStats(pitchingStats: PitchingStat[]): PitchingStat {
|
export function aggregatePitchingStats(pitchingStats: PitchingStat[]): PitchingStat {
|
||||||
let totalStat: PitchingStat = {
|
const totalStat: PitchingStat = {
|
||||||
player: pitchingStats[0].player,
|
player: pitchingStats[0].player,
|
||||||
team: pitchingStats[0].team,
|
team: pitchingStats[0].team,
|
||||||
game: 'TOT',
|
game: 'TOT',
|
||||||
@ -254,38 +254,38 @@ export function aggregatePitchingStats(pitchingStats: PitchingStat[]): PitchingS
|
|||||||
}
|
}
|
||||||
|
|
||||||
pitchingStats.forEach(stat => {
|
pitchingStats.forEach(stat => {
|
||||||
totalStat.tbf += stat.tbf,
|
totalStat.tbf += stat.tbf
|
||||||
totalStat.outs += stat.outs,
|
totalStat.outs += stat.outs
|
||||||
totalStat.games += stat.games,
|
totalStat.games += stat.games
|
||||||
totalStat.gs += stat.gs,
|
totalStat.gs += stat.gs
|
||||||
totalStat.win += stat.win,
|
totalStat.win += stat.win
|
||||||
totalStat.loss += stat.loss,
|
totalStat.loss += stat.loss
|
||||||
totalStat.hold += stat.hold,
|
totalStat.hold += stat.hold
|
||||||
totalStat.save += stat.save,
|
totalStat.save += stat.save
|
||||||
totalStat.bsave += stat.bsave,
|
totalStat.bsave += stat.bsave
|
||||||
totalStat.ir += stat.ir,
|
totalStat.ir += stat.ir
|
||||||
totalStat.ir_sc += stat.ir_sc,
|
totalStat.ir_sc += stat.ir_sc
|
||||||
totalStat.ab += stat.ab,
|
totalStat.ab += stat.ab
|
||||||
totalStat.run += stat.run,
|
totalStat.run += stat.run
|
||||||
totalStat.e_run += stat.e_run,
|
totalStat.e_run += stat.e_run
|
||||||
totalStat.hits += stat.hits,
|
totalStat.hits += stat.hits
|
||||||
totalStat.double += stat.double,
|
totalStat.double += stat.double
|
||||||
totalStat.triple += stat.triple,
|
totalStat.triple += stat.triple
|
||||||
totalStat.hr += stat.hr,
|
totalStat.hr += stat.hr
|
||||||
totalStat.bb += stat.bb,
|
totalStat.bb += stat.bb
|
||||||
totalStat.so += stat.so,
|
totalStat.so += stat.so
|
||||||
totalStat.hbp += stat.hbp,
|
totalStat.hbp += stat.hbp
|
||||||
totalStat.sac += stat.sac,
|
totalStat.sac += stat.sac
|
||||||
totalStat.ibb += stat.ibb,
|
totalStat.ibb += stat.ibb
|
||||||
totalStat.gidp += stat.gidp,
|
totalStat.gidp += stat.gidp
|
||||||
totalStat.sb += stat.sb,
|
totalStat.sb += stat.sb
|
||||||
totalStat.cs += stat.cs,
|
totalStat.cs += stat.cs
|
||||||
totalStat.bphr += stat.bphr,
|
totalStat.bphr += stat.bphr
|
||||||
totalStat.bpfo += stat.bpfo,
|
totalStat.bpfo += stat.bpfo
|
||||||
totalStat.bp1b += stat.bp1b,
|
totalStat.bp1b += stat.bp1b
|
||||||
totalStat.bplo += stat.bplo,
|
totalStat.bplo += stat.bplo
|
||||||
totalStat.wp += stat.wp,
|
totalStat.wp += stat.wp
|
||||||
totalStat.balk += stat.balk,
|
totalStat.balk += stat.balk
|
||||||
totalStat.wpa += stat.wpa
|
totalStat.wpa += stat.wpa
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -410,9 +410,9 @@ function normalizePitchingStat(rawStat: PitchingStatRaw): PitchingStat {
|
|||||||
slg: rawStat.slg,
|
slg: rawStat.slg,
|
||||||
ops: rawStat.ops,
|
ops: rawStat.ops,
|
||||||
woba: rawStat.woba,
|
woba: rawStat.woba,
|
||||||
kPer9: rawStat["k/9"],
|
kPer9: rawStat['k/9'],
|
||||||
bbPer9: rawStat["bb/9"],
|
bbPer9: rawStat['bb/9'],
|
||||||
kPerBB: rawStat["k/bb"]
|
kPerBB: rawStat['k/bb']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,9 +4,9 @@ import { SITE_URL } from './utilities'
|
|||||||
export interface Player {
|
export interface Player {
|
||||||
bbref_id: string
|
bbref_id: string
|
||||||
demotion_week: number
|
demotion_week: number
|
||||||
headshot: any
|
headshot: string //url
|
||||||
id: number
|
id: number
|
||||||
il_return: any
|
il_return: string
|
||||||
image: string
|
image: string
|
||||||
image2: string
|
image2: string
|
||||||
injury_rating: string //could strongly type as XpYY
|
injury_rating: string //could strongly type as XpYY
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import { CURRENT_SEASON } from '@/services/utilities'
|
|||||||
import { getPosts, type NewsPost } from '@/services/newsService'
|
import { getPosts, type NewsPost } from '@/services/newsService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "HomeView",
|
name: 'HomeView',
|
||||||
components: {
|
components: {
|
||||||
StandingsTable,
|
StandingsTable,
|
||||||
NewsPreview
|
NewsPreview
|
||||||
|
|||||||
@ -107,7 +107,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ManagerView",
|
name: 'ManagerView',
|
||||||
props: {
|
props: {
|
||||||
managerName: { type: String, required: true },
|
managerName: { type: String, required: true },
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="transactions-table">
|
<tbody id="transactions-table">
|
||||||
<tr v-for="transaction in transactions">
|
<tr v-for="transaction in transactions" :key="transaction.id">
|
||||||
<td>{{ transaction.season }}</td>
|
<td>{{ transaction.season }}</td>
|
||||||
<td>{{ transaction.week }}</td>
|
<td>{{ transaction.week }}</td>
|
||||||
<td>{{ transaction.player.name }}</td>
|
<td>{{ transaction.player.name }}</td>
|
||||||
@ -125,7 +125,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="team-awards">
|
<tbody id="team-awards">
|
||||||
<tr v-for="award in awards">
|
<tr v-for="award in awards" :key="award.id">
|
||||||
<td>{{ award.season }}</td>
|
<td>{{ award.season }}</td>
|
||||||
<td>{{ award.name }}</td>
|
<td>{{ award.name }}</td>
|
||||||
<td>{{ award.player?.name }}</td>
|
<td>{{ award.player?.name }}</td>
|
||||||
@ -164,7 +164,7 @@ import { fetchTransactionsForCurrentSeasonByPlayerName, type Transaction } from
|
|||||||
import { fetchAwardsByPlayerName, type Award } from '@/services/awardsService'
|
import { fetchAwardsByPlayerName, type Award } from '@/services/awardsService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PlayerView",
|
name: 'PlayerView',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isAuthenticated: false,
|
isAuthenticated: false,
|
||||||
|
|||||||
@ -26,6 +26,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "RulesView",
|
name: 'RulesView',
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
<!-- eslint-disable indent -->
|
||||||
<template>
|
<template>
|
||||||
<div class="schedule-view">
|
<div class="schedule-view">
|
||||||
|
|
||||||
@ -13,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- Matchups -->
|
<!-- Matchups -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div v-for="matchup in gamesGroupedByMatchup" class="col-sm-auto">
|
<div v-for="(matchup, index) in gamesGroupedByMatchup" :key="index" class="col-sm-auto">
|
||||||
<div class="table-responsive-sm" style="text-align: center">
|
<div class="table-responsive-sm" style="text-align: center">
|
||||||
<table class="table table-sm table-striped">
|
<table class="table table-sm table-striped">
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
@ -24,7 +25,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="matchup-1">
|
<tbody id="matchup-1">
|
||||||
<tr v-for="game in matchup">
|
<tr v-for="game in matchup" :key="game.id">
|
||||||
<td>
|
<td>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="{ name: 'team', params: { seasonNumber: seasonNumber, teamAbbreviation: game.away_team.abbrev } }">
|
:to="{ name: 'team', params: { seasonNumber: seasonNumber, teamAbbreviation: game.away_team.abbrev } }">
|
||||||
@ -80,7 +81,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="weekNumber in 21">
|
<tr v-for="weekNumber in 21" :key="weekNumber">
|
||||||
<td>
|
<td>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
:to="{ name: 'schedule', params: { seasonNumber: seasonNumber, weekNumber: weekNumber } }">
|
:to="{ name: 'schedule', params: { seasonNumber: seasonNumber, weekNumber: weekNumber } }">
|
||||||
@ -133,7 +134,7 @@ dayjs.extend(customParseFormat)
|
|||||||
const SEASON_START_DATE: dayjs.Dayjs = dayjs('07-31-2023', 'MM/DD/YYYY')
|
const SEASON_START_DATE: dayjs.Dayjs = dayjs('07-31-2023', 'MM/DD/YYYY')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ScheduleView",
|
name: 'ScheduleView',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentWeekNumber: 0,
|
currentWeekNumber: 0,
|
||||||
@ -204,27 +205,17 @@ export default {
|
|||||||
return SEASON_START_DATE.add((weekNumber * 7) - 1, 'd').format('MM/DD/YYYY')
|
return SEASON_START_DATE.add((weekNumber * 7) - 1, 'd').format('MM/DD/YYYY')
|
||||||
},
|
},
|
||||||
weekSpecialInfo(weekNumber: number): string {
|
weekSpecialInfo(weekNumber: number): string {
|
||||||
switch (weekNumber) {
|
if (weekNumber === 1) return 'Spring Begins'
|
||||||
case 1:
|
if (weekNumber === 6) return 'Summer Begins'
|
||||||
return 'Spring Begins'
|
if (weekNumber === 14) return 'Trade Deadline'
|
||||||
case 6:
|
if (weekNumber === 15) return 'Fall Begins'
|
||||||
return 'Summer Begins'
|
if (weekNumber === 18) return 'Regular Season Ends'
|
||||||
case 14:
|
if (weekNumber === 19) return 'Division Series - Best of 5'
|
||||||
return 'Trade Deadline'
|
if (weekNumber === 20) return 'League Championship Series - Best of 7'
|
||||||
case 15:
|
if (weekNumber === 21) return 'World Series Best of 7'
|
||||||
return 'Fall Begins'
|
|
||||||
case 18:
|
|
||||||
return 'Regular Season Ends'
|
|
||||||
case 19:
|
|
||||||
return 'Division Series - Best of 5'
|
|
||||||
case 20:
|
|
||||||
return 'League Championship Series - Best of 7'
|
|
||||||
case 21:
|
|
||||||
return 'World Series Best of 7'
|
|
||||||
default:
|
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
@ -51,7 +51,10 @@ import { fetchCurrentLeagueInfo, type LeagueInfo } from '@/services/currentServi
|
|||||||
import { CURRENT_SEASON } from '@/services/utilities'
|
import { CURRENT_SEASON } from '@/services/utilities'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StandingsView",
|
name: 'StandingsView',
|
||||||
|
components: {
|
||||||
|
StandingsTable
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
seasonNumber: CURRENT_SEASON as number,
|
seasonNumber: CURRENT_SEASON as number,
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="active-roster">
|
<tbody id="active-roster">
|
||||||
<tr v-for="player in sortedPlayers(players)">
|
<tr v-for="player in sortedPlayers(players)" :key="player.id">
|
||||||
<td>{{ player.pos_1 }}</td>
|
<td>{{ player.pos_1 }}</td>
|
||||||
<td :title="player.il_return ? `Injured until ${player.il_return}` : ''">
|
<td :title="player.il_return ? `Injured until ${player.il_return}` : ''">
|
||||||
{{ player.il_return ? '🏥' : '' }}
|
{{ player.il_return ? '🏥' : '' }}
|
||||||
@ -89,7 +89,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="minors-roster">
|
<tbody id="minors-roster">
|
||||||
<tr v-for="player in sortedPlayers(playersMinors)">
|
<tr v-for="player in sortedPlayers(playersMinors)" :key="player.id">
|
||||||
<td>{{ player.pos_1 }}</td>
|
<td>{{ player.pos_1 }}</td>
|
||||||
<td>
|
<td>
|
||||||
<RouterLink :to="{ name: 'player', params: { seasonNumber: seasonNumber, playerName: player.name } }">
|
<RouterLink :to="{ name: 'player', params: { seasonNumber: seasonNumber, playerName: player.name } }">
|
||||||
@ -116,7 +116,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="short-il-roster">
|
<tbody id="short-il-roster">
|
||||||
<tr v-for="player in sortedPlayers(playersInjuredList)">
|
<tr v-for="player in sortedPlayers(playersInjuredList)" :key="player.id">
|
||||||
<td>{{ player.pos_1 }}</td>
|
<td>{{ player.pos_1 }}</td>
|
||||||
<td>
|
<td>
|
||||||
<RouterLink :to="{ name: 'player', params: { seasonNumber: seasonNumber, playerName: player.name } }">
|
<RouterLink :to="{ name: 'player', params: { seasonNumber: seasonNumber, playerName: player.name } }">
|
||||||
@ -144,7 +144,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="transactions-body"></tbody>
|
<tbody id="transactions-body"></tbody>
|
||||||
<tr v-for="row in transactionRows">
|
<tr v-for="row in transactionRows" :key="row.week">
|
||||||
<td>{{ row.week }}</td>
|
<td>{{ row.week }}</td>
|
||||||
<td>{{ row.playerName }}</td>
|
<td>{{ row.playerName }}</td>
|
||||||
<td>{{ row.oldTeam }}</td>
|
<td>{{ row.oldTeam }}</td>
|
||||||
@ -193,7 +193,7 @@ import TeamBattingTable from '@/components/TeamBattingTable.vue'
|
|||||||
import TeamFieldingTable from '@/components/TeamFieldingTable.vue'
|
import TeamFieldingTable from '@/components/TeamFieldingTable.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TeamView",
|
name: 'TeamView',
|
||||||
components: {
|
components: {
|
||||||
TeamScheduleTable,
|
TeamScheduleTable,
|
||||||
TeamPitchingTable,
|
TeamPitchingTable,
|
||||||
@ -309,7 +309,7 @@ export default {
|
|||||||
allPositions(player: Player): string {
|
allPositions(player: Player): string {
|
||||||
let positions = []
|
let positions = []
|
||||||
positions.push(player.pos_1, player.pos_2, player.pos_3, player.pos_4, player.pos_5, player.pos_6, player.pos_7)
|
positions.push(player.pos_1, player.pos_2, player.pos_3, player.pos_4, player.pos_5, player.pos_6, player.pos_7)
|
||||||
return positions.join(" ")
|
return positions.join(' ')
|
||||||
},
|
},
|
||||||
swarTotal(players: Player[]): number {
|
swarTotal(players: Player[]): number {
|
||||||
return players.map(p => p.wara).reduce((prev, curr) => prev + curr, 0)
|
return players.map(p => p.wara).reduce((prev, curr) => prev + curr, 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user