forked from wellsousaaa/Five-Nights-at-Freddys-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (49 loc) · 1.3 KB
/
index.js
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
import React, { useState, useEffect } from "react";
import ReactDOM from "react-dom";
import Controller from "./Controller";
import "./css/Game.css";
import * as serviceWorker from "./serviceWorker";
import { Provider } from "react-redux";
import store from "./store/store";
import CustomNight from "./CustomNight";
const initialState = {
mode: "NORMAL",
Freddy: 10,
Bonnie: 10,
Chica: 10,
Foxy: 10,
};
const Start = () => {
const [Start, setStart] = useState(false);
const [stages, setStages] = useState(initialState);
useEffect(() => {
console.log(window.innerHeight > window.innerWidth);
if (window.innerHeight > window.innerWidth) {
window.alert(
`Para uma melhor experiência, vire seu celular para o modo de paisagem (modo deitado)
~ For a better experience, please rotate your phone to landscape mode`
);
}
}, []);
return (
<>
{!Start ? (
<div className="custom-night">
<CustomNight
setStart={setStart}
state={{ ranges: stages, setStages }}
/>
</div>
) : (
<Controller stages={stages} setStart={setStart} />
)}
</>
);
};
ReactDOM.render(
<Provider store={store}>
<Start />
</Provider>,
document.getElementById("root")
);
serviceWorker.register();