import {Component} from '../../../lib/vues6.js' import {GridCellRenderType} from '../Grid.component.js' import {api} from '../../module/api.js' const template = `

League Standings

` /** * Component representing the league standings page. * @extends Component */ class LeagueComponent extends Component { static get selector() { return 'page-league' } static get template() { return template } static get props() { return [] } GridCellRenderType = GridCellRenderType /** * Column definitions for the league standings grid. * @type {object[]} */ column_defs = [ { header: 'Standing', type: GridCellRenderType.HTML, key: 'standing', renderer: (value, row) => { return `

Rank: ${row.standing.rank}

W/L: ${row.standing.win_loss}

` } }, { header: 'Team', type: GridCellRenderType.HTML, key: 'team_name', renderer: (value, row) => { return `
${row.team_name}
` }, }, { header: 'Stats', key: 'stats', type: GridCellRenderType.HTML, renderer: (value, row) => { const stats = [] for ( const stat of value ) { stats.push(`
${stat.name}
${stat.value}
`) } return `
${stats.join('\n')}
` }, }, ] /** * Sample data for the league standings grid. * @type {object[]} */ data = [] /** * Called when the component is instantiated. * @return {Promise} */ async vue_on_create() { this.data = await api.get_standings() } } export default LeagueComponent