From 15946c8287546bc40e5c97173751286a6793e413 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:09:26 +0100 Subject: [PATCH 01/16] Update graph.js exports --- dijkstra-prim-visualization/src/algorithms/graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dijkstra-prim-visualization/src/algorithms/graph.js b/dijkstra-prim-visualization/src/algorithms/graph.js index 6d9780c..69e7795 100644 --- a/dijkstra-prim-visualization/src/algorithms/graph.js +++ b/dijkstra-prim-visualization/src/algorithms/graph.js @@ -47,4 +47,4 @@ const buildAdjacencyList = (graph) => { return adjacencyList; }; -export { createGraphFromComponent, buildAdjacencyList }; +export { createGraph, createGraphFromComponent, buildAdjacencyList }; From 7d86487611050035976c8116fe1e71af5f5d4837 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:20:03 +0100 Subject: [PATCH 02/16] Add animations for Navbar edges --- .../src/components/Navbar/animations.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 dijkstra-prim-visualization/src/components/Navbar/animations.js diff --git a/dijkstra-prim-visualization/src/components/Navbar/animations.js b/dijkstra-prim-visualization/src/components/Navbar/animations.js new file mode 100644 index 0000000..cd95c6c --- /dev/null +++ b/dijkstra-prim-visualization/src/components/Navbar/animations.js @@ -0,0 +1,38 @@ +const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +/** + * Starts the animations for the given edge IDs. + * @param {string[]} edgeIds - The IDs of the edges to animate. + * @returns {Promise} - A promise that resolves when the animations are complete. + */ +const startAnimations = async (edgeIds) => { + const changeStrokeColor = async (edgeIds) => { + for (const id of edgeIds) { + const edge = document.getElementById(id); + edge.style.stroke = "green"; + edge.style.strokeWidth = "10"; + + await sleep(1000); + } + + for (const id of edgeIds) { + const edge = document.getElementById(id); + edge.style.stroke = "violet"; + } + + await sleep(3000); + }; + + const resetColors = async (edgeIds) => { + for (const id of edgeIds) { + const edge = document.getElementById(id); + edge.style.stroke = "red"; + edge.style.strokeWidth = "2"; + } + }; + + await changeStrokeColor(edgeIds); + await resetColors(edgeIds); +}; + +export { startAnimations }; From ee0111da45a64dcc785ac60d1d178e8b5740c4f1 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:20:28 +0100 Subject: [PATCH 03/16] Refactor Navbar component to use animations --- .../src/components/Navbar/Navbar.jsx | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx b/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx index b6e26c1..9974e3f 100644 --- a/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx +++ b/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx @@ -1,46 +1,29 @@ import { useContext } from "react"; import { GraphParamsContext } from "../../GraphParamsContext"; -import { createGraphFromComponent } from "../../algorithms/graph"; -import prim from "../../algorithms/mstPrim"; -import dijkstra from "../../algorithms/spDijkstra"; +import { startAnimations } from "./animations"; +import { runDijkstra, runPrim } from "./NavbarUtils"; /** - * Navbar component displays buttons to print nodes and edges. + * Navbar component displays buttons to manage all the logic of the website. * @returns {JSX.Element} Navbar component */ const Navbar = () => { const { nodes, edges } = useContext(GraphParamsContext); - const runPrim = () => { - const graph = createGraphFromComponent(nodes, edges); - const result = prim(graph); - console.log(result); + const animatePrim = async () => { + const edgeIds = runPrim(nodes, edges); + startAnimations(edgeIds); }; - const runDijkstra = () => { - const graph = createGraphFromComponent(nodes, edges); - const result = dijkstra(graph); - console.log(result); + const animateDijkstra = async () => { + const edgeIds = runDijkstra(nodes, edges); + startAnimations(edgeIds); }; return ( <> - - - - + + ); }; From 18ddb1fc1f010a664ac230a1ba490c46b644e933 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:21:46 +0100 Subject: [PATCH 04/16] Add NavbarUtils.js with functions for running Prim's and Dijkstra's algorithms --- .../src/components/Navbar/NavbarUtils.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 dijkstra-prim-visualization/src/components/Navbar/NavbarUtils.js diff --git a/dijkstra-prim-visualization/src/components/Navbar/NavbarUtils.js b/dijkstra-prim-visualization/src/components/Navbar/NavbarUtils.js new file mode 100644 index 0000000..24ec4b3 --- /dev/null +++ b/dijkstra-prim-visualization/src/components/Navbar/NavbarUtils.js @@ -0,0 +1,44 @@ +import { createGraphFromComponent } from "../../algorithms/graph"; +import prim from "../../algorithms/mstPrim"; +import dijkstra from "../../algorithms/spDijkstra"; + +const runPrim = (nodes, edges) => { + const graph = createGraphFromComponent(nodes, edges); + const result = prim(graph); + console.log(result); + result.steps.shift(); // TODO: fix it + const edgeIds = getEdgeIDs(result.steps); + + return edgeIds; +}; + +const runDijkstra = (nodes, edges) => { + const graph = createGraphFromComponent(nodes, edges); + const result = dijkstra(graph); + console.log(result); + const edgeIds = getEdgeIDs(result.steps); + + return edgeIds; +}; + +/** + * Returns an array of edge IDs based on the given steps. + * @param {Array} steps - The steps array. + * @returns {Array} - The array of edge IDs. + */ +const getEdgeIDs = (steps) => { + if (!Array.isArray(steps)) { + console.error("Invalid argument: steps must be an array"); + return; + } + + return steps.map((step) => { + const edgeCandidateOne = document.getElementById(`${step.from}-${step.to}`); + + return edgeCandidateOne + ? `${step.from}-${step.to}` + : `${step.to}-${step.from}`; // edgeCandidateTwo + }); +}; + +export { runPrim, runDijkstra }; From 5bab0ad4ba0cb7288c71b4f0b66a701dbc8369cc Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:23:07 +0100 Subject: [PATCH 05/16] Update canvas dimensions --- .../src/components/Canvas/Canvas.module.css | 2 ++ .../src/components/Canvas/Canvas.module.css.map | 2 +- .../src/components/Canvas/Canvas.module.scss | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css index 1fe0ea1..ae19aa4 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css @@ -1,4 +1,6 @@ .canvas { background-color: black; cursor: crosshair; + height: 500px; + width: 800px; }/*# sourceMappingURL=Canvas.module.css.map */ \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map index 0c345b0..a4b2044 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map @@ -1 +1 @@ -{"version":3,"sources":["Canvas.module.scss","Canvas.module.css"],"names":[],"mappings":"AAAA;EACE,uBAAA;EACA,iBAAA;ACCF","file":"Canvas.module.css"} \ No newline at end of file +{"version":3,"sources":["Canvas.module.scss","Canvas.module.css"],"names":[],"mappings":"AAAA;EACE,uBAAA;EACA,iBAAA;EACA,aAAA;EACA,YAAA;ACCF","file":"Canvas.module.css"} \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss index 2cbb2f8..c21d862 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss @@ -1,4 +1,6 @@ .canvas { background-color: black; cursor: crosshair; + height: 500px; + width: 800px; } From 5abc76d585f8750f0e248e3d08ffb77f860ba028 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:23:22 +0100 Subject: [PATCH 06/16] Add transition effect to Edge module CSS --- .../src/components/Canvas/Edges/Edge/Edge.module.css | 1 + .../src/components/Canvas/Edges/Edge/Edge.module.css.map | 2 +- .../src/components/Canvas/Edges/Edge/Edge.module.scss | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css index 19eec4d..ae64cec 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css +++ b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css @@ -1,4 +1,5 @@ .line { stroke: #ff0000; stroke-width: 2; + transition: all 0.5s linear; }/*# sourceMappingURL=Edge.module.css.map */ \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css.map b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css.map index 7de7530..4d1ee20 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css.map +++ b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.css.map @@ -1 +1 @@ -{"version":3,"sources":["Edge.module.scss","Edge.module.css"],"names":[],"mappings":"AAAA;EACE,eAAA;EACA,eAAA;ACCF","file":"Edge.module.css"} \ No newline at end of file +{"version":3,"sources":["Edge.module.scss","Edge.module.css"],"names":[],"mappings":"AAAA;EACE,eAAA;EACA,eAAA;EACA,2BAAA;ACCF","file":"Edge.module.css"} \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.scss b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.scss index 56071fd..0de7612 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.scss +++ b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.module.scss @@ -1,4 +1,5 @@ .line { stroke: #ff0000; stroke-width: 2; + transition: all 0.5s linear; } From c2d5e63f4e3ed5294469c9ef3aeb2e6fb3c03286 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza uulu Date: Sat, 18 Nov 2023 17:23:35 +0100 Subject: [PATCH 07/16] Add text label to Node component --- .../src/components/Canvas/Nodes/Node/Node.jsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx index 5e3c746..b566295 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx +++ b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx @@ -12,14 +12,19 @@ import classes from "./Node.module.css"; */ const Node = ({ id, cx, cy, onNodeClick }) => { return ( - onNodeClick(event, { id: id, x: cx, y: cy })} - /> + <> + onNodeClick(event, { id: id, x: cx, y: cy })} + /> + + {id} + + ); }; From 420ad9273d011fbedd0425861174a52b55dce84e Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:50:10 +0100 Subject: [PATCH 08/16] Refactor Node component styles --- .../src/components/Canvas/Nodes/Node/Node.jsx | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx index b566295..2c4883f 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx +++ b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.jsx @@ -1,5 +1,5 @@ import PropTypes from "prop-types"; -import classes from "./Node.module.css"; +import styles from "./Node.module.css"; /** * Renders a node on the canvas. @@ -12,19 +12,21 @@ import classes from "./Node.module.css"; */ const Node = ({ id, cx, cy, onNodeClick }) => { return ( - <> - onNodeClick(event, { id: id, x: cx, y: cy })} - /> - + onNodeClick(event, { id: id, x: cx, y: cy })} + > + + {id} - + ); }; From ec21b49a650c7c95f5910bb531cc521ace6e76f9 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:50:39 +0100 Subject: [PATCH 09/16] Add weight label to Edge component --- .../src/components/Canvas/Edges/Edge/Edge.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.jsx b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.jsx index 6b66a1e..d7e372c 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.jsx +++ b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edge/Edge.jsx @@ -11,9 +11,14 @@ import classes from "./Edge.module.css"; * @param {number} props.y2 - The y-coordinate of the ending point. * @returns {JSX.Element} - The rendered component. */ -const Edge = ({ id, x1, y1, x2, y2 }) => { +const Edge = ({ id, x1, y1, x2, y2, weight }) => { return ( - + + + + {weight} + + ); }; From 2d09ac54dccffe34423de8ac8453a736169501d3 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:50:52 +0100 Subject: [PATCH 10/16] Delete unnecessary CSS styles --- dijkstra-prim-visualization/src/App.css | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 dijkstra-prim-visualization/src/App.css diff --git a/dijkstra-prim-visualization/src/App.css b/dijkstra-prim-visualization/src/App.css deleted file mode 100644 index 902778b..0000000 --- a/dijkstra-prim-visualization/src/App.css +++ /dev/null @@ -1,6 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} From c462d3066a393a4b89eeb9e5e77cfa6c6b7e4456 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:51:10 +0100 Subject: [PATCH 11/16] Remove import of App.css --- dijkstra-prim-visualization/src/App.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/dijkstra-prim-visualization/src/App.jsx b/dijkstra-prim-visualization/src/App.jsx index fab882f..07fd84c 100644 --- a/dijkstra-prim-visualization/src/App.jsx +++ b/dijkstra-prim-visualization/src/App.jsx @@ -1,4 +1,3 @@ -import "./App.css"; import Canvas from "./components/Canvas/Canvas"; import Navbar from "./components/Navbar/Navbar"; import { GraphParamsProvider } from "./GraphParamsContext"; From c226ee6d4faa4e623bda8569ed8a7f32621a03c6 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:51:30 +0100 Subject: [PATCH 12/16] Refactor Edges component to render edge weights --- .../src/components/Canvas/Edges/Edges.jsx | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edges.jsx b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edges.jsx index f52eaaa..2228e30 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Edges/Edges.jsx +++ b/dijkstra-prim-visualization/src/components/Canvas/Edges/Edges.jsx @@ -3,17 +3,11 @@ import React from "react"; import Edge from "./Edge/Edge"; /** - * Renders edges on the canvas. - * @param {Object[]} edges - An array of edge objects. - * @param {string} edges[].id - The unique identifier of the edge. - * @param {Object} edges[].firstNode - The first node of the edge. - * @param {number} edges[].firstNode.x - The x-coordinate of the first node. - * @param {number} edges[].firstNode.y - The y-coordinate of the first node. - * @param {Object} edges[].secondNode - The second node of the edge. - * @param {number} edges[].secondNode.x - The x-coordinate of the second node. - * @param {number} edges[].secondNode.y - The y-coordinate of the second node. - * @param {number} edges[].weight - The weight of the edge. - * @returns {JSX.Element} - The rendered edges and their weights. + * Renders the edges on the canvas. + * + * @component + * @param {Object[]} edges - The array of edges to be rendered. + * @returns {JSX.Element} The rendered edges. */ const Edges = ({ edges }) => { return ( @@ -26,14 +20,8 @@ const Edges = ({ edges }) => { y1={edge.firstNode.y} x2={edge.secondNode.x} y2={edge.secondNode.y} + weight={edge.weight} /> - - {edge.weight} - ))} From e08a95bf4e277e6d2e1c90bd62a5110f7bf8dbaf Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:51:43 +0100 Subject: [PATCH 13/16] Update index.css to use viewport units for width and height --- dijkstra-prim-visualization/src/index.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dijkstra-prim-visualization/src/index.css b/dijkstra-prim-visualization/src/index.css index eff67ec..38d5436 100644 --- a/dijkstra-prim-visualization/src/index.css +++ b/dijkstra-prim-visualization/src/index.css @@ -18,6 +18,11 @@ body { margin: 0; display: flex; place-items: center; - min-width: 320px; - min-height: 100vh; + width: 100vw; + height: 100vh; +} + +#root { + width: 100%; + height: 100%; } From 80aae30a910846e1e89080b9eb35f71d4bc60135 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:51:54 +0100 Subject: [PATCH 14/16] Update canvas dimensions to be responsive --- .../src/components/Canvas/Canvas.module.css | 4 ++-- .../src/components/Canvas/Canvas.module.css.map | 2 +- .../src/components/Canvas/Canvas.module.scss | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css index ae19aa4..674305c 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css @@ -1,6 +1,6 @@ .canvas { background-color: black; cursor: crosshair; - height: 500px; - width: 800px; + height: 100%; + width: 100%; }/*# sourceMappingURL=Canvas.module.css.map */ \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map index a4b2044..811f2c0 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.css.map @@ -1 +1 @@ -{"version":3,"sources":["Canvas.module.scss","Canvas.module.css"],"names":[],"mappings":"AAAA;EACE,uBAAA;EACA,iBAAA;EACA,aAAA;EACA,YAAA;ACCF","file":"Canvas.module.css"} \ No newline at end of file +{"version":3,"sources":["Canvas.module.scss","Canvas.module.css"],"names":[],"mappings":"AAAA;EACE,uBAAA;EACA,iBAAA;EACA,YAAA;EACA,WAAA;ACCF","file":"Canvas.module.css"} \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss index c21d862..0922886 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss +++ b/dijkstra-prim-visualization/src/components/Canvas/Canvas.module.scss @@ -1,6 +1,6 @@ .canvas { background-color: black; cursor: crosshair; - height: 500px; - width: 800px; + height: 100%; + width: 100%; } From 757fdb8c61863db4fff55f438a4e3462b1c80744 Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:52:03 +0100 Subject: [PATCH 15/16] Update Node styles --- .../src/components/Canvas/Nodes/Node/Node.module.css | 11 +++++++++-- .../components/Canvas/Nodes/Node/Node.module.css.map | 2 +- .../src/components/Canvas/Nodes/Node/Node.module.scss | 11 +++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css index f4ca90d..e2ca060 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css +++ b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css @@ -1,7 +1,14 @@ +.node { + cursor: pointer; +} + .circle { stroke: #fff; - stroke-width: 1.5; - cursor: pointer; + stroke-width: 2; fill: #fff; transition: all 0.2s linear; +} + +.text { + color: black; }/*# sourceMappingURL=Node.module.css.map */ \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css.map b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css.map index 2045c16..98c8570 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css.map +++ b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.css.map @@ -1 +1 @@ -{"version":3,"sources":["Node.module.scss","Node.module.css"],"names":[],"mappings":"AAAA;EACE,YAAA;EACA,iBAAA;EACA,eAAA;EACA,UAAA;EACA,2BAAA;ACCF","file":"Node.module.css"} \ No newline at end of file +{"version":3,"sources":["Node.module.scss","Node.module.css"],"names":[],"mappings":"AAAA;EACE,eAAA;ACCF;;ADEA;EACE,YAAA;EACA,eAAA;EACA,UAAA;EACA,2BAAA;ACCF;;ADEA;EACE,YAAA;ACCF","file":"Node.module.css"} \ No newline at end of file diff --git a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.scss b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.scss index bff8ba0..853313e 100644 --- a/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.scss +++ b/dijkstra-prim-visualization/src/components/Canvas/Nodes/Node/Node.module.scss @@ -1,7 +1,14 @@ +.node { + cursor: pointer; +} + .circle { stroke: #fff; - stroke-width: 1.5; - cursor: pointer; + stroke-width: 2; fill: #fff; transition: all 0.2s linear; } + +.text { + color: black; +} From 62463fa40212b6bfbc94df2c8936a5318c241e6d Mon Sep 17 00:00:00 2001 From: Adilet Baimyrza Date: Sun, 19 Nov 2023 03:57:40 +0100 Subject: [PATCH 16/16] Refactor animation functions in Navbar.jsx --- dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx b/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx index 9974e3f..890045f 100644 --- a/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx +++ b/dijkstra-prim-visualization/src/components/Navbar/Navbar.jsx @@ -10,12 +10,12 @@ import { runDijkstra, runPrim } from "./NavbarUtils"; const Navbar = () => { const { nodes, edges } = useContext(GraphParamsContext); - const animatePrim = async () => { + const animatePrim = () => { const edgeIds = runPrim(nodes, edges); startAnimations(edgeIds); }; - const animateDijkstra = async () => { + const animateDijkstra = () => { const edgeIds = runDijkstra(nodes, edges); startAnimations(edgeIds); };