Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wellsousaaa
GitHub Repository: wellsousaaa/Five-Nights-at-Freddys-Web
Path: blob/main/src/index.js
270 views
1
import React, { useState, useEffect } from "react";
2
import ReactDOM from "react-dom";
3
import Controller from "./Controller";
4
import "./css/Game.css";
5
import * as serviceWorker from "./serviceWorker";
6
import { Provider } from "react-redux";
7
import store from "./store/store";
8
import CustomNight from "./CustomNight";
9
10
const initialState = {
11
mode: "NORMAL",
12
Freddy: 10,
13
Bonnie: 10,
14
Chica: 10,
15
Foxy: 10,
16
};
17
18
const Start = () => {
19
const [Start, setStart] = useState(false);
20
const [stages, setStages] = useState(initialState);
21
22
useEffect(() => {
23
console.log(window.innerHeight > window.innerWidth);
24
if (window.innerHeight > window.innerWidth) {
25
window.alert(
26
`Para uma melhor experiência, vire seu celular para o modo de paisagem (modo deitado)
27
~ For a better experience, please rotate your phone to landscape mode`
28
);
29
}
30
}, []);
31
32
return (
33
<>
34
{!Start ? (
35
<div className="custom-night">
36
<CustomNight
37
setStart={setStart}
38
state={{ ranges: stages, setStages }}
39
/>
40
</div>
41
) : (
42
<Controller stages={stages} setStart={setStart} />
43
)}
44
</>
45
);
46
};
47
48
ReactDOM.render(
49
<Provider store={store}>
50
<Start />
51
</Provider>,
52
document.getElementById("root")
53
);
54
55
serviceWorker.register();
56
57