-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
38 lines (32 loc) · 1.14 KB
/
App.js
File metadata and controls
38 lines (32 loc) · 1.14 KB
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
import React, {useState} from "react"
import Navbar from "./components/Navbar"
import Tutorial from "./components/Tutorial"
import Grid from "./components/Grid"
import Djikstra from "./algorithms/Djikstra"
import BFS from "./algorithms/BFS"
import DFS from "./algorithms/DFS"
import BestFirst from "./algorithms/BestFirst"
import AStar from "./algorithms/AStar"
export default function App(){
const algorithms = {"Djikstra": Djikstra, "Greedy Best-First Search": BestFirst, "Breadth-First Search": BFS, "Depth-First Search": DFS, "A* Search": AStar}
const [currentAlgo, setCurrentAlgo] = useState("A* Search")
const [tutorial, setTutorial] = useState(true)
function removeTutorial(){
setTutorial(false)
}
return (
<div className = "app--container">
{tutorial && <Tutorial
switchOff = {removeTutorial}
/>}
<Navbar
setCurrentAlgo={setCurrentAlgo}
currentAlgo={currentAlgo}
/>
<Grid
algo={algorithms[currentAlgo]}
algoId = {currentAlgo}
/>
</div>
)
}