Skip to content

Commit fe70d6c

Browse files
committed
Changed Modal to Sidebar w/ Segment
1 parent 0c7874b commit fe70d6c

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

src/algos.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//used for information pop up
22
export default {
3-
a: "A* pronounced A-Star was originally created in an attempt to create a general purpose robot as part of the Shakey\
3+
a: " ### A* Info\
4+
\nA* pronounced A-Star was originally created in an attempt to create a general purpose robot as part of the Shakey\
45
project in the 1960’s and 70’s. A* is a best-first search algorithm.\
56
\n### Runtime: \
67
\nThe time complexity is polynomial when the search space is a tree, there is a single goal state,\
@@ -11,25 +12,29 @@ export default {
1112
\n[The Coding Train (video part1)] (https://www.youtube.com/watch?v=aKYlikFAV4k&t=968s) \
1213
\n[Computerphile (video)] (https://www.youtube.com/watch?v=ySN5Wnu88nE )",
1314

14-
BFS: "Breadth-First Search is a graph or tree traversing algorithm that looks at all nodes at the current level \
15+
BFS: "### BFS Info\
16+
\nBreadth-First Search is a graph or tree traversing algorithm that looks at all nodes at the current level \
1517
before moving onto the next deepest set of nodes. It was created by Konrad Zuse in 1945 and later reinvented by Edward F. Moore in 1959. \
1618
\n### Runtime:\
1719
\nO( | V | + | E |) where V is the number of nodes and E the number of edges.\
1820
\n### Helpful links: \
1921
\n[TheHippieCat (video)] (https://www.youtube.com/watch?v=WvR9voi0y2I)\
2022
\n[Nesbox (README)] (https://github.com/nesbox/TIC-80/wiki/Pathfinding%EA%9E%89-BFS-Algorithm)",
2123

22-
DFS: "Depth-first search is a pathfinding or tree spanning algorithm that follows one branch to its deepest point before backtracking. \
24+
DFS: "### DFS Info\
25+
\nDepth-first search is a pathfinding or tree spanning algorithm that follows one branch to its deepest point before backtracking. \
2326
It was created in the 19th century by French mathematician Charles Pierre Trémaux. \
2427
\n### Runtime:\
2528
\nO( | V | + | E |) where V is the number of nodes and E the number of edges.\
2629
\n### Helpful links:\
2730
\n[Brilliant (articel)] (https://brilliant.org/wiki/depth-first-search-dfs)\
2831
\n[Go GATE IIT (video)](https://www.youtube.com/watch?v=iaBEKo5sM7w)",
2932

30-
Djikstras: "Djikstra's shortest path first Algorithm is a pathfinding algorithm created by Edsger W. Djikstra in 1956. \
33+
Djikstras: "### Djikstra's Algorithm Info\
34+
\nDjikstra's shortest path first Algorithm is a pathfinding algorithm created by Edsger W. Djikstra in 1956. \
3135
It uses a min-priority queue to find the shortest path of a weighted graph. \
32-
\n### Runtime: (Min-priority queue) O(| V | +| E |log| V |) (where | V | s the number of nodes and | E | is the number of edges)\
36+
\n### Runtime: \
37+
\n(Min-priority queue) O(| V | +| E |log| V |) (where | V | s the number of nodes and | E | is the number of edges)\
3338
\n(Array) O(V^2)\
3439
\n### Helpful links:\
3540
\n[Computerphile (video)](https://www.youtube.com/watch?v=GazC3A4OQTE)\

src/components/Menu/index.tsx

+29-15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
Modal,
1212
Form,
1313
TextAreaProps,
14+
Sidebar,
15+
Segment
1416
} from "semantic-ui-react";
1517
import { MazeInfo, Space } from "../../models/maze";
1618
import * as yup from "yup";
@@ -60,6 +62,7 @@ export interface _MenuState {
6062
showModal: boolean;
6163
hasError: boolean;
6264
errorMessage: string;
65+
sidebar: boolean;
6366
}
6467

6568
export const yupSpaceSchema = yup.object({
@@ -77,6 +80,7 @@ class MenuBar extends React.Component<MenuProps, _MenuState> {
7780
showModal: false,
7881
hasError: false,
7982
errorMessage: "",
83+
sidebar: false
8084
};
8185

8286
checkDynamicKeys = (keys: any[]): boolean => {
@@ -205,6 +209,10 @@ class MenuBar extends React.Component<MenuProps, _MenuState> {
205209
return al as string;
206210
};
207211

212+
setVisible = (b: boolean) => {
213+
this.setState({ ...this.state, sidebar: b });
214+
}
215+
208216
render() {
209217
const {
210218
canMoveStart,
@@ -330,22 +338,28 @@ class MenuBar extends React.Component<MenuProps, _MenuState> {
330338
options={algorithms}
331339
/>
332340
&nbsp; {/* Essentially just a fancy space */}
333-
<Modal
334-
trigger={
335-
<Button color="blue" circular>
336-
<Icon name="info" />
337-
</Button>
338-
}
339-
centered={false}
340-
closeIcon
341+
<Button color="blue" circular onClick = {() => this.setVisible(true)}>
342+
<Icon name="info" />
343+
</Button>
344+
<Sidebar
345+
as={Menu}
346+
animation='push'
347+
overlay
348+
icon='labeled'
349+
direction='right'
350+
onHide={() => this.setVisible(false)}
351+
vertical
352+
visible={this.state.sidebar}
353+
width='very wide'
341354
>
342-
<Modal.Header>{selectedAlgo} Algorithm Info</Modal.Header>
343-
<Modal.Content>
344-
<Modal.Description>
345-
<ReactMarkdown source={this.getInfo()} />
346-
</Modal.Description>
347-
</Modal.Content>
348-
</Modal>
355+
<Segment textAlign='left' padded='very'>
356+
<ReactMarkdown source={this.getInfo()} text-color = "white" />
357+
</Segment>
358+
359+
</Sidebar>
360+
361+
362+
349363
</Menu.Item>
350364
</Menu>
351365
);

0 commit comments

Comments
 (0)