Cristiano Pires 2 years ago
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,13 +1,12 @@
import React from 'react'; import React from 'react';
import './Login.css'; import './Login.css';
//TODO: Show password toggle.
class Login extends React.Component class Login extends React.Component
{ {
constructor() constructor()
{ {
super(); super();
this.isPWValid = false;
this.receive(); this.receive();
} }
validateConstraints(event) validateConstraints(event)
@ -43,12 +42,6 @@ class Login extends React.Component
{ {
document.getElementsByClassName('emailInput')[0].setCustomValidity('Email does not match normal parameters.'); document.getElementsByClassName('emailInput')[0].setCustomValidity('Email does not match normal parameters.');
} }
handleKeyDown(event)
{
if (event.keyCode === 13 ) {
event.preventDefault();
}
}
receive() receive()
{ {
window.ipcRender.receive('login', data=> window.ipcRender.receive('login', data=>
@ -64,7 +57,7 @@ class Login extends React.Component
<div className='container'> <div className='container'>
<form id='form' className='loginForm'> <form id='form' className='loginForm'>
<label><span>Email</span></label> <label><span>Email</span></label>
<input required className='emailInput' type="email" placeholder=" " onKeyDown={this.handleKeyDown} onInvalid={this.emailValidity}></input> <input required className='emailInput' type="email" placeholder=" " onInvalid={this.emailValidity}></input>
<label><span>Password</span></label> <label><span>Password</span></label>
<input required className='password' type="password" onKeyDown={this.handleKeyDown} autoComplete="current-password" ></input> <input required className='password' type="password" onKeyDown={this.handleKeyDown} autoComplete="current-password" ></input>
<button className='bt Login' onClick={this.validateConstraints}>Login</button> <button className='bt Login' onClick={this.validateConstraints}>Login</button>

@ -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…
Cancel
Save