This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
return ( | |
<div> | |
{/* Remaining jsx*/} | |
<GameLines event={event} sportKey={sportKey}/> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//GameLines.js | |
import "./styles.css"; | |
import React from "react"; | |
import { | |
MarketType, | |
getMarket, | |
} from "@cloudbet/market-helper"; | |
const sportMarketsGameLine = { | |
'basketball': [MarketType.basketball_handicap, MarketType.basketball_totals, MarketType.basketball_moneyline] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [ headers, home, away ] = React.useMemo(() => { | |
const headers = ['Competitor']; | |
const home = [homeName]; | |
const away = [awayName]; | |
if(sportMarketsGameLine[sportKey]){ | |
sportMarketsGameLine[sportKey].forEach(market => { | |
const [current, err] = getMarket(event, market); | |
if(!err && current[0]){ | |
headers.push(current[0].name); | |
const { variables: { handicap: handicapHome, total: totalHome }, back: { price: priceHome } } = current[0].lines[0][0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sportMarketsGameLine = { | |
'basketball': [MarketType.basketball_handicap, MarketType.basketball_totals, MarketType.basketball_moneyline] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
const sportMarkets = { | |
'soccer': [MarketType.soccer_match_odds, MarketType.soccer_asian_handicap], | |
'basketball': [MarketType.basketball_1x2, MarketType.basketball_handicap, MarketType.basketball_totals, MarketType.basketball_moneyline], | |
'american-football': [MarketType.american_football_quarter_total, MarketType.american_football_outright] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
const sportMarkets = { | |
'soccer': [MarketType.soccer_match_odds, MarketType.soccer_asian_handicap], | |
'basketball': [MarketType.basketball_1x2], | |
'american-football': [MarketType.american_football_quarter_total, MarketType.american_football_outright] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
return ( | |
<div> | |
<div className="event-title">{event.name}</div> | |
{eventMarkets.map((market) => { | |
if (!market.lines.length) { | |
return null; | |
} | |
const lines = market.lines.map(line => ( | |
<div className="selections"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
const eventMarkets = React.useMemo(() => { | |
let markets = []; | |
sportMarkets[sportKey].forEach(market => { | |
const [current, err] = getMarket(event, market); | |
if(!err){ | |
markets = markets.concat(current); | |
} | |
}) | |
return markets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Event.js | |
const sportMarkets = { | |
'soccer': [MarketType.soccer_match_odds, MarketType.soccer_asian_handicap], | |
'basketball': [MarketType.basketball_1x2], | |
'american-football': [MarketType.american_football_quarter_total] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Competition.js | |
{expanded && ( | |
<div> | |
{loading ? ( | |
<Loading /> | |
) : ( | |
events.map((e) => ( | |
<Event event={e} key={e.id} sportKey={sportKey} /> | |
)) | |
)} |
NewerOlder