Skip to content

Commit 870123d

Browse files
Ugly tutorial page
1 parent fdaedeb commit 870123d

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

algorithm_visualizer/src/pages/GraphPage.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,7 @@ li > input {
112112
background-color: black;
113113
border: 1px solid white
114114
}
115+
116+
.skip-button {
117+
margin-left: 1.25rem;
118+
}

algorithm_visualizer/src/pages/GraphPage.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export const GraphPage = () => {
3434
const webCamRef = useRef();
3535
const [webcamEnabled, setWebcamState] = useState(false);
3636

37+
// tutorial states
38+
const [tutorialPage, setTutorialPage] = useState(1);
39+
3740
// INITIALIZATION
3841

3942
useEffect(() => {
@@ -479,7 +482,7 @@ export const GraphPage = () => {
479482
<button className="btn btn-toggle align-items-center rounded my-1" data-bs-toggle="collapse" data-bs-target="#settings-collapse" aria-expanded="false">
480483
Options
481484
</button>
482-
<div className="collapse settings-menu" id="settings-collapse">
485+
<div className="collapse show settings-menu" id="settings-collapse">
483486
{/* Wall Weight Slider */}
484487
<div className="mb-1 gap-2 d-flex justify-content-start align-items-center flex-wrap">
485488
<label className="form-label m-0"> Set Wall Weight : </label>
@@ -538,14 +541,25 @@ export const GraphPage = () => {
538541
<div className="modal-dialog modal-dialog-centered">
539542
<div className="modal-content camera-modal">
540543
<div className="modal-header">
541-
<h5 className="modal-title text-white" id="modal-label">Tutorial</h5>
544+
<h5 className="modal-title text-white" id="modal-label"><b>Tutorial - {
545+
(tutorialPage == 1) ? 'Graph Algorithms'
546+
: (tutorialPage == 2) ? 'Weighted/Unweighted'
547+
: (tutorialPage == 3) ? 'Mazes/Terrain'
548+
: 'Options'
549+
}</b></h5>
542550
<button type="button" className="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
543551
</div>
544-
<div className="modal-body p-0">
545-
<h5> HIII </h5>
546-
</div>
552+
<div className="modal-body p-0">{
553+
(tutorialPage == 1) ? <p>Pathfinding is closely related to the shortest path problem, within graph theory, which examines how to identify the path that best meets some criteria (shortest, cheapest, fastest, etc) between two points in a large network. This site is a tool to visualize these different graph pathfinding algorithms to better understand them.</p>
554+
: (tutorialPage == 2) ? <p>All of the algorithms on this application are adapted for a 2D grid, movement through a node has a "cost" of 1. Different weights can be added by utilizing the Wall Weight Slider under the options menu. Weighted algorithms will take into consideration of these different weights on the grid whereas unweighted algorithms will ignore them entirely.</p>
555+
: (tutorialPage == 3) ? <p>You can generate a maze using the algorithms within the maze dropdown. Weighted mazes are referred to as terrains. These can be created via image upload, webcam picture, or created within the application.</p>
556+
: <p>The option menu allows the user to adapt the grid to their liking. This includes features such as setting wall weights, adjusting the grid size, and changing the animation speed.</p>
557+
}</div>
547558
<div className="modal-footer">
548-
559+
{(tutorialPage == 1) ? <button className="btn btn-outline-light" id="skip-button" data-bs-dismiss="modal">Skip</button> : ''}
560+
{(tutorialPage > 1) ? <button className="btn btn-outline-light" id="skip-button" onClick={()=>setTutorialPage(x=>x-1)}>Previous</button> : ''}
561+
{(tutorialPage<4) ? <button className="btn btn-outline-light" id="skip-button" onClick={()=>setTutorialPage(x=>x+1)}>Next</button> : ''}
562+
{(tutorialPage == 4) ? <button className="btn btn-outline-light" id="skip-button" data-bs-dismiss="modal">Finish</button> : ''}
549563
</div>
550564
</div>
551565
</div>

0 commit comments

Comments
 (0)