master
parent
2fa39cb3e9
commit
035663f1bb
@ -0,0 +1,60 @@
|
|||||||
|
let games = {//Games MODEL
|
||||||
|
|
||||||
|
"winCon":"winCondition",
|
||||||
|
"played":"boolean",
|
||||||
|
"playerA":
|
||||||
|
{
|
||||||
|
"_id":"id",
|
||||||
|
"champ":"champName",
|
||||||
|
"champSkin":"champskin",
|
||||||
|
"rank":"playerRank",
|
||||||
|
"winner":"boolean",
|
||||||
|
"summoners":
|
||||||
|
{
|
||||||
|
"s1":"spellName",
|
||||||
|
"s2":"spellName"
|
||||||
|
},
|
||||||
|
"runes":{},//Runes
|
||||||
|
"score":"",
|
||||||
|
"creepScore":""
|
||||||
|
},
|
||||||
|
"playerB":
|
||||||
|
{
|
||||||
|
"_id": "id",
|
||||||
|
"champ": "champName",
|
||||||
|
"champSkin": "champskin",
|
||||||
|
"rank": "playerRank",
|
||||||
|
"winner": "boolean",
|
||||||
|
"summoners":
|
||||||
|
{
|
||||||
|
"s1": "spellName",
|
||||||
|
"s2": "spellName"
|
||||||
|
},
|
||||||
|
"runes": {}, //Runes
|
||||||
|
"score": "",
|
||||||
|
"creepScore":""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mongoose = require('mongoose');
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
let Game =
|
||||||
|
new Schema(
|
||||||
|
{
|
||||||
|
winCon: {type: String, required: false, max: 100},
|
||||||
|
played: {type:Boolean, required: true,},
|
||||||
|
playerA: {type:Object, required:true},
|
||||||
|
playerA: {type:Object, required:true},
|
||||||
|
playerB: {type:Object, required:true}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const G= module.exports = mongoose.model('user', Game);
|
||||||
|
module.exports.get = (callback, limit)=>
|
||||||
|
{
|
||||||
|
G.find(callback).limit(limit);
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
let leaguesModel = {//Leagues[0]
|
||||||
|
"name":"Legendary",
|
||||||
|
"players":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name":"String",
|
||||||
|
"points":10,
|
||||||
|
"playedMatches":10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"String",
|
||||||
|
"points":10,
|
||||||
|
"playedMatches":10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"games":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"_id":"String"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "String"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const mongoose = require('mongoose');
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
let League =
|
||||||
|
new Schema(
|
||||||
|
{
|
||||||
|
name: {type: String, required: false, max: 100},
|
||||||
|
players: {type:Array, required: true,},
|
||||||
|
games: {type:Array, required:true}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const L = module.exports = mongoose.model('user', League);
|
||||||
|
module.exports.get = (callback, limit)=>
|
||||||
|
{
|
||||||
|
L.find(callback).limit(limit);
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
import './LeagueTable.css'
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LeagueTable extends React.Component
|
||||||
|
{
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
super()
|
||||||
|
// this.league = this.props.league;
|
||||||
|
this.league = {//Leagues[0]
|
||||||
|
"name":"Legendary League",
|
||||||
|
"players":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name":"hc12",
|
||||||
|
"points":10,
|
||||||
|
"playedMatches":10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"DashPT5",
|
||||||
|
"points":10,
|
||||||
|
"playedMatches":10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"games":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"_id":"String"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "String"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableHeaders()
|
||||||
|
{
|
||||||
|
return(
|
||||||
|
<tr>
|
||||||
|
<th>Player</th>
|
||||||
|
<th>Points</th>
|
||||||
|
<th>Played Matches</th>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
rows()
|
||||||
|
{
|
||||||
|
return this.league.players.map(({ name, points, playedMatches }) => {
|
||||||
|
return <tr key={name} >
|
||||||
|
<td>{name}</td>
|
||||||
|
<td>{points}</td>
|
||||||
|
<td>{playedMatches}</td>
|
||||||
|
</tr>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
render()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<div className='tableContainer' >
|
||||||
|
<h3>{this.league.name}</h3>
|
||||||
|
<table>
|
||||||
|
{this.tableHeaders()}
|
||||||
|
<tbody>
|
||||||
|
{this.rows()}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default LeagueTable
|
@ -1,14 +1,18 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Table from '../Components/LeagueTable'
|
||||||
|
function getLeague()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
function Leagues() {
|
function Leagues() {
|
||||||
return (
|
return (
|
||||||
<div style={{color:'red'}}>
|
<div>
|
||||||
<br></br>
|
<br></br>
|
||||||
<br></br>
|
<br></br>
|
||||||
<br></br>
|
<br></br>
|
||||||
<br></br>
|
<br></br>
|
||||||
FODA-Se
|
<Table league={getLeague}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in new issue