Skip to content

Commit

Permalink
Merge pull request #7 from Lux-AI-Challenge/v1.1.0
Browse files Browse the repository at this point in the history
update viewer for new 1.1.2 version
  • Loading branch information
StoneT2000 authored Jul 2, 2021
2 parents 6c549e8 + bfdf11e commit 572d95d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lux-viewer-2021",
"version": "1.0.0",
"version": "1.1.2",
"description": "",
"author": "Lux AI challenge",
"main": "index.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@lux-ai/2021-challenge": "^0.0.16",
"@lux-ai/2021-challenge": "^1.1.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.11.2",
"@types/classnames": "^2.2.10",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Controller/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Controller = ({
fileInput,
running,
}: ControllerProps) => {
const isNightTime = (turn % 40 > 30 || turn % 40 == 0) && turn !== 0;
const isNightTime = turn % 40 >= 30 && turn !== 0;
return (
<div className="controller">
<div className="time-of-day">
Expand Down Expand Up @@ -112,14 +112,14 @@ const Controller = ({
onChange={handleUpload}
ref={fileInput}
/>
<IconButton
{/* <IconButton
aria-label="upload"
onClick={() => {
fileInput.current.click();
}}
>
<img className="upload-icon" src={UploadSVG} />
</IconButton>
</IconButton> */}
</div>
</div>
);
Expand Down
25 changes: 21 additions & 4 deletions src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ export const GameComponent = () => {

/** load game given json replay data */
const loadGame = (jsonReplayData: any) => {
if (
jsonReplayData.version === undefined ||
jsonReplayData.version !== clientConfigs.version
) {
if (jsonReplayData.version === undefined) {
alert(
`Replay file works on version 1.0.x but client is on version ${clientConfigs.version}. Download an older visualizer here: https://github.com/Lux-AI-Challenge/LuxViewer2021/releases`
);
} else {
const versionvals = jsonReplayData.version.split('.');
alert(
`Replay file works on version ${versionvals[0]}.${versionvals[1]}.x but client is on version ${clientConfigs.version}. Download an older visualizer here: https://github.com/Lux-AI-Challenge/LuxViewer2021/releases`
);
}
return;
}
if (game) {
game.destroy(true, false);
}
Expand Down Expand Up @@ -293,6 +309,10 @@ export const GameComponent = () => {
</div>
</div>
)}
<div id="version-number">
<strong>Version: </strong>
{clientConfigs.version}
</div>
{isReady && (
<div>
<Controller
Expand All @@ -308,10 +328,7 @@ export const GameComponent = () => {
sliderConfigs={sliderConfigs}
handleSliderChange={handleSliderChange}
/>
<div id="version-number">
<strong>Version: </strong>
{clientConfigs.version}
</div>

<div className="tile-stats-wrapper">
{selectedTileData ? (
<TileStats
Expand Down
2 changes: 1 addition & 1 deletion src/components/configs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.0"
"version": "1.1.2"
}
4 changes: 2 additions & 2 deletions src/components/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
display: flex;
justify-content: center;
margin-top: 0.5rem;
width: 41rem;
width: 36.85rem;
}
.Game .controller .replay-buttons .speed-display {
width: 1rem;
Expand Down Expand Up @@ -215,6 +215,6 @@
right: 1rem;
top: 1rem;
background-color: rgba(50, 61, 52, 0.1);
padding: 0.25rem;
padding: 0.5rem;
border-radius: 1rem;
}

0 comments on commit 572d95d

Please sign in to comment.