182 lines
6.8 KiB
HTML
182 lines
6.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: frontend/src/components/pages/DraftBoard.component.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: frontend/src/components/pages/DraftBoard.component.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>import {Component} from '../../../lib/vues6.js'
|
|
import {fake_players} from '../../module/fake_data.js'
|
|
import {GridCellRenderType} from '../Grid.component.js'
|
|
import {api} from '../../module/api.js'
|
|
import {clone} from '../../module/util.js'
|
|
|
|
const template = `
|
|
<div class="page-draft-board">
|
|
<div class="header">
|
|
<div class="left">
|
|
<h2>Draft Board</h2>
|
|
</div>
|
|
</div>
|
|
<div class="body" style="display: flex; flex-direction: row">
|
|
<div class="picks" style="margin-right: 20px;">
|
|
<app-grid
|
|
:column_defs="top_picks_column_defs"
|
|
:data="top_picks"
|
|
:show_row_numbers="true"
|
|
></app-grid>
|
|
</div>
|
|
<app-grid
|
|
style="flex: 1"
|
|
:column_defs="column_defs"
|
|
:data="data"
|
|
:show_row_numbers="false"
|
|
></app-grid>
|
|
</div>
|
|
</div>
|
|
`
|
|
|
|
/**
|
|
* Component representing the draft board page.
|
|
* @extends Component
|
|
*/
|
|
class DraftBoardComponent extends Component {
|
|
static get selector() { return 'page-draft-board' }
|
|
static get template() { return template }
|
|
static get props() { return [] }
|
|
|
|
top_picks_column_defs = [
|
|
{
|
|
header: 'Player',
|
|
key: 'name',
|
|
type: GridCellRenderType.HTML,
|
|
renderer: (_, data) => `
|
|
<div class="center">
|
|
<img src="${data.image}" alt="${data.name}" height="50" style="border-radius: 50%">
|
|
<span>${data.name} (#${data.number})</span>
|
|
</div>
|
|
`,
|
|
}
|
|
]
|
|
|
|
top_picks = []
|
|
|
|
column_defs = [
|
|
{
|
|
header: 'Name',
|
|
key: 'name',
|
|
type: GridCellRenderType.HTML,
|
|
renderer: (_, data) => `
|
|
<div class="center">
|
|
<img src="${data.image}" alt="${data.name}" height="50" style="border-radius: 50%">
|
|
<span>${data.name} (#${data.number})</span>
|
|
</div>
|
|
`,
|
|
},
|
|
{
|
|
header: 'Team',
|
|
key: 'team_name',
|
|
},
|
|
{
|
|
header: 'Position',
|
|
key: 'position',
|
|
},
|
|
{
|
|
header: 'Points',
|
|
key: 'points',
|
|
},
|
|
{
|
|
header: 'Stats',
|
|
key: 'stats',
|
|
type: GridCellRenderType.HTML,
|
|
renderer: (value, row) => {
|
|
const stats = []
|
|
for ( const stat in value ) {
|
|
if ( !value.hasOwnProperty(stat) ) continue; // Prototypical member
|
|
|
|
stats.push(`
|
|
<div class="stat">
|
|
<div class="title">${stat}</div>
|
|
<div>${value[stat]}</div>
|
|
</div>
|
|
`)
|
|
}
|
|
|
|
return `
|
|
<div class="stats">
|
|
${stats.join('\n')}
|
|
</div>
|
|
`
|
|
},
|
|
},
|
|
{
|
|
header: '',
|
|
key: 'stats',
|
|
type: GridCellRenderType.Component,
|
|
component: Vue.component('app-action-button'),
|
|
button_color: (row, col) => '#CC5746',
|
|
button_text: (row, col) => 'Draft',
|
|
button_hidden: (row, col) => this.top_picks.includes(row),
|
|
on_click: (row, col) => {
|
|
this.top_picks.push(row);
|
|
api.draft_player(row.id).then(() => {
|
|
|
|
});
|
|
},
|
|
},
|
|
]
|
|
|
|
data = []
|
|
|
|
async vue_on_create() {
|
|
this.top_picks = await api.get_my_team_players()
|
|
this.data = await api.get_available_draft_players()
|
|
}
|
|
}
|
|
|
|
export default DraftBoardComponent
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-fake_data.html">fake_data</a></li><li><a href="module-routing.html">routing</a></li><li><a href="module-util.html">util</a></li></ul><h3>Classes</h3><ul><li><a href="ActiveScope.html">ActiveScope</a></li><li><a href="AddPlayersComponent.html">AddPlayersComponent</a></li><li><a href="DraftBoard.html">DraftBoard</a></li><li><a href="DraftBoardComponent.html">DraftBoardComponent</a></li><li><a href="FrontendUnit.html">FrontendUnit</a></li><li><a href="GenerateMatchupsForWeekPatch.html">GenerateMatchupsForWeekPatch</a></li><li><a href="GenerateWeeklyResultsPatch.html">GenerateWeeklyResultsPatch</a></li><li><a href="GridActionButtonComponent.html">GridActionButtonComponent</a></li><li><a href="GridComponent.html">GridComponent</a></li><li><a href="Home.html">Home</a></li><li><a href="InjectUserTeam.html">InjectUserTeam</a></li><li><a href="LeagueComponent.html">LeagueComponent</a></li><li><a href="Lineup.html">Lineup</a></li><li><a href="LinkComponent.html">LinkComponent</a></li><li><a href="Matchup.html">Matchup</a></li><li><a href="module-routing-Router.html">Router</a></li><li><a href="MyTeamComponent.html">MyTeamComponent</a></li><li><a href="Player.html">Player</a></li><li><a href="ScoresComponent.html">ScoresComponent</a></li><li><a href="ScoresController.html">ScoresController</a></li><li><a href="SeedAPIDataPatch.html">SeedAPIDataPatch</a></li><li><a href="SeedWeeklyPlayerDataPatch.html">SeedWeeklyPlayerDataPatch</a></li><li><a href="SportsDataService.html">SportsDataService</a></li><li><a href="Team.html">Team</a></li><li><a href="Teams.html">Teams</a></li><li><a href="TopLevelComponent.html">TopLevelComponent</a></li><li><a href="User.html">User</a></li><li><a href="WeeklyPlayerStat.html">WeeklyPlayerStat</a></li><li><a href="WeeklyTeamStat.html">WeeklyTeamStat</a></li></ul><h3>Global</h3><ul><li><a href="global.html#GridCellRenderType">GridCellRenderType</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Sun Nov 08 2020 14:34:32 GMT-0600 (Central Standard Time)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|