-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
782 lines (653 loc) · 29.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RLBot Casting Sheet</title>
<script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/@material-ui/[email protected]/umd/material-ui.production.min.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/min/moment.min.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<div class="page-center-div">
<div id="react_container"></div>
</div>
<!-- Load our React component. -->
<script type="text/babel">
'use strict';
const {
AppBar,
Button,
Input,
Card,
CardActions,
CardContent,
colors,
createMuiTheme,
CssBaseline,
Dialog,
Grid,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
FormControl,
Icon,
InputLabel,
MenuItem,
MuiThemeProvider,
Paper,
PropTypes,
Select,
Snackbar,
Tab,
Tabs,
TextField,
Typography,
withStyles,
} = window['material-ui'];
const countryNames = {"AF": "Afghanistan", "AX": "\u00c5land Islands", "AL": "Albania", "DZ": "Algeria", "AS": "American Samoa", "AD": "Andorra", "AO": "Angola", "AI": "Anguilla", "AQ": "Antarctica", "AG": "Antigua and Barbuda", "AR": "Argentina", "AM": "Armenia", "AW": "Aruba", "AU": "Australia", "AT": "Austria", "AZ": "Azerbaijan", "BS": "Bahamas", "BH": "Bahrain", "BD": "Bangladesh", "BB": "Barbados", "BY": "Belarus", "BE": "Belgium", "BZ": "Belize", "BJ": "Benin", "BM": "Bermuda", "BT": "Bhutan", "BO": "Bolivia, Plurinational State of", "BQ": "Bonaire, Sint Eustatius and Saba", "BA": "Bosnia and Herzegovina", "BW": "Botswana", "BV": "Bouvet Island", "BR": "Brazil", "IO": "British Indian Ocean Territory", "BN": "Brunei Darussalam", "BG": "Bulgaria", "BF": "Burkina Faso", "BI": "Burundi", "KH": "Cambodia", "CM": "Cameroon", "CA": "Canada", "CV": "Cape Verde", "KY": "Cayman Islands", "CF": "Central African Republic", "TD": "Chad", "CL": "Chile", "CN": "China", "CX": "Christmas Island", "CC": "Cocos (Keeling) Islands", "CO": "Colombia", "KM": "Comoros", "CG": "Congo", "CD": "Congo, the Democratic Republic of the", "CK": "Cook Islands", "CR": "Costa Rica", "CI": "C\u00f4te d'Ivoire", "HR": "Croatia", "CU": "Cuba", "CW": "Cura\u00e7ao", "CY": "Cyprus", "CZ": "Czech Republic", "DK": "Denmark", "DJ": "Djibouti", "DM": "Dominica", "DO": "Dominican Republic", "EC": "Ecuador", "EG": "Egypt", "SV": "El Salvador", "GQ": "Equatorial Guinea", "ER": "Eritrea", "EE": "Estonia", "ET": "Ethiopia", "FK": "Falkland Islands (Malvinas)", "FO": "Faroe Islands", "FJ": "Fiji", "FI": "Finland", "FR": "France", "GF": "French Guiana", "PF": "French Polynesia", "TF": "French Southern Territories", "GA": "Gabon", "GM": "Gambia", "GE": "Georgia", "DE": "Germany", "GH": "Ghana", "GI": "Gibraltar", "GR": "Greece", "GL": "Greenland", "GD": "Grenada", "GP": "Guadeloupe", "GU": "Guam", "GT": "Guatemala", "GG": "Guernsey", "GN": "Guinea", "GW": "Guinea-Bissau", "GY": "Guyana", "HT": "Haiti", "HM": "Heard Island and McDonald Islands", "VA": "Holy See (Vatican City State)", "HN": "Honduras", "HK": "Hong Kong", "HU": "Hungary", "IS": "Iceland", "IN": "India", "ID": "Indonesia", "IR": "Iran, Islamic Republic of", "IQ": "Iraq", "IE": "Ireland", "IM": "Isle of Man", "IL": "Israel", "IT": "Italy", "JM": "Jamaica", "JP": "Japan", "JE": "Jersey", "JO": "Jordan", "KZ": "Kazakhstan", "KE": "Kenya", "KI": "Kiribati", "KP": "Korea, Democratic People's Republic of", "KR": "Korea, Republic of", "KW": "Kuwait", "KG": "Kyrgyzstan", "LA": "Lao People's Democratic Republic", "LV": "Latvia", "LB": "Lebanon", "LS": "Lesotho", "LR": "Liberia", "LY": "Libya", "LI": "Liechtenstein", "LT": "Lithuania", "LU": "Luxembourg", "MO": "Macao", "MK": "Macedonia, the Former Yugoslav Republic of", "MG": "Madagascar", "MW": "Malawi", "MY": "Malaysia", "MV": "Maldives", "ML": "Mali", "MT": "Malta", "MH": "Marshall Islands", "MQ": "Martinique", "MR": "Mauritania", "MU": "Mauritius", "YT": "Mayotte", "MX": "Mexico", "FM": "Micronesia, Federated States of", "MD": "Moldova, Republic of", "MC": "Monaco", "MN": "Mongolia", "ME": "Montenegro", "MS": "Montserrat", "MA": "Morocco", "MZ": "Mozambique", "MM": "Myanmar", "NA": "Namibia", "NR": "Nauru", "NP": "Nepal", "NL": "Netherlands", "NC": "New Caledonia", "NZ": "New Zealand", "NI": "Nicaragua", "NE": "Niger", "NG": "Nigeria", "NU": "Niue", "NF": "Norfolk Island", "MP": "Northern Mariana Islands", "NO": "Norway", "OM": "Oman", "PK": "Pakistan", "PW": "Palau", "PS": "Palestine, State of", "PA": "Panama", "PG": "Papua New Guinea", "PY": "Paraguay", "PE": "Peru", "PH": "Philippines", "PN": "Pitcairn", "PL": "Poland", "PT": "Portugal", "PR": "Puerto Rico", "QA": "Qatar", "RE": "R\u00e9union", "RO": "Romania", "RU": "Russian Federation", "RW": "Rwanda", "BL": "Saint Barth\u00e9lemy", "SH": "Saint Helena, Ascension and Tristan da Cunha", "KN": "Saint Kitts and Nevis", "LC": "Saint Lucia", "MF": "Saint Martin (French part)", "PM": "Saint Pierre and Miquelon", "VC": "Saint Vincent and the Grenadines", "WS": "Samoa", "SM": "San Marino", "ST": "Sao Tome and Principe", "SA": "Saudi Arabia", "SN": "Senegal", "RS": "Serbia", "SC": "Seychelles", "SL": "Sierra Leone", "SG": "Singapore", "SX": "Sint Maarten (Dutch part)", "SK": "Slovakia", "SI": "Slovenia", "SB": "Solomon Islands", "SO": "Somalia", "ZA": "South Africa", "GS": "South Georgia and the South Sandwich Islands", "SS": "South Sudan", "ES": "Spain", "LK": "Sri Lanka", "SD": "Sudan", "SR": "Suriname", "SJ": "Svalbard and Jan Mayen", "SZ": "Swaziland", "SE": "Sweden", "CH": "Switzerland", "SY": "Syrian Arab Republic", "TW": "Taiwan, Province of China", "TJ": "Tajikistan", "TZ": "Tanzania, United Republic of", "TH": "Thailand", "TL": "Timor-Leste", "TG": "Togo", "TK": "Tokelau", "TO": "Tonga", "TT": "Trinidad and Tobago", "TN": "Tunisia", "TR": "Turkey", "TM": "Turkmenistan", "TC": "Turks and Caicos Islands", "TV": "Tuvalu", "UG": "Uganda", "UA": "Ukraine", "AE": "United Arab Emirates", "GB": "United Kingdom", "US": "United States", "UM": "United States Minor Outlying Islands", "UY": "Uruguay", "UZ": "Uzbekistan", "VU": "Vanuatu", "VE": "Venezuela, Bolivarian Republic of", "VN": "Viet Nam", "VG": "Virgin Islands, British", "VI": "Virgin Islands, U.S.", "WF": "Wallis and Futuna", "EH": "Western Sahara", "YE": "Yemen", "ZM": "Zambia", "ZW": "Zimbabwe"};
const theme = createMuiTheme({
palette: {
primary: {
light: colors.blue[300],
main: colors.blue[500],
dark: colors.blue[700],
},
secondary: {
light: colors.yellow[300],
main: colors.yellow[500],
dark: colors.yellow[700],
},
},
typography: {
useNextVariants: true,
},
});
const styles = theme => ({});
class BotRow extends React.Component {
render() {
const bot = this.props.botLibrary[this.props.botId];
const makerLib = this.props.makerLibrary;
const self = this;
if (!bot) {
return (<span className="errorMessage">Failed to lookup {this.props.botId}</span>);
}
const makersMarkup = bot.makers.map(function(makerId, idx) {
let maker = makerLib[makerId];
let content = null;
if (maker) {
content = (
<span className="botMaker" onClick={() => self.props.spotlightMaker(makerId)}>{maker.name}</span>
);
} else {
content = <span className="errorMessage">Failed to lookup {makerId}</span>;
}
return [idx > 0 && ", ", content]
});
return (
<tr class="clickTarget" onClick={() => this.props.spotlightBot(this.props.botId)}>
<td className="botName">{bot.name}</td>
<td className="smallish bigLeftMargin"> by {makersMarkup}</td>
</tr>
);
}
}
class BotCard extends React.Component {
render() {
const idx = this.props.idx;
const bot = this.props.botLibrary[this.props.botId];
const makerLib = this.props.makerLibrary;
const self = this;
if (!bot) {
return (<span className="errorMessage">Failed to lookup {this.props.botId}</span>);
}
const makersMarkup = bot.makers.map(function(makerId, idx) {
let maker = makerLib[makerId];
if (maker) {
return (
<span className="botMaker" onClick={() => self.props.spotlightMaker(makerId)}>{maker.name}</span>
);
}
return (<span className="errorMessage">Failed to lookup {makerId}</span>);
});
return (
<div class="clickTarget" onClick={() => this.props.spotlightBot(this.props.botId)}>
<span className="botName">{bot.name}</span>
<span className="smallish bigLeftMargin"> by {makersMarkup}</span></div>
);
}
}
class Flag extends React.Component {
render() {
if (this.props.countryCode) {
const countryName = countryNames[this.props.countryCode];
return (
<span>
<img className="flagIcon" src={'flags/' + this.props.countryCode + '.png'} /> {countryName}
</span>
);
}
return null;
}
}
class JoinDate extends React.Component {
render() {
if (this.props.date) {
return (<span>joined {moment(this.props.date).fromNow()}</span>);
}
return null;
}
}
const LANGUAGE_ICONS = {
"python": "python.png",
"kotlin": "kotlin.svg",
"java": "java.png",
"csharp": "csharp.png",
"rust": "rust.svg",
"scratch": "scratchcat.png",
"rlgym": "rlgym.png"
};
const LANGUAGE_NAMES = {
"python": "Python",
"kotlin": "Kotlin",
"java": "Java",
"csharp": "C#",
"rust": "Rust",
"scratch": "Scratch",
"rlgym": "RLGym machine learning"
};
class BotSpotlight extends React.Component {
render() {
const idx = this.props.idx;
const bot = this.props.botLibrary[this.props.botId];
const makerLib = this.props.makerLibrary;
const notes = bot.notes;
let updatedList;
if (notes) {
updatedList = notes.map((listItems)=>{
return <li>{listItems}</li>;
});
}
const languageName = bot.language ? LANGUAGE_NAMES[bot.language] : null;
if (languageName) {
updatedList.unshift(<li>Made with {languageName}.</li>)
}
const self = this;
const makersMarkup = bot.makers.map(function(makerId, idx) {
let maker = makerLib[makerId];
const preface = idx === 0 ? "Made by" : "";
if (maker) {
return (
<div>
<h4 className="botMaker">{preface} {maker.name}</h4>
<p><Flag countryCode={maker.countryCode} /></p>
<p>{maker.discordId} <JoinDate date={maker.joinDate} /></p>
<div>{maker.notes}</div>
</div>
);
}
return (<span className="errorMessage">Failed to lookup {makerId}</span>);
});
const statsLink = bot.statsUrl ? (<p><a href={bot.statsUrl}>View Statistics</a></p>) : null;
const languageIconFile = bot.language ? LANGUAGE_ICONS[bot.language] : null;
const languageIcon = languageIconFile ? <img src={"language_icons/" + languageIconFile} className="language-icon" /> : null;
return (
<div>
{languageIcon}
<h3 className="botName">{bot.name}</h3>
<p><ul>{updatedList}</ul></p>
{statsLink}
{makersMarkup}
</div>
);
}
}
class TeamSpotlight extends React.Component {
render() {
const idx = this.props.idx;
const team = this.props.team;
const botLib = this.props.botLibrary;
const self = this;
const notes = team.notes;
let updatedList;
if (notes) {
updatedList = notes.map((listItems)=>{
return <li>{listItems}</li>;
});
}
const botRows = team.bots.map(function(botName, idx) {
let bot = botLib[botName];
return (
<BotRow botId={botName} {...self.props} idx={idx} key={idx} />
);
});
const statsLink = team.statsUrl ? (<p><a href={team.statsUrl}>View Statistics</a></p>) : null;
return (
<div>
<h3><span className="teamName">{team.name}</span></h3>
<p><ul>{updatedList}</ul></p>
{statsLink}
<table>{botRows}</table>
</div>
);
}
}
class TeamRow extends React.Component {
render() {
const idx = this.props.idx;
const team = this.props.team;
const botLib = this.props.botLibrary;
const makerLib = this.props.makerLibrary;
const self = this;
const botsMarkup = team.bots.map(function(botName, idx) {
let bot = botLib[botName]
if (bot) {
return (
<span>{bot.name}, </span>
);
}
return (<span className="errorMessage">Failed to lookup {botName}</span>);
});
return (
<div className="teamListing clickTarget" onClick={() => this.props.spotlightTeam(team)}>
<span className="teamName">{team.name}</span>
<div>{botsMarkup}</div>
</div>
);
}
}
class TeamList extends React.Component {
render() {
const self = this;
const botLib = this.props.botLibrary;
const makerLib = this.props.makerLibrary;
const itemsMarkup = this.props.teams.map(function(team, idx) {
return (
<TeamRow team={team} {...self.props} idx={idx} key={idx} />
);
});
return (
<div>{itemsMarkup}</div>
);
}
}
class AllBotsList extends React.Component {
render() {
const self = this;
const botLib = this.props.botLibrary;
const itemsMarkup = Object.keys(botLib).map(function(botName) {
return (
<BotRow botId={botName} {...self.props} key={botName} />
);
});
return (
<div>{itemsMarkup}</div>
);
}
}
class BotList extends React.Component {
render() {
const self = this;
const botLib = this.props.botLibrary;
const botList = this.props.botList;
const itemsMarkup = botList.map(function(botName) {
return (
<BotRow botId={botName} {...self.props} key={botName} />
);
});
return (
<div>{itemsMarkup}</div>
);
}
}
class QuickSearch extends React.Component {
constructor(props) {
super(props);
this.state = {
query: ""
};
}
inputChanged = (change) => {
this.setState({query: change.target.value.toLowerCase()})
};
render() {
const self = this;
const botLib = this.props.botLibrary;
const makerLib = this.props.makerLibrary;
let itemsMarkup = null;
if (this.state.query.length >= 3) {
const matchingEntries = Object.entries(botLib).filter((entry) => {
const bot = entry[1];
if (bot.name.toLowerCase().indexOf(this.state.query) >= 0) {
return true;
}
for (const makerId of bot.makers) {
if (makerId.toLowerCase().indexOf(this.state.query) >= 0) {
return true;
}
const maker = makerLib[makerId];
if (maker && maker.name.toLowerCase().indexOf(this.state.query) >= 0) {
return true;
}
}
return false;
});
itemsMarkup = matchingEntries.map(function(entry) {
return (
<div>
<Card>
<CardContent>
<BotSpotlight botId={entry[0]} {...self.props} key={entry[0]} />
</CardContent>
</Card>
<br />
</div>
);
});
}
return (
<div style={{minHeight: "500px"}}>
<br />
<TextField label="Search bot or maker" type="text" onChange={this.inputChanged} />
{itemsMarkup}
</div>
);
}
}
const ALL_BOTS = "All Bots";
const QUICK_SEARCH = "Quick Search";
const DEFAULT_BOT_SET = "RLBot Championship 2022";
const DEFAULT_LEAGUE = DEFAULT_BOT_SET;
class UltimateBattleLeague extends React.Component {
constructor(props) {
super(props);
this.state = {
bots: {}, leagues: {}, botSets: {}, activeLeague: DEFAULT_LEAGUE, makers: {}, pendingBotName: "",
showSnack: false, snackMessage: "", activeTeam: null, activeBotId: null, activeTab: 0
};
this.loadState = () => {
const content = this.fileReader.result;
const state = JSON.parse(content);
this.comparisonHash = state.comparisonHash;
debugger;
this.setState({
bots: state.bots,
leagues: state.leagues,
botSets: state.botSets,
activeLeague: DEFAULT_LEAGUE,
makers: state.makers});
};
this.handleSelectedFile = (file) => {
this.fileReader = new FileReader();
this.fileReader.onloadend = this.loadState;
this.fileReader.readAsText(file);
};
this.spotlightMaker = (makerId) => {
console.log("Maker clicked: " + this.state.makers[makerId]);
};
this.spotlightTeam = (teamObj) => {
const isSingleBotTeam = new Set(teamObj.bots).size === 1;
this.setState({activeTeam: teamObj, activeBotId: isSingleBotTeam ? teamObj.bots[0] : null});
};
this.spotlightBot = (botId) => {
this.setState({activeBotId: botId});
};
}
componentDidMount() {
fetch('bot-data.json')
.then(res => res.json())
.then((result) => {
this.setState({
bots: result.bots, leagues: result.leagues, botSets: result.botSets, activeLeague: DEFAULT_LEAGUE, makers: result.makers
});
},
(error) => {
console.log(error);
}
)
}
activeLeagueChanged(league) {
this.setState({
activeLeague: league, activeTeam: null
});
}
fileReader = null;
getBotViewPanels() {
const botSpotlightContent = this.state.activeBotId ? (
<div className="detailContainer">
<h2>Bot Detail</h2>
<Card>
<CardContent>
<BotSpotlight botId={this.state.activeBotId} botLibrary={this.state.bots}
makerLibrary={this.state.makers} />
</CardContent>
</Card>
</div>
) : (<span />);
const teamList = this.state.leagues[this.state.activeLeague];
if (teamList) {
const teamContent = this.state.activeTeam ? (
<div className="detailContainer">
<h2>Team Detail</h2>
<Card>
<CardContent>
<TeamSpotlight team={this.state.activeTeam} botLibrary={this.state.bots}
makerLibrary={this.state.makers}
spotlightBot={this.spotlightBot} spotlightMaker={this.spotlightMaker}/>
</CardContent>
</Card>
</div>
) : (<span/>);
return (
<Grid container spacing={24}>
<Grid item>
<h2>Teams</h2>
<Card className="leftPane">
<CardContent>
<TeamList teams={teamList} botLibrary={this.state.bots}
makerLibrary={this.state.makers}
spotlightBot={this.spotlightBot} spotlightMaker={this.spotlightMaker}
spotlightTeam={this.spotlightTeam}/>
</CardContent>
</Card>
</Grid>
<Grid item>
{teamContent}
</Grid>
<Grid item>
{botSpotlightContent}
</Grid>
</Grid>
);
} else if (this.state.activeLeague === ALL_BOTS) {
return (
<Grid container spacing={24}>
<Grid item>
<h2>All Bots</h2>
<Card className="leftPane">
<CardContent>
<AllBotsList teams={teamList} botLibrary={this.state.bots}
makerLibrary={this.state.makers}
spotlightBot={this.spotlightBot} spotlightMaker={this.spotlightMaker} />
</CardContent>
</Card>
</Grid>
<Grid item>
{botSpotlightContent}
</Grid>
</Grid>
);
} else if (this.state.botSets[this.state.activeLeague]) {
return (
<Grid container spacing={24}>
<Grid item>
<h2>{this.state.activeLeague}</h2>
<Card className="leftPane">
<CardContent>
<BotList botList={this.state.botSets[this.state.activeLeague]}
botLibrary={this.state.bots}
makerLibrary={this.state.makers}
spotlightBot={this.spotlightBot} spotlightMaker={this.spotlightMaker} />
</CardContent>
</Card>
</Grid>
<Grid item>
{botSpotlightContent}
</Grid>
</Grid>
);
}
else if (this.state.activeLeague === QUICK_SEARCH) {
return (
<QuickSearch botLibrary={this.state.bots} makerLibrary={this.state.makers} spotlightBot={this.spotlightBot} spotlightMaker={this.spotlightMaker} />
)
}
}
render() {
const activeTab = this.state.activeTab;
let tabContent;
if (activeTab === 0) {
const leagueChoices = [QUICK_SEARCH, ALL_BOTS, "RLBot Championship 2022"].map((choice) => (
<MenuItem value={choice}>{choice}</MenuItem>
));
tabContent = (
<div>
<div>
<FormControl>
<InputLabel htmlFor="league-select">League</InputLabel>
<Select
inputProps={{id: 'league-select'}}
value={this.state.activeLeague}
onChange={(evt) => this.activeLeagueChanged(evt.target.value)}
>
{leagueChoices}
</Select>
</FormControl>
</div>
{this.getBotViewPanels()}
{!Object.keys(this.state.bots).length && (
<Button component="label">
Load Data
<Input type="file" onChange={e => this.handleSelectedFile(e.target.files[0])} style={{ display: "none" }}/>
</Button>
)}
<p>Flag Icons by <a href="https://blogging.com/free-flag-icons/">Blogging.com.</a></p>
</div>
);
} else {
tabContent = (
<iframe
src="https://docs.google.com/document/d/e/2PACX-1vR_8l7KEGr767HAq0A8sKGbtpv3suxA5eimIuEfinuCOVWiN01dD37XHBr3Q37nil1wb8gGnI9H1IMz/pub?embedded=true"
width="100%"
height="720"
>
</iframe>
);
}
return (
<MuiThemeProvider theme={theme}>
<CssBaseline />
<AppBar position="sticky">
<Tabs value={activeTab} onChange={(e, val) => this.setState({activeTab: val})} aria-label="Tab menu">
<Tab label="Bot and Team Data" />
<Tab label="League Standings" />
</Tabs>
</AppBar>
<div className="tabContainer">
{tabContent}
</div>
<Snackbar
anchorOrigin={{vertical: 'bottom', horizontal: 'center'}}
open={this.state.showSnack}
autoHideDuration={5000}
message={this.state.snackMessage}
onClose={this.handleSnackClose}
/>
</MuiThemeProvider>
);
}
}
const App = withStyles(styles)(UltimateBattleLeague);
const domContainer = document.querySelector('#react_container');
ReactDOM.render(<App/>, domContainer);
</script>
<style type="text/css">
body {
color: rgba(0, 0, 0, 0.87);
font-size: 1rem;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
font-weight: 400;
line-height: 1.5;
letter-spacing: 0.00938em;
}
.tabContainer {
padding: 16px;
}
.clickTarget {
cursor: pointer;
border-radius: 3px;
padding: 4px;
margin-top: 4px;
margin-bottom: 2px;
}
.clickTarget:hover {
background-color: #f0f7f7;
}
h2 {
margin-top: 8px;
margin-bottom: 4px;
}
h3, h4, h5 {
margin-top: 8px;
margin-bottom: 0;
}
.detailContainer {
min-width: 300px;
max-width: 500px;
}
.smallish {
font-size: .8em;
color: #444;
}
.bigLeftMargin {
margin-left: 20px;
}
td.bigLeftMargin {
margin-left: 0;
padding-left: 20px;
}
.errorMessage {
color: red;
}
.teamListing {
margin-top: 8px;
}
.teamName {
font-weight: bold;
}
.flagIcon {
height: 32px;
margin-bottom: -10px;
margin-top: -10px;
}
.language-icon {
float: right;
max-width: 60px;
}
.leftPane {
max-width: 300px;
max-height: 600px;
overflow-y: auto;
}
.botName {
white-space: nowrap;
}
</style>
</body>
</html>