From 9383303a3eb4776b33c999d029e3421e6a9225e1 Mon Sep 17 00:00:00 2001 From: suaebahmed Date: Wed, 6 Dec 2023 23:41:07 +0600 Subject: [PATCH] Added Dynamic row and improved ui --- package-lock.json | 8 ++-- package.json | 2 +- src/Pages/PathfindingVS.jsx | 76 ++++++++++++++++++------------------- src/Pages/Sorting.jsx | 33 ++++++++-------- src/components/Modal.jsx | 16 +++++--- src/index.css | 16 +++----- src/main.tsx | 16 ++++---- src/styles/modal.css | 10 ++--- 8 files changed, 88 insertions(+), 89 deletions(-) diff --git a/package-lock.json b/package-lock.json index e65c4c5..3cdd42e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "eslint-plugin-react-refresh": "^0.4.4", "postcss": "^8.4.32", "postcss-import": "^15.1.0", - "tailwindcss": "^3.3.5", + "tailwindcss": "^3.3.6", "typescript": "^5.2.2", "vite": "^5.0.0" } @@ -3475,9 +3475,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", - "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.6.tgz", + "integrity": "sha512-AKjF7qbbLvLaPieoKeTjG1+FyNZT6KaJMJPFeQyLfIp7l82ggH1fbHJSsYIvnbTFQOlkh+gBYpyby5GT1LIdLw==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", diff --git a/package.json b/package.json index 190b75c..cfbb961 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "eslint-plugin-react-refresh": "^0.4.4", "postcss": "^8.4.32", "postcss-import": "^15.1.0", - "tailwindcss": "^3.3.5", + "tailwindcss": "^3.3.6", "typescript": "^5.2.2", "vite": "^5.0.0" } diff --git a/src/Pages/PathfindingVS.jsx b/src/Pages/PathfindingVS.jsx index 6f3ee56..f0a2978 100644 --- a/src/Pages/PathfindingVS.jsx +++ b/src/Pages/PathfindingVS.jsx @@ -17,14 +17,22 @@ import { Button } from "../components/Btn.tsx"; /* super(props);// call the super class constructor and pass in the props parameter */ - -var rows = 17; +var rows = 13; var cols = 31; -var START_NODE_ROW = 4, START_NODE_COL = 6; -var END_NODE_ROW = rows - 6, END_NODE_COL = cols - 6; -var INIT_START_ROW = START_NODE_ROW, INIT_START_COL = START_NODE_COL; -var INT_END_ROW = END_NODE_ROW, INIT_END_COL = END_NODE_COL; +const CELL_SIZE = 30; +const PADDING = 200; +const MAX_ROW = Math.floor((window.innerHeight - PADDING) / CELL_SIZE); +if (MAX_ROW > rows) rows = MAX_ROW >= 19 ? 19 : MAX_ROW; // Rows = [13, 19] + +var START_NODE_ROW = 4, + START_NODE_COL = 6; +var END_NODE_ROW = rows - 6, + END_NODE_COL = cols - 6; +var INIT_START_ROW = START_NODE_ROW, + INIT_START_COL = START_NODE_COL; +var INT_END_ROW = END_NODE_ROW, + INIT_END_COL = END_NODE_COL; const FAST = 5; const AVERAGE = 15; @@ -41,7 +49,6 @@ function App() { useEffect(() => { gridInitialize(); - popupClickHandle(); }, []); const gridInitialize = () => { @@ -272,20 +279,13 @@ function App() { END_NODE_COL = c; } }; - const popupClickHandle = () => { - var blur = document.getElementById("Container-blur"); - blur.classList.toggle("active"); - var popup = document.getElementById("popup"); - popup.classList.toggle("unActive"); - }; + + console.log(window.innerHeight, MAX_ROW, rows); return ( <> - -

+ +

Video Tutorial

@@ -298,30 +298,30 @@ function App() {
-
+
-
@@ -346,7 +346,7 @@ function App() {