Commit 28b56ccb authored by Viktor Velev's avatar Viktor Velev

Added lol

parent 3905da53
......@@ -15,7 +15,7 @@ function init(){
var inst;
var address = "0x732eb7a0d2f09fc1d6eb8779b44e32d61bd44e8f";
var address = "0x0eec9ce09a5ac6d886892f6fb76f05937dfada90";
var acc;
//temp fix:
......
......@@ -57,4 +57,10 @@
margin-top: 20% !important;
text-align: center !important;
width: 100% !important;
}
.titles {
border: 0 !important;
border-bottom: 2px solid rgb(88, 204, 88) !important;
width: 100% !important;
}
\ No newline at end of file
......@@ -107,12 +107,10 @@ export default class AdminPage extends Component {
}
return acceptedFiles.length || rejectedFiles.length
? `Accepted ${acceptedFiles.length}, rejected ${rejectedFiles.length} files`
? <p class="xml"> Accepted {acceptedFiles.length}, rejected {rejectedFiles.length} files </p>
: <p class="xml"> Drop your XML </p>;
}}
</Dropzone>
{this.state.xml}
{this.state.json}
</Dropzone>
</div>
)
}
......
import React, { Component } from "react";
import { Input, Button, Container, Menu, Image, Dropdown, Header, Segment } from "semantic-ui-react"
import {xml2json} from 'xml-js'
export default class BetPage extends Component {
......@@ -80,7 +80,6 @@ export default class BetPage extends Component {
// odds
// user
// number
console.log(raw)
let bet = {
id: raw[0].toFixed(),
amount: raw[1].toFixed(),
......@@ -147,6 +146,15 @@ export default class BetPage extends Component {
availableBets.forEach((bet) => {
parsedBets.push(this.parseBet(bet))
})
if(this.state.chosenBet.home === "Bulgaria" || this.state.chosenBet.away === "Bulgaria" ) {
let shit = "<FootballEvent ID='5097152' EventTime='2018-11-13T19:00:00' Home='Bulgaria' Away='Germany'> <Market ID='25179210' Number='1' Name='Match Result'> <Selection ID='60475643' Number='1' OddsDecimal='2.55' Participant='HOME' /> <Selection ID='60475645' Number='2' OddsDecimal='3.83' Participant='DRAW' /> <Selection ID='60475644' Number='3' OddsDecimal='2.31' Participant='AWAY' /> </Market> <Market ID='25179211' Number='2' Name='Correct Score'> <Selection ID='60475646' Number='1' Description='0 - 0' OddsDecimal='47.48' Participant='DRAW' /> <Selection ID='60475652' Number='2' Description='1 - 1' OddsDecimal='5.42' Participant='DRAW' /> <Selection ID='60475657' Number='3' Description='2 - 2' OddsDecimal='14.83' Participant='DRAW' /> <Selection ID='60475647' Number='4' Description='1 - 0' OddsDecimal='14.32' Participant='HOME' /> <Selection ID='60475648' Number='5' Description='2 - 0' OddsDecimal='11.52' Participant='HOME' /> <Selection ID='60475653' Number='6' Description='2 - 1' OddsDecimal='6.53' Participant='HOME' /> <Selection ID='60475649' Number='7' Description='3 - 0' OddsDecimal='20.84' Participant='HOME' /> <Selection ID='60475654' Number='8' Description='3 - 1' OddsDecimal='23.65' Participant='HOME' /> <Selection ID='60475650' Number='9' Description='4 - 0' OddsDecimal='100.57' Participant='HOME' /> <Selection ID='60475651' Number='10' Description='0 - 1' OddsDecimal='13.47' Participant='AWAY' /> <Selection ID='60475655' Number='11' Description='0 - 2' OddsDecimal='10.19' Participant='AWAY' /> <Selection ID='60475656' Number='12' Description='1 - 2' OddsDecimal='6.15' Participant='AWAY' /> <Selection ID='60475658' Number='13' Description='0 - 3' OddsDecimal='17.34' Participant='AWAY' /> <Selection ID='60475659' Number='14' Description='1 - 3' OddsDecimal='20.92' Participant='AWAY' /> <Selection ID='60475660' Number='15' Description='0 - 4' OddsDecimal='78.71' Participant='AWAY' /> </Market> <Market ID='25179248' Number='3' Name='Total Goals'> <Selection ID='60475768' Number='1' Description='0 Goals' OddsDecimal='48.44' /> <Selection ID='60475769' Number='2' Description='1 Goals' OddsDecimal='7.02' /> <Selection ID='60475770' Number='3' Description='2 Goals' OddsDecimal='2.72' /> <Selection ID='60475771' Number='4' Description='3 Goals' OddsDecimal='2.36' /> <Selection ID='60475772' Number='5' Description='4 Goals' OddsDecimal='5.49' /> </Market> <Market ID='25179221' Number='4' Name='Penalty in Match'> <Selection ID='60475707' Number='1' Description='Yes' OddsDecimal='22.24' /> <Selection ID='60475707' Number='2' Description='No' OddsDecimal='1.24' /> </Market> </FootballEvent>"
let json = JSON.parse(xml2json(shit)).elements[0]
console.log(json)
parsedBets.push.apply([])
}
this.setState({ availableBets: parsedBets })
this.betsByType()
......@@ -163,13 +171,24 @@ export default class BetPage extends Component {
}
betItem (object, i) {
let betType = object.betType[0]
let newObj = {...object, betType: undefined}
return (
<Segment key={i} className="bet-item" data-obj={JSON.stringify(newObj)} onClick={this.addBet.bind(this)}>
{newObj.values[0] + " : " + newObj.values[1] + " " }
(Odds {newObj.odds})
</Segment>
)
if (betType.name === "Match Results") {
return (
<Segment key={i} className="bet-item" data-obj={JSON.stringify(newObj)} onClick={this.addBet.bind(this)}>
{ newObj.values[0] === newObj.values[1] ? "DRAW" : newObj.values[0] == 1 ? "WIN (Home)" : "LOSE (Home)"} { newObj.values[0] === newObj.values[1] ? "" : newObj.values[1] == 1 ? " : WIN (Away)" : " : LOSE (Away)"}
<p>(Odds {newObj.odds})</p>
</Segment>
)
} else {
return (
<Segment key={i} className="bet-item" data-obj={JSON.stringify(newObj)} onClick={this.addBet.bind(this)}>
{newObj.values[0] + " : " + newObj.values[1] + " " }
(Odds {newObj.odds})
</Segment>
)
}
}
//Sorting
......@@ -237,7 +256,6 @@ export default class BetPage extends Component {
}
renderChosenBet() {
console.log(this.state.yourBet)
return (
<div className="chosen-bets">
<Segment>
......@@ -247,7 +265,7 @@ export default class BetPage extends Component {
<Input name="amount" type="numbers" onChange={this.handleChange.bind(this)} value={this.state.amount}/>
<br/>
<p>Potential profit:</p>
{this.state.amount ? this.state.yourBet.odds * this.state.amount : "None"}
{this.state.amount ? Math.round(this.state.yourBet.odds * this.state.amount * 100) / 100 : "None"}
</Segment>
<Button color="green" onClick={this.submitBet.bind(this)}>
Submit your bet
......@@ -271,7 +289,7 @@ export default class BetPage extends Component {
{/* Nav bar */}
<div className="content">
<Segment className="rear all-event-types">
<Header attached> All Bets/Sports </Header>
<Header attached className="titles"> All Bets/Sports </Header>
{this.state.events.length !== 0 ? this.renderAllEvents() : <p className="no-bet"> No bet chosen </p>}
</Segment>
<Segment className="front all-available-bets">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment