├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── images │ ├── algos │ │ ├── 15puzz.png │ │ ├── bs.png │ │ ├── nQueens.png │ │ ├── pf.png │ │ ├── primeNums.png │ │ ├── recursiveSort.png │ │ ├── rt.png │ │ └── sorting.png │ ├── nav │ │ ├── gvk.jpg │ │ └── logo.jpg │ ├── userDummyDp.png │ └── userProfile.png ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.js ├── App.test.js ├── AuthContext.js ├── DataProvider.js ├── components ├── Cookies │ └── CookieConsentComponent.jsx ├── addnotes │ ├── AddNotes.css │ └── AddNotes.jsx ├── datestreak │ ├── DateStreak.css │ └── DateStreak.jsx ├── error │ ├── ErrorMessageConsole.jsx │ ├── error.gif │ ├── error.json │ └── style.css ├── footer │ ├── NewFooter.css │ ├── NewFooter.jsx │ └── logo.png ├── loading │ ├── Loading.jsx │ ├── LoadingComponent.jsx │ ├── loading.css │ └── style.css ├── loadingPB │ ├── LoadingPB.jsx │ └── style.css ├── nav │ ├── Nav.jsx │ ├── style.css │ └── style2.css ├── sounds │ ├── buttonClick.mp3 │ ├── card-hover.mp3 │ ├── card_flip.mp3 │ ├── hover_quest.wav │ └── loud_btn_clk.wav └── streakpopup │ ├── StreakPopup.css │ ├── StreakPopup.jsx │ └── fire.png ├── index.css ├── index.js ├── logo.svg ├── pages ├── about │ ├── About.jsx │ └── components │ │ ├── developerDetails │ │ ├── DeveloperDetails.jsx │ │ ├── GVK.jpg │ │ ├── Mahesh.jpg │ │ ├── Me.jpg │ │ ├── Surya.jpg │ │ └── style.css │ │ └── horizontalScroll │ │ ├── HorizontalScroll1.jsx │ │ ├── HorizontalScroll2.jsx │ │ └── style.css ├── algoVisualiser │ ├── 15Puzzle │ │ ├── FifPuzzle.jsx │ │ ├── components │ │ │ ├── navbar.jsx │ │ │ ├── puzzle.jsx │ │ │ └── style.css │ │ └── style.css │ ├── Graph │ │ ├── Tree.js │ │ ├── bst.js │ │ ├── canvasSVG.jsx │ │ ├── details.jsx │ │ ├── edge.jsx │ │ ├── fib.jsx │ │ ├── graph.jsx │ │ ├── menu.jsx │ │ ├── navbar.jsx │ │ ├── simpleSelect.jsx │ │ ├── vertex.jsx │ │ └── vertexOriginal.jsx │ ├── Recursion │ │ ├── Recursion.jsx │ │ ├── components │ │ │ ├── Tree.js │ │ │ ├── bst.js │ │ │ ├── canvasSVG.jsx │ │ │ ├── details.jsx │ │ │ ├── edge.jsx │ │ │ ├── fib.jsx │ │ │ ├── graph.jsx │ │ │ ├── menu.jsx │ │ │ ├── navbar.jsx │ │ │ ├── simpleSelect.jsx │ │ │ ├── vertex.jsx │ │ │ └── vertexOriginal.jsx │ │ └── style.css │ ├── Turing Machine │ │ ├── cell.css │ │ ├── cell.jsx │ │ ├── menu.jsx │ │ ├── navbar.jsx │ │ ├── ribbon.jsx │ │ ├── simpleSelect.jsx │ │ ├── slider.jsx │ │ ├── table.jsx │ │ └── turingMachine.jsx │ ├── algorithms │ │ ├── 15puzzle.js │ │ ├── Astar.js │ │ ├── bfs.jsx │ │ ├── dijkstra.js │ │ ├── grahamScan.js │ │ ├── heapSort.js │ │ ├── mergeSort.js │ │ ├── prime.js │ │ ├── quickSort.js │ │ ├── quickSortRecursive.js │ │ ├── randomMaze.js │ │ ├── recursiveMaze.js │ │ ├── sortingAlgorithms.js │ │ └── turing.js │ ├── binarySearch │ │ ├── Components │ │ │ ├── PlaySound.jsx │ │ │ ├── UpperRangeDialog.jsx │ │ │ ├── WarningBox.jsx │ │ │ ├── binarySearch.jsx │ │ │ ├── doubleSlider.jsx │ │ │ ├── entryPoint.jsx │ │ │ ├── guess.jsx │ │ │ ├── result.jsx │ │ │ ├── search.jsx │ │ │ └── textField.jsx │ │ ├── binarySearch.jsx │ │ └── style.css │ ├── comingSoon │ │ ├── ComingSoon.jsx │ │ └── style.css │ ├── home │ │ ├── AlgoVisualiser.jsx │ │ ├── components │ │ │ ├── 3DCardDemo.tsx │ │ │ ├── Body.jsx │ │ │ ├── Component.jsx │ │ │ ├── Intro.jsx │ │ │ ├── SearchLinks.jsx │ │ │ ├── ThemeSelector.jsx │ │ │ ├── TypingEffect.jsx │ │ │ ├── data.js │ │ │ └── data2.js │ │ ├── darktheme.css │ │ └── style.css │ ├── nQueens │ │ ├── components │ │ │ ├── cell.jsx │ │ │ ├── cells.jsx │ │ │ ├── doubleSlider.jsx │ │ │ ├── formControlLabel.jsx │ │ │ ├── menu.jsx │ │ │ ├── queen.jpg │ │ │ ├── queen.jsx │ │ │ ├── queen.png │ │ │ ├── simpleSelect.jsx │ │ │ ├── slider.jsx │ │ │ └── style.css │ │ ├── nQueens.jsx │ │ └── style.css │ ├── pathfinder │ │ ├── Pathfinder.jsx │ │ ├── algorithms │ │ │ ├── 15puzzle.js │ │ │ ├── Astar.js │ │ │ ├── bfs.jsx │ │ │ ├── dijkstra.js │ │ │ ├── grahamScan.js │ │ │ ├── heapSort.js │ │ │ ├── mergeSort.js │ │ │ ├── prime.js │ │ │ ├── quickSort.js │ │ │ ├── quickSortRecursive.js │ │ │ ├── randomMaze.js │ │ │ ├── recursiveMaze.js │ │ │ ├── sortingAlgorithms.js │ │ │ └── turing.js │ │ ├── components │ │ │ ├── PF.jsx │ │ │ ├── PlaySound.jsx │ │ │ ├── grid.css │ │ │ ├── grid.jsx │ │ │ ├── menu.jsx │ │ │ ├── node.css │ │ │ ├── node.jsx │ │ │ └── simpleSelect.jsx │ │ ├── darktheme.css │ │ └── style.css │ ├── primeNumbers │ │ ├── PrimeNumbers.jsx │ │ └── style.css │ ├── recursiveSorting │ │ ├── recursiveSorting.jsx │ │ └── style.css │ ├── sorting │ │ ├── Sorting.jsx │ │ ├── components │ │ │ ├── airBnbSlider.jsx │ │ │ ├── doubleSlider.jsx │ │ │ ├── formControlLabel.jsx │ │ │ ├── menu.jsx │ │ │ ├── navbar.jsx │ │ │ ├── rect.jsx │ │ │ ├── rects.jsx │ │ │ ├── simpleSelect.jsx │ │ │ ├── slider.jsx │ │ │ ├── sort.js │ │ │ └── style.css │ │ └── style.css │ └── sounds │ │ ├── buttonClick.mp3 │ │ ├── card-hover.mp3 │ │ ├── card_flip.mp3 │ │ ├── hover_quest.wav │ │ ├── loud_btn_clk.wav │ │ └── mech-keyboard.mp3 ├── auth │ ├── AuthContext.jsx │ ├── Dashboard.jsx │ ├── Login.css │ ├── Login.jsx │ ├── PrivateRoute.jsx │ ├── Signup.css │ ├── Signup.jsx │ └── firebase.js ├── components │ ├── 3d-card.tsx │ ├── PlaySound.jsx │ ├── ThemeSelector.jsx │ ├── footer │ │ ├── Footer.jsx │ │ └── style.css │ ├── gvkDetails │ │ ├── GVKDetails.jsx │ │ └── style.css │ └── sounds │ │ ├── PlaySound.jsx │ │ ├── buttonClick.mp3 │ │ ├── hover_quest.wav │ │ └── loud_btn_clk.wav ├── contibutionboard │ ├── ContributionBoard.jsx │ └── style.css ├── dsajourney │ ├── DSAJourney.jsx │ ├── components │ │ ├── ProblemHistory.jsx │ │ └── style.css │ └── style.css ├── helpers │ └── array_helpers.js ├── home │ ├── Home.jsx │ ├── components │ │ ├── Status │ │ │ ├── StatusProblem.jsx │ │ │ ├── status.js │ │ │ └── style.css │ │ ├── difficulty │ │ │ ├── Difficulty.jsx │ │ │ ├── add.jsx │ │ │ ├── data.js │ │ │ └── style.css │ │ ├── horizontalScroll │ │ │ ├── HorizontalScroll1.jsx │ │ │ ├── HorizontalScroll2.jsx │ │ │ └── style.css │ │ ├── intro │ │ │ ├── Intro.css │ │ │ ├── Intro.js │ │ │ └── assets │ │ │ │ ├── Programmer.gif │ │ │ │ ├── Telecommuting.gif │ │ │ │ ├── about.jpg │ │ │ │ ├── about1.jpg │ │ │ │ └── coding.png │ │ ├── problems │ │ │ ├── ProblemList.jsx │ │ │ ├── combineData.js │ │ │ ├── components │ │ │ │ ├── ProblemComponent.jsx │ │ │ │ ├── style.css │ │ │ │ └── styles │ │ │ │ │ ├── Apple.png │ │ │ │ │ ├── Dell.png │ │ │ │ │ ├── GFG.png │ │ │ │ │ ├── GFG.svg │ │ │ │ │ ├── Google.jpg │ │ │ │ │ ├── LeetCode.png │ │ │ │ │ ├── Microsoft.png │ │ │ │ │ ├── ProblemComponent.css │ │ │ │ │ ├── Spotify.png │ │ │ │ │ └── Telegram.png │ │ │ └── style.css │ │ ├── sounds │ │ │ ├── buttonClick.mp3 │ │ │ ├── card-hover.mp3 │ │ │ ├── card_flip.mp3 │ │ │ ├── hover_quest.wav │ │ │ └── loud_btn_clk.wav │ │ └── topics │ │ │ ├── Topics.jsx │ │ │ ├── data.js │ │ │ └── style.css │ ├── problems │ │ ├── Problems.jsx │ │ ├── history.png │ │ ├── style.css │ │ └── style2.css │ └── style.css ├── profile │ ├── Profile.jsx │ ├── components │ │ ├── donutchart │ │ │ ├── DonutChart.css │ │ │ └── DonutChart.jsx │ │ ├── geeksforgeeks │ │ │ ├── GFG.svg │ │ │ ├── GeeksforGeeks.jsx │ │ │ └── style.css │ │ ├── leaderboard │ │ │ ├── Leaderboard.jsx │ │ │ └── style.css │ │ ├── leetcode │ │ │ ├── LeetCode.jsx │ │ │ └── LeetCode.png │ │ ├── problemSolvedChart │ │ │ ├── ProblemSolvedChart.jsx │ │ │ ├── ProblemSolvedChart2.jsx │ │ │ ├── style.css │ │ │ └── style2.css │ │ ├── problemssovedtable │ │ │ ├── ProblemsSolvedTable.jsx │ │ │ └── style.css │ │ ├── topicsolved │ │ │ ├── TopicSolved.css │ │ │ └── TopicSolved.jsx │ │ └── userDetails │ │ │ ├── UserDetails.jsx │ │ │ └── style.css │ └── style.css ├── settings │ └── Settings.jsx ├── solution │ ├── Solution.jsx │ └── style.css └── solutionpage │ ├── SolutionCode.jsx │ ├── SolutionPage.css │ └── SolutionPage.jsx ├── reportWebVitals.js ├── setupTests.js └── store └── userInfo.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | .env 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/free-solid-svg-icons": "^6.5.2", 7 | "@fortawesome/react-fontawesome": "^0.2.2", 8 | "@lottiefiles/react-lottie-player": "^3.5.4", 9 | "@mui/material": "^5.15.21", 10 | "@ramonak/react-progress-bar": "^5.2.0", 11 | "@testing-library/jest-dom": "^5.17.0", 12 | "@testing-library/react": "^13.4.0", 13 | "@testing-library/user-event": "^13.5.0", 14 | "@vercel/analytics": "^1.2.2", 15 | "assert": "^2.1.0", 16 | "axios": "^1.7.2", 17 | "chart.js": "^4.4.3", 18 | "date-fns": "^3.6.0", 19 | "date-streaks": "^1.2.1", 20 | "firebase": "^10.12.2", 21 | "https-browserify": "^1.0.0", 22 | "jwt-decode": "^4.0.0", 23 | "mapbox-gl": "^3.6.0", 24 | "react": "^18.3.1", 25 | "react-calendar-heatmap": "^1.9.0", 26 | "react-chartjs-2": "^5.2.0", 27 | "react-cookie": "^7.1.4", 28 | "react-cookie-consent": "^9.0.0", 29 | "react-dom": "^18.3.1", 30 | "react-icons": "^5.2.1", 31 | "react-images-uploading": "^3.1.7", 32 | "react-lottie": "^1.2.4", 33 | "react-router-dom": "^6.24.1", 34 | "react-scripts": "5.0.1", 35 | "react-syntax-highlighter": "^15.5.0", 36 | "react-toastify": "^10.0.5", 37 | "react-wavify": "^1.11.0", 38 | "stream-browserify": "^3.0.0", 39 | "stream-http": "^3.2.0", 40 | "url": "^0.11.3", 41 | "use-sound": "^4.0.1", 42 | "util": "^0.12.5", 43 | "web-vitals": "^2.1.4" 44 | }, 45 | "scripts": { 46 | "start": "react-scripts start", 47 | "build": "react-scripts build", 48 | "test": "react-scripts test", 49 | "eject": "react-scripts eject" 50 | }, 51 | "eslintConfig": { 52 | "extends": [ 53 | "react-app", 54 | "react-app/jest" 55 | ] 56 | }, 57 | "browserslist": { 58 | "production": [ 59 | ">0.2%", 60 | "not dead", 61 | "not op_mini all" 62 | ], 63 | "development": [ 64 | "last 1 chrome version", 65 | "last 1 firefox version", 66 | "last 1 safari version" 67 | ] 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/favicon.ico -------------------------------------------------------------------------------- /public/images/algos/15puzz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/15puzz.png -------------------------------------------------------------------------------- /public/images/algos/bs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/bs.png -------------------------------------------------------------------------------- /public/images/algos/nQueens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/nQueens.png -------------------------------------------------------------------------------- /public/images/algos/pf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/pf.png -------------------------------------------------------------------------------- /public/images/algos/primeNums.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/primeNums.png -------------------------------------------------------------------------------- /public/images/algos/recursiveSort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/recursiveSort.png -------------------------------------------------------------------------------- /public/images/algos/rt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/rt.png -------------------------------------------------------------------------------- /public/images/algos/sorting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/algos/sorting.png -------------------------------------------------------------------------------- /public/images/nav/gvk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/nav/gvk.jpg -------------------------------------------------------------------------------- /public/images/nav/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/nav/logo.jpg -------------------------------------------------------------------------------- /public/images/userDummyDp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/userDummyDp.png -------------------------------------------------------------------------------- /public/images/userProfile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/images/userProfile.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | DSA Tracker 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/AuthContext.js: -------------------------------------------------------------------------------- 1 | import React, { createContext, useContext, useState, useEffect } from 'react'; 2 | import { createUserWithEmailAndPassword } from 'firebase/auth'; 3 | 4 | const AuthContext = createContext(); 5 | 6 | export const AuthProvider = ({ children }) => { 7 | const [currentUser, setCurrentUser] = useState(null); 8 | const [token, setToken] = useState(null); 9 | 10 | useEffect(() => { 11 | const user = JSON.parse(localStorage.getItem('user')); 12 | const savedToken = localStorage.getItem('token'); 13 | if (user && savedToken) { 14 | setCurrentUser(user); 15 | setToken(savedToken); 16 | } 17 | }, []); 18 | 19 | const login = (user, token) => { 20 | localStorage.setItem('user', JSON.stringify(user)); 21 | localStorage.setItem('token', token); 22 | setCurrentUser(user); 23 | setToken(token); 24 | }; 25 | 26 | const logout = () => { 27 | localStorage.removeItem('user'); 28 | localStorage.removeItem('token'); 29 | setCurrentUser(null); 30 | setToken(null); 31 | }; 32 | 33 | const signup = async (email, password, name, phoneNo) => { 34 | try { 35 | const response = await fetch(`${process.env.REACT_APP_SERVER_URL}/auth/register`, { 36 | method: "POST", 37 | headers: { 38 | "Content-Type": "application/json", 39 | }, 40 | body: JSON.stringify({ 41 | email, 42 | password, 43 | name, 44 | phoneNo 45 | }), 46 | }); 47 | 48 | console.log("Response status:", response.status); 49 | 50 | if (!response.ok) { 51 | const errorData = await response.json(); 52 | console.error("Error data:", errorData); 53 | throw new Error(errorData.message || "Failed to register"); 54 | } 55 | 56 | const data = await response.json(); 57 | login(data.user, data.token); 58 | return { user: data.user, token: data.token }; 59 | 60 | } catch (error) { 61 | console.error("Failed to signup:", error); 62 | throw error; 63 | } 64 | }; 65 | 66 | 67 | return ( 68 | 69 | {children} 70 | 71 | ); 72 | }; 73 | 74 | export const useAuth = () => { 75 | return useContext(AuthContext); 76 | }; 77 | -------------------------------------------------------------------------------- /src/DataProvider.js: -------------------------------------------------------------------------------- 1 | import React, { createContext, useState, useEffect } from 'react'; 2 | 3 | export const DataContext = createContext(); 4 | 5 | export const DataProvider = ({ children }) => { 6 | const [data, setData] = useState({}); 7 | const [loading, setLoading] = useState(true); 8 | const [error, setError] = useState(null); 9 | 10 | const fetchData = async () => { 11 | try { 12 | const response = await fetch("https://dsa-tracker-backend-kappa.vercel.app/home", { 13 | method: 'GET' 14 | }); 15 | if (!response.ok) { 16 | throw new Error('Failed to fetch'); 17 | } 18 | const responseData = await response.json(); 19 | console.log(responseData.data) 20 | setData(responseData.data); 21 | setLoading(false); 22 | } catch (error) { 23 | console.error('Fetch error:', error); 24 | setError(error); 25 | setLoading(false); 26 | } 27 | }; 28 | 29 | useEffect(() => { 30 | fetchData(); 31 | }, []); 32 | return loading ? null : ( 33 | 34 | {children} 35 | 36 | ); 37 | }; 38 | -------------------------------------------------------------------------------- /src/components/addnotes/AddNotes.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"); 2 | 3 | .blur { 4 | filter: blur(5px); 5 | } 6 | 7 | .addnotes-modal { 8 | position: fixed; 9 | top: 0; 10 | left: 0; 11 | width: 100%; 12 | height: 100%; 13 | background: rgba(0, 0, 0, 0.5); 14 | display: flex; 15 | justify-content: center; 16 | align-items: center; 17 | z-index: 1000; 18 | } 19 | 20 | .addnotes-main-container { 21 | font-family: "Poppins", sans-serif; 22 | position: fixed; 23 | z-index: 33; 24 | left: 50%; 25 | top: 50%; 26 | transform: translate(-50%, -50%); 27 | width: 40rem; 28 | height: 25rem; 29 | border-radius: 1.5625rem; 30 | padding: 1.2rem; 31 | border: 1px solid #e0e0e0; 32 | background-color: #ffffff; 33 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 34 | } 35 | 36 | .addnotes-container { 37 | /* border: 2px solid #61d8ad; */ 38 | width: 100%; 39 | height: 100%; 40 | border-radius: 1.5625rem; 41 | padding: 1rem; 42 | box-sizing: border-box; 43 | font-family: "Poppins", sans-serif; 44 | } 45 | 46 | textarea { 47 | width: 100%; 48 | height: 90%; 49 | font-family: "Poppins", sans-serif; 50 | border-radius: 1rem; 51 | border: 1px solid #2ed096; 52 | padding: 2rem; 53 | box-sizing: border-box; 54 | resize: none; 55 | font-size: 1rem; 56 | background-color: #f9f9f9; 57 | } 58 | 59 | .buttons { 60 | display: flex; 61 | justify-content: flex-end; 62 | gap: 1rem; 63 | margin-top: 0.5rem; 64 | } 65 | 66 | .save-btn, 67 | .cancel-btn { 68 | width: 6rem; 69 | height: 2.5rem; 70 | border: none; 71 | border-radius: 1.5625rem; 72 | font-family: "Poppins", sans-serif; 73 | font-size: 1rem; 74 | cursor: pointer; 75 | transition: background-color 0.3s; 76 | } 77 | 78 | .save-btn { 79 | background-color: #61d8ad; 80 | color: white; 81 | } 82 | 83 | .save-btn:hover { 84 | background-color: #4cb892; 85 | } 86 | 87 | .cancel-btn { 88 | background-color: #f0f0f0; 89 | color: #333; 90 | } 91 | 92 | .cancel-btn:hover { 93 | background-color: #dcdcdc; 94 | } 95 | -------------------------------------------------------------------------------- /src/components/addnotes/AddNotes.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "./AddNotes.css"; 3 | import buttonClick from "../sounds/buttonClick.mp3"; 4 | import { toast } from 'react-toastify'; 5 | import 'react-toastify/dist/ReactToastify.css'; 6 | 7 | const AddNotes = ({ onClose, existingNotes }) => { 8 | const [notes, setNotes] = React.useState(existingNotes || ""); 9 | 10 | const notifySuccess = () => { 11 | toast.success("Notes Saved"); 12 | }; 13 | 14 | const notifyCancel = () => { 15 | toast.error("Cancelled"); 16 | }; 17 | 18 | const sound = new Audio(buttonClick); 19 | 20 | const handleSaveNotes = () => { 21 | notifySuccess(); 22 | sound.play(); 23 | onClose(notes); // Pass the notes back to the parent component 24 | }; 25 | 26 | const handleClose = () => { 27 | notifyCancel(); 28 | sound.play(); 29 | onClose(); // No notes to return if canceled 30 | }; 31 | 32 | return ( 33 |
34 |
35 | {/* {existingNotes &&

Saved Notes

} */} 36 | 41 |
42 | {/* Conditionally render the Save button if there are no existing notes */} 43 | 44 | 45 | 48 |
49 |
50 |
51 | ); 52 | }; 53 | 54 | export default AddNotes; 55 | -------------------------------------------------------------------------------- /src/components/datestreak/DateStreak.css: -------------------------------------------------------------------------------- 1 | .calendar-container { 2 | display: flex; 3 | justify-content: space-between; 4 | align-items: center; 5 | margin: 3rem auto; 6 | padding: 0.8rem; 7 | border-radius: 1rem; 8 | background-color: #ffffff; 9 | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 10 | max-width: 35vw; 11 | height: 6vh; 12 | display: flex; 13 | justify-content: center; 14 | } 15 | 16 | .date-streak-lc { 17 | display: flex; 18 | justify-content: center; 19 | } 20 | 21 | .date-streak-lc .problem-component-loading { 22 | height: 10vh; 23 | width: 40vw; 24 | background: linear-gradient(90deg, 25 | #0000 33%, 26 | rgba(255, 255, 255, 0.8) 50%, 27 | #0000 66%) #eaeaea; 28 | background-size: 300% 100%; 29 | animation: shine 2s infinite; 30 | border-radius: 1rem; 31 | margin-top: 2vh; 32 | margin-right: 2vw; 33 | } 34 | 35 | .calendar-day { 36 | display: flex; 37 | flex-direction: column; 38 | align-items: center; 39 | padding: 0.5rem; 40 | margin: 0.2rem; 41 | border-radius: 50%; 42 | width: 3.125rem; 43 | height: 3.125rem; 44 | text-align: center; 45 | font-family: "Poppins", sans-serif; 46 | color: #333; 47 | } 48 | 49 | .day-name { 50 | font-size: 0.85rem; 51 | color: #3f3d3d; 52 | margin-bottom: 0.3rem; 53 | } 54 | 55 | .date-number { 56 | font-size: 16px; 57 | font-weight: 600; 58 | font-family: "Poppins", sans-serif; 59 | color: #333; 60 | } 61 | 62 | .highlight { 63 | background-color: #62d8af69; 64 | color: #ffffff; 65 | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); 66 | } -------------------------------------------------------------------------------- /src/components/error/ErrorMessageConsole.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import Lottie from "react-lottie"; // Import the Lottie component 3 | import "./style.css"; // CSS file for styling (adjust styles as needed) 4 | import animationData from "./error.json"; // Import the JSON animation file 5 | 6 | const ErrorMessageConsole = ({ message, color }) => { 7 | const [letterCount, setLetterCount] = useState(1); 8 | const [x, setX] = useState(1); 9 | const [waiting, setWaiting] = useState(false); 10 | const [visible, setVisible] = useState(true); 11 | 12 | useEffect(() => { 13 | const interval1 = setInterval(() => { 14 | if (letterCount === 0 && !waiting) { 15 | setWaiting(true); 16 | setTimeout(() => { 17 | setX(1); 18 | setLetterCount(letterCount + x); 19 | setWaiting(false); 20 | }, 1000); 21 | } else if (letterCount === message.length + 1 && !waiting) { 22 | setWaiting(true); 23 | setTimeout(() => { 24 | setX(-1); 25 | setLetterCount(letterCount + x); 26 | setWaiting(false); 27 | }, 1000); 28 | } else if (!waiting) { 29 | setLetterCount(letterCount + x); 30 | } 31 | }, 120); 32 | 33 | const interval2 = setInterval(() => { 34 | setVisible((prevVisible) => !prevVisible); 35 | }, 400); 36 | 37 | return () => { 38 | clearInterval(interval1); 39 | clearInterval(interval2); 40 | }; 41 | }, [letterCount, waiting, message, x]); 42 | 43 | const textStyle = { 44 | color: color || "tomato", 45 | }; 46 | 47 | const defaultOptions = { 48 | loop: true, 49 | autoplay: true, 50 | animationData: animationData, 51 | rendererSettings: { 52 | preserveAspectRatio: "xMidYMid slice", 53 | }, 54 | }; 55 | 56 | return ( 57 |
58 | 59 | {message.substring(0, letterCount)} 60 |
61 | _ 62 |
63 |
64 | ); 65 | }; 66 | 67 | export default ErrorMessageConsole; 68 | -------------------------------------------------------------------------------- /src/components/error/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/error/error.gif -------------------------------------------------------------------------------- /src/components/error/style.css: -------------------------------------------------------------------------------- 1 | .console-container { 2 | /* font-family: Khula; */ 3 | font-size: 4vh; 4 | text-align: center; 5 | /* height: 200px; */ 6 | /* width: 600px; */ 7 | /* display: block; */ 8 | color: black; 9 | font-family: "Special Elite", sans-serif; 10 | font-optical-sizing: auto; 11 | font-weight: 400; 12 | font-style: normal; 13 | margin: auto; 14 | margin-top: 4vh; 15 | /* text-transform: uppercase; */ 16 | } 17 | 18 | .console-underscore { 19 | display: inline-block; 20 | 21 | left: 10px; 22 | } 23 | 24 | .error-gif { 25 | height: 30vh; 26 | } 27 | -------------------------------------------------------------------------------- /src/components/footer/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/footer/logo.png -------------------------------------------------------------------------------- /src/components/loading/Loading.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "./loading.css"; 3 | 4 | export default function Loading() { 5 | return ( 6 |
7 |
8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /src/components/loading/LoadingComponent.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "./style.css"; 3 | // import "./loading.css"; 4 | 5 | export default function LoadingComponent() { 6 | return ( 7 |
8 |
9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/components/loading/loading.css: -------------------------------------------------------------------------------- 1 | @keyframes shine { 2 | 0% { 3 | background-position: right; 4 | } 5 | 6 | 100% { 7 | background-position: left; 8 | } 9 | } -------------------------------------------------------------------------------- /src/components/loading/style.css: -------------------------------------------------------------------------------- 1 | /* :root { 2 | --nav-height: calc(5vh+1vw); 3 | } 4 | .nav-bar-loading-component { 5 | height: var(--nav-height); 6 | height: 10vh; 7 | background-color: #d9d9d9; 8 | width: 100%; 9 | position: relative; 10 | overflow: hidden; 11 | background: linear-gradient( 12 | 90deg, 13 | #0000 33%, 14 | rgba(255, 255, 255, 0.8) 50%, 15 | #0000 66% 16 | ) 17 | #eaeaea; 18 | background-size: 300% 100%; 19 | animation: shine 1.6s infinite; 20 | border-radius: 0 0 3rem 3rem; 21 | } 22 | 23 | .intro-loading-component-container { 24 | display: flex; 25 | justify-content: center; 26 | } 27 | .intro-loading-component { 28 | width: 65vw; 29 | background-color: #eaeaea; 30 | height: 23vh; 31 | margin: 5vh; 32 | background: linear-gradient( 33 | 90deg, 34 | #0000 33%, 35 | rgba(255, 255, 255, 0.8) 50%, 36 | #0000 66% 37 | ) 38 | #eaeaea; 39 | background-size: 300% 100%; 40 | animation: shine 1.6s infinite; 41 | border-radius: 1.5vw; 42 | } 43 | .progress-bar-loading-component { 44 | width: 30vw; 45 | height: 3vh; 46 | background: linear-gradient( 47 | 90deg, 48 | #0000 33%, 49 | rgba(255, 255, 255, 0.8) 50%, 50 | #0000 66% 51 | ) 52 | #eaeaea; 53 | background-size: 300% 100%; 54 | animation: shine 1.6s infinite; 55 | margin-left: 18vw; 56 | margin-top: 5vh; 57 | border-radius: 15vw; 58 | } 59 | .second-half-left-loading-component-container { 60 | width: 50%; 61 | } 62 | .second-half-loading-component-container { 63 | display: flex; 64 | } 65 | .second-half-right-loading-component-container { 66 | width: 50%; 67 | width:20vw; 68 | } 69 | */ 70 | .problem-component-loading { 71 | height: 15vh; 72 | width: 42vw; 73 | background: linear-gradient(90deg, 74 | #0000 33%, 75 | rgba(255, 255, 255, 0.8) 50%, 76 | #0000 66%) #eaeaea; 77 | background-size: 300% 100%; 78 | animation: shine 2s infinite; 79 | border-radius: 1rem; 80 | margin-top: 2vh; 81 | margin-right: 2vw; 82 | } 83 | 84 | @keyframes shine { 85 | 0% { 86 | background-position: right; 87 | } 88 | } -------------------------------------------------------------------------------- /src/components/loadingPB/LoadingPB.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/loadingPB/LoadingPB.jsx -------------------------------------------------------------------------------- /src/components/loadingPB/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/loadingPB/style.css -------------------------------------------------------------------------------- /src/components/sounds/buttonClick.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/sounds/buttonClick.mp3 -------------------------------------------------------------------------------- /src/components/sounds/card-hover.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/sounds/card-hover.mp3 -------------------------------------------------------------------------------- /src/components/sounds/card_flip.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/sounds/card_flip.mp3 -------------------------------------------------------------------------------- /src/components/sounds/hover_quest.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/sounds/hover_quest.wav -------------------------------------------------------------------------------- /src/components/sounds/loud_btn_clk.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/sounds/loud_btn_clk.wav -------------------------------------------------------------------------------- /src/components/streakpopup/StreakPopup.css: -------------------------------------------------------------------------------- 1 | .streakpopup-container { 2 | margin-top: 10rem; 3 | width: 40dvw; 4 | height: 10dvh; 5 | background-color: #62d8af50; 6 | border-radius: 5rem; 7 | display: flex; 8 | align-items: center; 9 | justify-content: space-between; 10 | box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 11 | } 12 | 13 | .streakpopup-contents { 14 | display: flex; 15 | align-items: center; 16 | width: 100%; 17 | padding: 0 1rem; 18 | } 19 | 20 | .streakpopup-image { 21 | padding: 1.2rem; 22 | margin-top: -1.5rem; 23 | } 24 | 25 | .streakpopup-fire-image { 26 | height: 6rem; 27 | } 28 | 29 | .streakpopup-text { 30 | flex: 1; 31 | text-align: center; 32 | font-size: 1.5rem; 33 | font-weight: bold; 34 | color: #3a3a3a; 35 | } 36 | 37 | .streakpopup-close { 38 | padding: 1rem; 39 | cursor: pointer; 40 | font-size: 1.5rem; 41 | color: #3a3a3a; 42 | } 43 | -------------------------------------------------------------------------------- /src/components/streakpopup/StreakPopup.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import "./StreakPopup.css"; 3 | import fire from "./fire.png"; 4 | 5 | const StreakPopup = () => { 6 | return ( 7 |
8 |
9 |
10 | fire 11 |
12 |
13 |

3 Days in a Row!

14 |
15 |
16 | × 17 |
18 |
19 |
20 | ); 21 | } 22 | 23 | export default StreakPopup; 24 | -------------------------------------------------------------------------------- /src/components/streakpopup/fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/components/streakpopup/fire.png -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Inter:wght@100..900&family=Jost:ital,wght@0,100..900;1,100..900&display=swap"); 2 | 3 | :root { 4 | --green-color: #8ed8be; 5 | --red-color: #F3A8A8; 6 | --yellow-color: #FBEDA6; 7 | --grey-color: rgb(186, 185, 185); 8 | --hovered-green-color: #1c9b6f; 9 | } 10 | 11 | body { 12 | margin: 0; 13 | font-family: "Jost", sans-serif; 14 | } 15 | 16 | code { 17 | font-family: "Jost", sans-serif; 18 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | ); 11 | 12 | // If you want to start measuring performance in your app, pass a function 13 | // to log results (for example: reportWebVitals(console.log)) 14 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 15 | reportWebVitals(); 16 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pages/about/About.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import DeveloperDetails from "./components/developerDetails/DeveloperDetails"; 3 | import HorizontalScroll from "./components/horizontalScroll/HorizontalScroll1"; 4 | import HorizontalScrollReversed from "./components/horizontalScroll/HorizontalScroll2"; 5 | 6 | export default function About() { 7 | return ( 8 |
9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /src/pages/about/components/developerDetails/GVK.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/about/components/developerDetails/GVK.jpg -------------------------------------------------------------------------------- /src/pages/about/components/developerDetails/Mahesh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/about/components/developerDetails/Mahesh.jpg -------------------------------------------------------------------------------- /src/pages/about/components/developerDetails/Me.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/about/components/developerDetails/Me.jpg -------------------------------------------------------------------------------- /src/pages/about/components/developerDetails/Surya.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/about/components/developerDetails/Surya.jpg -------------------------------------------------------------------------------- /src/pages/about/components/horizontalScroll/style.css: -------------------------------------------------------------------------------- 1 | /* @import url("https://fonts.googleapis.com/css2?family=Anta&family=Archivo:ital,wght@0,100..900;1,100..900&family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Cutive&family=Kanit&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Poppins:wght@400;500;700&family=REM:ital,wght@0,100..900;1,100..900&family=Radio+Canada+Big:ital,wght@0,400..700;1,400..700&family=Raleway:ital,wght@0,100..900;1,100..900&family=Special+Elite&display=swap"); */ 2 | 3 | .horizontal-scroll-container { 4 | overflow: hidden; 5 | white-space: nowrap; 6 | position: relative; 7 | width: 100%; 8 | margin-top: 2.5vh; 9 | } 10 | 11 | .horizontal-scroll-content { 12 | display: flex; 13 | white-space: nowrap; 14 | font-size: 1.5rem; 15 | } 16 | 17 | .horizontal-scroll-span-text { 18 | display: inline-block; 19 | padding: 1px 2.2vw; 20 | white-space: nowrap; 21 | font-family: "Poppins", sans-serif; 22 | font-weight: 600; 23 | font-style: normal; 24 | color: #61d8ad; 25 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/15Puzzle/components/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {Link} from "react-router-dom"; 3 | 4 | class Navbar extends Component { 5 | render() { 6 | return ( 7 | 23 | ); 24 | } 25 | } 26 | 27 | export default Navbar; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/15Puzzle/components/puzzle.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import FlipMove from 'react-flip-move'; 3 | import SvgLines from 'react-mt-svg-lines'; 4 | import '../../../helpers/array_helpers'; 5 | import './style.css'; 6 | import { times } from 'lodash'; 7 | import loud_btn from '../../sounds/loud_btn_clk.wav'; 8 | 9 | const FLIP_DURATION = 750; 10 | 11 | class Puzzle extends Component { 12 | 13 | constructor() { 14 | 15 | super(); 16 | this.sound = new Audio(loud_btn); 17 | this.state = { 18 | squares: times(16, i => ({ 19 | value: i 20 | })), 21 | }; 22 | } 23 | 24 | 25 | 26 | balsal = async () => { 27 | this.sound.play(); 28 | for (let i = 0; i < 15; i++) { 29 | this.setState({ 30 | squares: this.state.squares.slice().swap(i, i + 1) 31 | }); 32 | await sleep(500); 33 | } 34 | 35 | } 36 | 37 | render() { 38 | let classNames; 39 | return ( 40 | 41 |
44 |
45 | 49 | {this.state.squares.map((stt) => 50 |
53 | {stt.value === 0 ? "" : stt.value} 54 |
55 | )} 56 |
57 |
58 | 59 |
60 | 61 |
62 | 63 | ); 64 | } 65 | } 66 | 67 | function sleep(ms) { 68 | return new Promise(resolve => setTimeout(resolve, ms)); 69 | } 70 | 71 | export default Puzzle; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/15Puzzle/components/style.css: -------------------------------------------------------------------------------- 1 | .square { 2 | height: 80px; 3 | width: 80px; 4 | margin: 5px; 5 | float: left; 6 | border-radius: 10px; 7 | font-size: 50px; 8 | font-weight: 700; 9 | color: white; 10 | display: flex; 11 | justify-content: center; 12 | align-items: center; 13 | } 14 | 15 | .painted { 16 | background-color: #569E61; 17 | } 18 | 19 | .correct { 20 | background-color: #d79566; 21 | } 22 | 23 | .full-height { 24 | height: 85vh; 25 | display: flex; 26 | flex-direction: column; 27 | justify-content: center; 28 | align-items: center; 29 | } 30 | 31 | .full-height .puzzContainer div { 32 | display: grid; 33 | grid-template-columns: auto auto auto auto; 34 | grid-template-rows: auto auto auto auto; 35 | } 36 | 37 | .full-height button { 38 | font-family: 'poppins'; 39 | width: 7vw; 40 | border: none; 41 | background: #569E61; 42 | color: #ffff; 43 | font-size: 1.3rem; 44 | font-family: "Poppins", sans-serif; 45 | font-weight: 450; 46 | font-style: normal; 47 | padding: 0.3rem 0.6rem; 48 | margin: 0.2rem 0.4rem; 49 | border-radius: 1rem; 50 | cursor: pointer; 51 | transition: 0.5s; 52 | } 53 | 54 | .full-height button:hover { 55 | box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.2); 56 | transition: 0.5s; 57 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/15Puzzle/style.css: -------------------------------------------------------------------------------- 1 | .fitPuzzle { 2 | min-height: 95vh; 3 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/bst.js: -------------------------------------------------------------------------------- 1 | class Node{ 2 | constructor(val) { 3 | this.val = val; 4 | this.left = undefined; 5 | this.right = undefined; 6 | } 7 | } 8 | export class BST{ 9 | constructor() { 10 | this.root = undefined; 11 | } 12 | insert(x){ 13 | this.root = this.insertX(x,this.root); 14 | } 15 | insertX(x,node){ 16 | if( node === undefined ){ 17 | return new Node(x); 18 | return; 19 | } 20 | if( node.value === x ) return node; 21 | else if( node.value > x ) node.left = this.insertX(x,node.left); 22 | else node.right = this.insertX(x,node.right); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/canvasSVG.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Vertex from "./vertex"; 3 | import Cell from "../Turing Machine/cell"; 4 | import Edge from "./edge"; 5 | 6 | class CanvasSvg extends Component { 7 | constructor() { 8 | super(); 9 | this.state = { 10 | pos: { 11 | x: 50, 12 | y: 10 13 | } 14 | } 15 | } 16 | 17 | increamentXY = () => { 18 | let pos = this.state.pos; 19 | pos.x = (pos.x + 50) % 240; 20 | this.setState({ pos }); 21 | } 22 | 23 | render() { 24 | console.log(this.props.vertices.length); 25 | let off = this.props.offset; 26 | return ( 27 |
28 | 29 | { 30 | this.props.edges.map((edge, cellidx) => { 31 | return ( 32 | 41 | ); 42 | })} 43 | } 44 | { 45 | this.props.vertices.map((vertex, cellidx) => { 46 | return ( 47 | 58 | ); 59 | })} 60 | } 61 | 62 | 63 | 64 |
65 | ) 66 | ; 67 | } 68 | } 69 | 70 | export default CanvasSvg; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/details.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class Details extends Component { 4 | 5 | Switcherr = () => { 6 | return ( 7 |
8 |
9 | The Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence 10 | commonly starts from 0 and 1 11 |
12 |
13 | N = Nth fibonacchi Number 14 |
15 |
16 | Fib(0) = 0
17 | Fib(1) = 1
18 | Fib(n) = Fib(n-1) + Fib(n-2) 19 |
20 |
21 | ); 22 | } 23 | 24 | render() { 25 | return ( 26 |
27 | {this.Switcherr()} 28 |
29 | ); 30 | } 31 | } 32 | 33 | export default Details; 34 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/menu.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import SimpleSelect from "./simpleSelect"; 3 | 4 | 5 | class Menu extends Component { 6 | render() { 7 | return ( 8 | 51 | ); 52 | } 53 | isClickable = () => { 54 | if (this.props.disable) { 55 | return { cursor: "not-allowed" }; 56 | } else { 57 | return {}; 58 | } 59 | } 60 | } 61 | 62 | 63 | export default Menu; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {Link} from "react-router-dom"; 3 | 4 | class Navbar extends Component { 5 | render() { 6 | return ( 7 | 23 | ); 24 | } 25 | } 26 | 27 | export default Navbar; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {makeStyles} from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | import Edge from "./edge"; 9 | 10 | const useStyles = makeStyles((theme) => ({ 11 | formControl: { 12 | margin: theme.spacing(1), 13 | minWidth: 120, 14 | }, 15 | selectEmpty: { 16 | marginTop: theme.spacing(2), 17 | }, 18 | })); 19 | 20 | const SimpleSelect = (props) => { 21 | const classes = useStyles(); 22 | const [age, setAge] = React.useState('0'); 23 | const [state, setState] = React.useState({ 24 | pos: props.pos, 25 | }); 26 | const handleChange = (event) => { 27 | console.log(state.pos); 28 | setAge(event.target.value); 29 | props.onValueChanged(state.pos, event.target.value); 30 | }; 31 | // console.log(props.items); 32 | return ( 33 |
34 | 35 | {props.label} 36 | 48 | 49 |
50 | ); 51 | } 52 | 53 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Graph/vertexOriginal.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | 3 | class Vertex extends Component { 4 | 5 | constructor() { 6 | super(); 7 | this.state = { 8 | prevPoss:{ 9 | x:0, 10 | y:0 11 | }, 12 | poss:{ 13 | x:0, 14 | y:0, 15 | xx:0, 16 | yy:0 17 | }, 18 | prevX:0 19 | } 20 | } 21 | 22 | componentDidUpdate(prevProps) { 23 | if (this.state.poss.x !== this.props.pos.x) { 24 | let pp = this.state.poss; 25 | pp.xx = pp.x; 26 | pp.yy = pp.y; 27 | pp.x = this.props.pos.x; 28 | pp.y = this.props.pos.y; 29 | this.setState({poss:pp}); 30 | document.getElementById('vbanim').beginElement(); 31 | } 32 | } 33 | render() { 34 | 35 | return ( 36 | 37 | 43 | {/**/} 49 | 56 | 57 | 62 | {this.props.label} 63 | 64 | 65 | 66 | 67 | 68 | ); 69 | } 70 | } 71 | 72 | function sleep(ms) { 73 | return new Promise(resolve => setTimeout(resolve, ms)); 74 | } 75 | 76 | export default Vertex; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/components/bst.js: -------------------------------------------------------------------------------- 1 | class Node{ 2 | constructor(val) { 3 | this.val = val; 4 | this.left = undefined; 5 | this.right = undefined; 6 | } 7 | } 8 | export class BST{ 9 | constructor() { 10 | this.root = undefined; 11 | } 12 | insert(x){ 13 | this.root = this.insertX(x,this.root); 14 | } 15 | insertX(x,node){ 16 | if( node === undefined ){ 17 | return new Node(x); 18 | return; 19 | } 20 | if( node.value === x ) return node; 21 | else if( node.value > x ) node.left = this.insertX(x,node.left); 22 | else node.right = this.insertX(x,node.right); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/components/menu.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import SimpleSelect from "./simpleSelect"; 3 | 4 | 5 | class Menu extends Component { 6 | render() { 7 | return ( 8 | 41 | ); 42 | } 43 | isClickable = () => { 44 | if (this.props.disable) { 45 | return { cursor: "not-allowed" }; 46 | } else { 47 | return {}; 48 | } 49 | } 50 | } 51 | 52 | 53 | export default Menu; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/components/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Link } from "react-router-dom"; 3 | 4 | class Navbar extends Component { 5 | render() { 6 | return ( 7 | 17 | ); 18 | } 19 | } 20 | 21 | export default Navbar; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/components/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | import Edge from "./edge"; 9 | 10 | const useStyles = makeStyles((theme) => ({ 11 | formControl: { 12 | margin: theme.spacing(1), 13 | minWidth: 120, 14 | }, 15 | selectEmpty: { 16 | marginTop: theme.spacing(2), 17 | }, 18 | })); 19 | 20 | const SimpleSelect = (props) => { 21 | const classes = useStyles(); 22 | const [age, setAge] = React.useState('0'); 23 | const [state, setState] = React.useState({ 24 | pos: props.pos, 25 | }); 26 | const handleChange = (event) => { 27 | console.log(state.pos); 28 | setAge(event.target.value); 29 | props.onValueChanged(state.pos, event.target.value); 30 | }; 31 | // console.log(props.items); 32 | return ( 33 |
34 | 35 | {props.label} 36 | 48 | 49 |
50 | ); 51 | } 52 | 53 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/components/vertexOriginal.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | 3 | class Vertex extends Component { 4 | 5 | constructor() { 6 | super(); 7 | this.state = { 8 | prevPoss:{ 9 | x:0, 10 | y:0 11 | }, 12 | poss:{ 13 | x:0, 14 | y:0, 15 | xx:0, 16 | yy:0 17 | }, 18 | prevX:0 19 | } 20 | } 21 | 22 | componentDidUpdate(prevProps) { 23 | if (this.state.poss.x !== this.props.pos.x) { 24 | let pp = this.state.poss; 25 | pp.xx = pp.x; 26 | pp.yy = pp.y; 27 | pp.x = this.props.pos.x; 28 | pp.y = this.props.pos.y; 29 | this.setState({poss:pp}); 30 | document.getElementById('vbanim').beginElement(); 31 | } 32 | } 33 | render() { 34 | 35 | return ( 36 | 37 | 43 | {/**/} 49 | 56 | 57 | 62 | {this.props.label} 63 | 64 | 65 | 66 | 67 | 68 | ); 69 | } 70 | } 71 | 72 | function sleep(ms) { 73 | return new Promise(resolve => setTimeout(resolve, ms)); 74 | } 75 | 76 | export default Vertex; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Recursion/style.css: -------------------------------------------------------------------------------- 1 | .recursion { 2 | min-height: 150vh; 3 | } 4 | 5 | .recursion .main { 6 | margin-top: 5vh; 7 | min-height: 120vh; 8 | display: flex; 9 | align-items: flex-start; 10 | justify-content: center; 11 | } 12 | 13 | .recursion .graph { 14 | display: flex; 15 | width: 45vw; 16 | justify-content: space-between; 17 | } 18 | 19 | .recursion .info-container div { 20 | font-size: 1.05rem; 21 | width: 20vw; 22 | word-wrap: break-word; 23 | } 24 | 25 | .recursion .graph button { 26 | font-family: 'poppins'; 27 | width: auto; 28 | border: none; 29 | background: #569E61; 30 | color: #ffff; 31 | font-size: 1.05rem; 32 | font-family: "Poppins", sans-serif; 33 | font-weight: 450; 34 | font-style: normal; 35 | padding: 0.4rem 0.6rem; 36 | margin: 0.2rem 0.4rem; 37 | border-radius: 0.8rem; 38 | cursor: pointer; 39 | transition: 0.5s; 40 | } 41 | 42 | .recursion .graph .select { 43 | width: 25vw; 44 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/cell.css: -------------------------------------------------------------------------------- 1 | .turing-cell{ 2 | height:50px; 3 | width:50px; 4 | background-color: white; 5 | outline:1px solid rgb(175, 216, 248); 6 | display: inline-block; 7 | font-size: 25px; 8 | text-align: center; 9 | color: black; 10 | /*border-radius: 5px 20px;*/ 11 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/cell.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import './cell.css'; 3 | class Cell extends Component { 4 | render() { 5 | return ( 6 |
7 | {this.props.val} 8 |
9 | ); 10 | } 11 | } 12 | 13 | export default Cell; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/menu.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import DiscreteSlider from "./slider"; 3 | import SimpleSelect from "./simpleSelect"; 4 | 5 | 6 | class Menu extends Component { 7 | render() { 8 | return ( 9 | 56 | ); 57 | } 58 | isClickable = () => 59 | { 60 | if (this.props.disable) { 61 | return {cursor: "not-allowed"}; 62 | } else { 63 | return {}; 64 | } 65 | } 66 | } 67 | 68 | 69 | export default Menu; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {Link} from "react-router-dom"; 3 | 4 | class Navbar extends Component { 5 | render() { 6 | return ( 7 | 23 | ); 24 | } 25 | } 26 | 27 | export default Navbar; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/ribbon.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Cell from "./cell"; 3 | import FlipMove from 'react-flip-move'; 4 | 5 | class Ribbon extends Component { 6 | render() { 7 | // console.log('this.props'); 8 | // console.log(this.props); 9 | return ( 10 |
11 | 13 | 15 | 16 | 21 | {this.props.strip 22 | .filter(cell => cell.id >= this.props.cellStart && cell.id <= this.props.cellEnd) 23 | .map((cell, cellidx) => { 24 | return ( 25 | 30 | ); 31 | })} 32 | 33 | 35 | 37 | 38 |
39 | ); 40 | } 41 | } 42 | 43 | export default Ribbon; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | 9 | const useStyles = makeStyles((theme) => ({ 10 | formControl: { 11 | margin: theme.spacing(1), 12 | minWidth: 120, 13 | }, 14 | selectEmpty: { 15 | marginTop: theme.spacing(2), 16 | }, 17 | })); 18 | 19 | const SimpleSelect = (props) => { 20 | const classes = useStyles(); 21 | const [age, setAge] = React.useState('0'); 22 | const [state, setState] = React.useState({ 23 | pos: props.pos, 24 | }); 25 | const handleChange = (event) => { 26 | console.log(state.pos); 27 | setAge(event.target.value); 28 | props.onAlgoChanged(state.pos,event.target.value); 29 | }; 30 | 31 | return ( 32 |
33 | 34 | Task 35 | 47 | 48 |
49 | ); 50 | } 51 | 52 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/slider.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import Typography from '@material-ui/core/Typography'; 4 | import Slider from '@material-ui/core/Slider'; 5 | 6 | const useStyles = makeStyles({ 7 | root: { 8 | width: 200, 9 | }, 10 | }); 11 | 12 | function valuetext(value) { 13 | return `${value}`; 14 | } 15 | 16 | 17 | export default function DiscreteSlider(props) { 18 | const classes = useStyles(); 19 | const handleChange = (event) =>{ 20 | if( event.target.innerText === "" ){ 21 | return; 22 | } 23 | const num = parseInt(event.target.innerText,10); 24 | props.onCountChange(num); 25 | } 26 | return ( 27 |
28 | 29 | 42 | 43 | {props.title} 44 | 45 |
46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/Turing Machine/table.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Rect from "../recursiveSortComponents/rect"; 3 | 4 | class Table extends Component { 5 | render() { 6 | console.log(this.props.data) 7 | return ( 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | {this.props.data.map( (row,rowidx)=>{ 21 | return ( 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ); 30 | } )} 31 | {/**/} 32 | {/* */} 33 | {/* */} 34 | {/* */} 35 | {/* */} 36 | {/**/} 37 | {/**/} 38 | {/* */} 39 | {/* */} 40 | {/* */} 41 | {/* */} 42 | {/**/} 43 | {/**/} 44 | {/* */} 45 | {/* */} 46 | {/* */} 47 | {/**/} 48 | 49 |
StateInputNextOutputDirection
{row[0]}{row[1]}{row[2]}{row[3]}{row[4]}
1MarkOtto@mdo
2JacobThornton@fat
3Larry the Bird@twitter
50 |
51 | ); 52 | } 53 | } 54 | 55 | export default Table; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/bfs.jsx: -------------------------------------------------------------------------------- 1 | export function bfsdfs(grid,startNode,endNode,algo){ 2 | var list = []; 3 | const nodesInOrder = []; 4 | nodesInOrder.push(startNode); 5 | list.push(startNode); 6 | startNode.isVisited = true; 7 | while(!!list.length){ 8 | const currentNode = (algo === "bfs" ? list.shift():list.pop()); 9 | nodesInOrder.push(currentNode); 10 | if( currentNode === endNode ) return nodesInOrder; 11 | if( algo === "dfs" ) currentNode.isVisited = true; 12 | const nodesToPush = getNeighbours(grid,currentNode); 13 | for( const node of nodesToPush ){ 14 | if(algo === "bfs"){ 15 | node.isVisited = true; 16 | } 17 | node.previousNode = currentNode; 18 | list.push(node); 19 | 20 | } 21 | } 22 | return nodesInOrder; 23 | } 24 | 25 | function getNeighbours(grid,node){ 26 | const neighbors = []; 27 | const {col, row} = node; 28 | // console.log(node); 29 | 30 | if (col > 0) neighbors.push(grid[row][col - 1]); 31 | if (row > 0) neighbors.push(grid[row - 1][col]); 32 | if (row < grid.length - 1) neighbors.push(grid[row + 1][col]); 33 | if (col < grid[0].length - 1) neighbors.push(grid[row][col + 1]); 34 | return neighbors.filter(neighbor => (!neighbor.isVisited && !neighbor.isWall )); 35 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/grahamScan.js: -------------------------------------------------------------------------------- 1 | export function convex_hull(points){ 2 | if( points.size === 1 ){ 3 | return; 4 | } 5 | const pointStart = points[0]; 6 | const pointEnd = points[ points.length-1 ]; 7 | const up = [], down = []; 8 | const pairs = []; 9 | const lines=[]; 10 | up.push( pointStart); 11 | down.push(pointStart); 12 | for( let i = 1; i< points.length ;i++ ){ 13 | if( (i === (points.length - 1)) || cw( pointStart,points[i],pointEnd ) ){ 14 | while( up.length >=2 && !cw(up[up.length-2],up[up.length-1],points[i] ) ){ 15 | lines.push({ 16 | from:up[up.length-2], 17 | to:up[up.length-1], 18 | add:false 19 | }); 20 | up.pop(); 21 | } 22 | up.push( points[i] ); 23 | lines.push({ 24 | from:up[up.length-2], 25 | to:up[up.length-1], 26 | add:true 27 | }) 28 | } 29 | 30 | } 31 | for(let i = 0; i< points.length;i++){ 32 | if( (i === (points.length - 1)) || ccw( pointStart,points[i],pointEnd ) ){ 33 | while( down.length >=2 && !ccw(down[down.length-2],down[down.length-1],points[i] ) ){ 34 | lines.push({ 35 | from:down[down.length-2], 36 | to:down[down.length-1], 37 | add:false 38 | }); 39 | down.pop(); 40 | } 41 | down.push( points[i] ); 42 | lines.push({ 43 | from:down[down.length-2], 44 | to:down[down.length-1], 45 | add:true 46 | }) 47 | } 48 | } 49 | 50 | for (let i = 0; i < up.length; i++){ 51 | pairs.push(up[i]); 52 | } 53 | for (let i = down.length - 2; i > 0; i--) { 54 | pairs.push(down[i]); 55 | } 56 | return [pairs,lines]; 57 | } 58 | 59 | function cw(a, b, c) { 60 | const f = a.xx*(b.yy-c.yy)+b.xx*(c.yy-a.yy)+c.xx*(a.yy-b.yy); 61 | if( a.xx*(b.yy-c.yy)+b.xx*(c.yy-a.yy)+c.xx*(a.yy-b.yy) < 0 ){ 62 | return true; 63 | } else{ 64 | return false; 65 | } 66 | 67 | } 68 | 69 | function ccw(a, b, c){ 70 | if( a.xx * (b.yy - c.yy) + b.xx * (c.yy - a.yy) + c.xx * (a.yy - b.yy) > 0 ){ 71 | return true; 72 | } else { 73 | return false; 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/heapSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | export default function HeapSort(rects2){ 3 | let rects = rects2.slice(); 4 | values = []; 5 | let sz = rects2.length; 6 | // sz = sz-1; 7 | heapSort(rects,sz); 8 | return values; 9 | } 10 | function heapify(rects,n,i){ 11 | let largest = i; // Initialize largest as root 12 | let l = 2 * i + 1; // left = 2*i + 1 13 | let r = 2 * i + 2; // right = 2*i + 2 14 | 15 | // If left child is larger than root 16 | if (l < n && rects[l].width > rects[largest].width) 17 | largest = l; 18 | 19 | // If right child is larger than largest so far 20 | if (r < n && rects[r].width > rects[largest].width) 21 | largest = r; 22 | 23 | // If largest is not root 24 | if (largest != i) { 25 | let temp = rects[i]; 26 | rects[i] = rects[largest]; 27 | rects[largest] = temp; 28 | let value = { 29 | left:i, 30 | right:largest, 31 | sorted: false 32 | } 33 | values.push(value); 34 | // Recursively heapify the affected sub-tree 35 | heapify(rects, n, largest); 36 | } 37 | } 38 | function heapSort(rects,n){ 39 | for(let i = Math.floor(n/2)-1;i>=0;i--){ 40 | // console.log("heap ",n," ",i); 41 | heapify(rects,n,i); 42 | } 43 | for (let i = n-1 ; i > 0; i--) { 44 | // Move current root to end 45 | let temp = rects[i]; 46 | rects[i] = rects[0]; 47 | rects[0] = temp; 48 | let value = { 49 | left:i, 50 | right:0, 51 | sorted:true 52 | } 53 | values.push(value); 54 | // call max heapify on the reduced heap 55 | heapify(rects, i, 0); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/mergeSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | export default function mergeSort(rects2){ 3 | let rects = rects2.slice(); 4 | values = []; 5 | let sz = rects2.length; 6 | // console.log( "fdsfsd",sz ); 7 | sz = sz-1; 8 | mergeS(rects,0,sz); 9 | return values; 10 | } 11 | 12 | function merge(rects, l, m, r){ 13 | // console.log(l," ",r); 14 | let n1 = m-l+1; 15 | let n2 = r-m; 16 | 17 | const L = rects.slice(l, m+1); 18 | const R = rects.slice(m+1,r+1); 19 | let i = 0; 20 | let j = 0; 21 | let k = l; 22 | while(i=r ) return; 48 | let m = l+ (r-l)/2; 49 | m = Math.floor(m); 50 | // console.log("iiiiiiiiiiiiiiiiiiiiiiiii ",m); 51 | mergeS(rects,l,m); 52 | mergeS(rects,m+1,r); 53 | merge(rects,l,m,r); 54 | let rectsCopy = rects.slice(l,r+1); 55 | let value = { 56 | left:l, 57 | right:r, 58 | mid:m, 59 | val:rectsCopy 60 | } 61 | values.push(value); 62 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/prime.js: -------------------------------------------------------------------------------- 1 | export function seive(n){ 2 | let vis = new Array(n+5).fill(0); 3 | 4 | let primes = []; 5 | for(let p = 2;p<=n;p++){ 6 | if( vis[p] === 0 ){ 7 | primes.push(p); 8 | for(let q = p*p;q<=n;q+=p) 9 | vis[q] = 1; 10 | } 11 | } 12 | return primes; 13 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/quickSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | 3 | export function quickSort(rects2){ 4 | let rects = rects2.slice(); 5 | values = []; 6 | let sz = rects2.length; 7 | // console.log( "fdsfsd",sz ); 8 | sz = sz-1; 9 | quick(rects,0,sz); 10 | for(var i=0;i<=sz;i++){ 11 | values.push({ 12 | xx:i, 13 | yy:i, 14 | changed:true 15 | }) 16 | } 17 | return values; 18 | } 19 | 20 | 21 | function getPartition(rects, left, right){ 22 | let pivot = rects[right].width 23 | let it = left-1; 24 | for(var j=left;j<=right-1;j++){ 25 | if( rects[j].width< pivot){ 26 | it++; 27 | if( it!==j ){ 28 | // swap(rects[it],rects[j]; 29 | const rect1 = {...rects[it]}; 30 | const rect2 = {...rects[j]}; 31 | rects[it] = rect2; 32 | rects[j] = rect1; 33 | values.push({ 34 | xx:it, 35 | yy:j, 36 | changed:true 37 | }) 38 | } 39 | } 40 | } 41 | if( it+1!==right ){ 42 | const rect1 = {...rects[it+1]}; 43 | const rect2 = {...rects[right]}; 44 | rects[it+1] = rect2; 45 | rects[right] = rect1; 46 | values.push({ 47 | xx:it+1, 48 | yy:right, 49 | changed:true 50 | }) 51 | } 52 | return it+1; 53 | } 54 | function quick(rects,left,right){ 55 | if( left>=right ) return ; 56 | const partition = getPartition(rects,left,right); 57 | quick(rects,left,partition-1); 58 | quick(rects,partition+1,right); 59 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/quickSortRecursive.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | 3 | export function quickSortRecursive(rects2){ 4 | let rects = rects2.slice(); 5 | values = []; 6 | let sz = rects2.length; 7 | // console.log( "fdsfsd",sz ); 8 | sz = sz-1; 9 | quick(rects,0,sz); 10 | return values; 11 | } 12 | 13 | 14 | function getPartition(rects, left, right){ 15 | values.push({ 16 | left, 17 | right, 18 | swap:false, 19 | changedRange:true, 20 | }) 21 | let pivot = rects[right].width 22 | let it = left-1; 23 | for(var j=left;j<=right-1;j++){ 24 | if( rects[j].width< pivot){ 25 | it++; 26 | if( it!==j ){ 27 | // swap(rects[it],rects[j]; 28 | const rect1 = {...rects[it]}; 29 | const rect2 = {...rects[j]}; 30 | rects[it] = rect2; 31 | rects[j] = rect1; 32 | values.push({ 33 | left:it, 34 | right:j, 35 | swap:true, 36 | changedRange:false, 37 | }) 38 | } 39 | } 40 | } 41 | if( it+1!==right ){ 42 | const rect1 = {...rects[it+1]}; 43 | const rect2 = {...rects[right]}; 44 | rects[it+1] = rect2; 45 | rects[right] = rect1; 46 | values.push({ 47 | left:it+1, 48 | right:right, 49 | swap:true, 50 | changedRange:false, 51 | }) 52 | } 53 | return it+1; 54 | } 55 | function quick(rects,left,right){ 56 | if( left>=right ) return ; 57 | const partition = getPartition(rects,left,right); 58 | quick(rects,left,partition-1); 59 | quick(rects,partition+1,right); 60 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/algorithms/randomMaze.js: -------------------------------------------------------------------------------- 1 | export function randomMaze(board,row,col){ 2 | let newBoard = board.slice(); 3 | const pairs = []; 4 | for(let i = 0;i { 6 | const [play] = useSound(loud_btn); 7 | 8 | React.useEffect(() => { 9 | if (soundCallback) { 10 | soundCallback(play); 11 | } 12 | }, [soundCallback, play]); 13 | 14 | return null; 15 | }; 16 | 17 | export default PlaySound; 18 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/UpperRangeDialog.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class UpperRangeDialog extends Component { 4 | render() { 5 | return ( 6 |
7 |
8 |

Please enter the upper range.

9 | 10 |
11 |
12 | ); 13 | } 14 | } 15 | 16 | export default UpperRangeDialog; 17 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/WarningBox.jsx: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | import loud_btn from '../../sounds/loud_btn_clk.wav'; 4 | 5 | function WarningBox({ onClose }) { 6 | const sound = new Audio(loud_btn); 7 | 8 | return ( 9 | <> 10 |
11 |
12 |
13 |

Please enter a valid Number🥲🥹 , mate!!🤩

14 | 15 |
16 |
17 | 18 | ); 19 | } 20 | 21 | export default WarningBox; 22 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/binarySearch.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import EntryPoint from "./entryPoint"; 3 | import Search from "./search"; 4 | 5 | class BinarySearch extends Component { 6 | constructor(props) { 7 | super(props); 8 | this.inputRef = null; 9 | } 10 | 11 | state = { 12 | upper: 100, 13 | lower: 0, 14 | max: 100, 15 | isRunning: false 16 | } 17 | 18 | setInputRef = (ref) => { 19 | this.inputRef = ref; 20 | } 21 | 22 | render() { 23 | return ( 24 |
25 |
26 | {!this.state.isRunning && 27 | } 33 | {this.state.isRunning && 34 | 42 | } 43 |
44 |
45 | ); 46 | } 47 | 48 | handleStartGame = () => { 49 | this.setState({ isRunning: true }); 50 | } 51 | 52 | handleRestart = () => { 53 | this.setState({ isRunning: false, upper: 100, lower: 0 }); 54 | } 55 | 56 | handleYes = () => { 57 | const mid = Math.floor((this.state.upper + this.state.lower) / 2); 58 | this.setState({ lower: mid + 1 }); 59 | } 60 | 61 | handleNo = () => { 62 | const mid = Math.floor((this.state.upper + this.state.lower) / 2); 63 | this.setState({ upper: mid }); 64 | } 65 | 66 | handleSetUpper = (up) => { 67 | let val = parseInt(up); 68 | if (val <= 0) { 69 | val = 100; 70 | } 71 | this.setState({ upper: val, max: val }); 72 | } 73 | } 74 | 75 | export default BinarySearch; 76 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/doubleSlider.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { makeStyles, withStyles } from '@material-ui/core/styles'; 3 | import Slider from '@material-ui/core/Slider'; 4 | 5 | const useStyles = makeStyles({ 6 | root: { 7 | width: 400, 8 | }, 9 | }); 10 | 11 | 12 | const CSlider = withStyles({ 13 | root: { 14 | // color: "#ffffff", 15 | height: 3, 16 | width: 400, 17 | padding: "13px 0", 18 | }, 19 | track: { 20 | height: 4, 21 | borderRadius: 2, 22 | }, 23 | thumb: { 24 | backgroundColor: "#fff", 25 | //color: "#fff", 26 | }, 27 | })(Slider); 28 | 29 | function valuetext(value) { 30 | return `${value}`; 31 | } 32 | 33 | 34 | 35 | export default function RangeSlider(props) { 36 | const classes = useStyles(); 37 | const [value, setValue] = React.useState([props.lower, props.upper]); 38 | 39 | const handleChange = (event, newValue) => { 40 | setValue(newValue); 41 | 42 | }; 43 | const handleCommit = (event, newValue) => { 44 | console.log(newValue); 45 | }; 46 | useEffect(() => { 47 | setValue([props.lower, props.upper]); 48 | }, [props.lower, props.upper]) 49 | return ( 50 |
51 |
52 | 63 |
64 | 65 | ); 66 | } 67 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/guess.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import RangeSlider from "./doubleSlider"; 3 | import PlaySound from './PlaySound'; // adjust the import path as needed 4 | 5 | class Guess extends Component { 6 | playSound = null; 7 | 8 | setPlaySoundCallback = (play) => { 9 | this.playSound = play; 10 | }; 11 | 12 | render() { 13 | return ( 14 |
15 |
16 |
17 |
18 | 23 |
24 |
25 |
26 | 27 |

28 | Is your number greater than {this.getMid()}? 29 |

30 |
31 | 37 | 43 |
44 | 45 |
46 | ); 47 | } 48 | 49 | getMid = () => { 50 | const mid = Math.floor((this.props.upper + this.props.lower) / 2); 51 | return mid; 52 | } 53 | 54 | handleYesClick = () => { 55 | if (this.playSound) { 56 | this.playSound(); 57 | } 58 | this.props.yesButton(); 59 | } 60 | 61 | handleNoClick = () => { 62 | if (this.playSound) { 63 | this.playSound(); 64 | } 65 | this.props.noButton(); 66 | } 67 | } 68 | 69 | export default Guess; 70 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/result.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import loud_btn from '../../sounds/hover_quest.wav'; 3 | 4 | const Result = (props) => { 5 | const [sound] = useState(new Audio(loud_btn)); 6 | const handleRestart = () => { 7 | sound.play(); 8 | props.onRestart(); 9 | }; 10 | 11 | return ( 12 |
13 | 14 | Your number is {props.res} 15 |
16 | 22 |
23 | ); 24 | }; 25 | 26 | export default Result; 27 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/search.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Guess from "./guess"; 3 | import Result from "./result"; 4 | 5 | class Search extends Component { 6 | render() { 7 | return ( 8 |
9 | {this.props.upper !== this.props.lower && 10 | 17 | } 18 | {this.props.upper === this.props.lower && 19 | 23 | } 24 |
25 | ); 26 | } 27 | 28 | } 29 | 30 | export default Search; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/binarySearch/Components/textField.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | class TextFields extends Component { 3 | state = { 4 | error: false 5 | } 6 | render() { 7 | return ( 8 |
9 |
10 | 14 | 15 |
16 |
17 | ); 18 | } 19 | 20 | } 21 | 22 | export default TextFields; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/comingSoon/ComingSoon.jsx: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import React, { useState, useEffect } from 'react'; 3 | import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; 4 | 5 | function ComingSoon() { 6 | 7 | return ( 8 | <> 9 |
10 |
11 |

Coming Soon...

12 |
13 |
14 | 15 | ); 16 | } 17 | 18 | export default ComingSoon; 19 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/comingSoon/style.css: -------------------------------------------------------------------------------- 1 | .comingSoon { 2 | height: 90vh; 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | } 7 | 8 | .comingSoon p { 9 | font-size: 2rem; 10 | font-weight: 550; 11 | color: var(--hovered-green-color); 12 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/3DCardDemo.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import Image from "next/image"; 4 | import React from "react"; 5 | import { CardBody, CardContainer, CardItem } from "../ui/3d-card"; 6 | import Link from "next/link"; 7 | 8 | export function ThreeDCardDemo() { 9 | return ( 10 | 11 | 12 | 16 | Make things float in air 17 | 18 | 23 | Hover over this card to unleash the power of CSS perspective 24 | 25 | 26 | thumbnail 33 | 34 |
35 | 42 | Try now → 43 | 44 | 49 | Sign up 50 | 51 |
52 |
53 |
54 | ); 55 | } 56 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/Body.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import data from './data'; 3 | import Component from './Component'; 4 | 5 | function Body({ searchQuery }) { 6 | const filteredData = searchQuery 7 | ? data.filter(item => 8 | Object.keys(item)[0].toLowerCase().startsWith(searchQuery.toLowerCase()) 9 | ) 10 | : data; 11 | 12 | return ( 13 |
14 |
15 | {filteredData.map((item, index) => ( 16 | 17 | ))} 18 |
19 |
20 | ); 21 | } 22 | export default Body; 23 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/Component.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useNavigate } from 'react-router-dom'; 3 | import useSound from 'use-sound'; 4 | import loud_btn from '../../sounds/loud_btn_clk.wav'; 5 | 6 | function Component({ name, image }) { 7 | const navigate = useNavigate(); 8 | const [play] = useSound(loud_btn); 9 | const handleClick = () => { 10 | play(); 11 | const route = name.toLowerCase().replace(/\s+/g, ''); 12 | navigate(`/algoVisualiser/comingSoon`); 13 | }; 14 | 15 | return ( 16 |
17 | {name} 18 |
19 |

{name}

20 |
21 | ); 22 | } 23 | 24 | export default Component; 25 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/SearchLinks.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import loud_btn from '../../sounds/buttonClick.mp3'; 4 | 5 | function SearchLinks({ searchQuery, onSearchChange }) { 6 | const sound = new Audio(loud_btn); 7 | 8 | const handleClick = (event, url) => { 9 | event.preventDefault(); 10 | 11 | sound.play(); 12 | sound.onended = () => { 13 | window.location.href = url; 14 | }; 15 | }; 16 | 17 | return ( 18 |
19 |
handleClick(event, 'https://gvk-skill-2040.vercel.app/')}> 20 | skill2040 21 |
22 |
23 | 24 | 30 |
31 |
handleClick(event, 'https://dsa-tracker-website.vercel.app/')}> 32 | DSATracker 33 |
34 |
35 | ); 36 | } 37 | 38 | export default SearchLinks; 39 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/TypingEffect.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | const TypingEffect = ({ data, typingSpeed = 200, erasingSpeed = 200, delay = 400 }) => { 4 | const [displayText, setDisplayText] = useState(''); 5 | const [isTyping, setIsTyping] = useState(true); 6 | const [index, setIndex] = useState(0); 7 | const [charIndex, setCharIndex] = useState(0); 8 | 9 | const algorithmNames = data.map(item => Object.keys(item)[0]); 10 | 11 | useEffect(() => { 12 | let timeout; 13 | 14 | if (isTyping) { 15 | if (charIndex < algorithmNames[index].length) { 16 | timeout = setTimeout(() => { 17 | setDisplayText(prev => prev + algorithmNames[index][charIndex]); 18 | setCharIndex(charIndex + 1); 19 | }, typingSpeed); 20 | } else { 21 | timeout = setTimeout(() => { 22 | setIsTyping(false); 23 | }, delay); 24 | } 25 | } else { 26 | if (charIndex > 0) { 27 | timeout = setTimeout(() => { 28 | setDisplayText(prev => prev.slice(0, -1)); 29 | setCharIndex(charIndex - 1); 30 | }, erasingSpeed); 31 | } else { 32 | setIndex((index + 1) % algorithmNames.length); 33 | setIsTyping(true); 34 | setDisplayText(''); 35 | } 36 | } 37 | 38 | return () => clearTimeout(timeout); 39 | }, [charIndex, isTyping, algorithmNames, index, typingSpeed, erasingSpeed, delay]); 40 | 41 | return {displayText}; 42 | }; 43 | 44 | export default TypingEffect; 45 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/data.js: -------------------------------------------------------------------------------- 1 | const data = [ 2 | { "N Queens": "/images/algos/nQueens.png" }, 3 | { "Recursion": "/images/algos/rt.png" }, 4 | { "Binary Search": "/images/algos/bs.png" }, 5 | { "Sorting": "/images/algos/sorting.png" }, 6 | { "Path Finding": "/images/algos/bs.png" }, 7 | { "Recursive Sorting": "/images/algos/recursiveSort.png" }, 8 | { "15 Puzzle": "/images/algos/15puzz.png" }, 9 | ] 10 | 11 | export default data; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/components/data2.js: -------------------------------------------------------------------------------- 1 | const data = [ 2 | { "Visualize algorithms for
better understanding": "/images/algos/nQueens.png" }, 3 | { "Recursion": "/images/algos/rt.png" }, 4 | { "Binary Search": "/images/algos/bs.png" }, 5 | { "Prime Numbers": "/images/algos/primeNums.png" }, 6 | { "Sorting": "/images/algos/sorting.png" }, 7 | { "Path Finding": "/images/algos/bs.png" }, 8 | { "Recursive Sorting": "/images/algos/recursiveSort.png" }, 9 | { "15 Puzzle": "/images/algos/15puzz.png" }, 10 | ] 11 | 12 | export default data; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/home/darktheme.css: -------------------------------------------------------------------------------- 1 | .dark { 2 | background: #3C403D; 3 | opacity: 0.9; 4 | } 5 | 6 | .dark .intro { 7 | border-radius: 2px dashed #fff; 8 | } 9 | 10 | .dark .algos .component:hover { 11 | box-shadow: 3px 3px 5px rgba(255, 255, 255, 0.6); 12 | } 13 | 14 | .dark .algos .component div { 15 | background: #fff; 16 | color: #000; 17 | opacity: 1; 18 | } 19 | 20 | .dark .intro .showcase { 21 | color: #fff; 22 | 23 | } 24 | 25 | .dark .dropdown-toggle { 26 | background: #fff; 27 | } 28 | 29 | .dark .intro .topicsShowcase { 30 | font-size: 1.3rem; 31 | color: #fff; 32 | font-size: 1.55rem; 33 | } 34 | 35 | .dark .intro { 36 | border-bottom: 2px dashed #fff; 37 | } 38 | 39 | .dark .searchLinks a { 40 | color: #8679DB; 41 | } 42 | 43 | .dark .searchLinks .searchBox { 44 | border: 2px solid #569E61; 45 | color: #000; 46 | background: #fff; 47 | } 48 | 49 | 50 | .dark .searchLinks input, 51 | .dark .searchLinks input::placeholder { 52 | color: #569E61; 53 | background: #fff; 54 | border: #569E61; 55 | } 56 | 57 | .dark .searchLinks i { 58 | color: #569E61; 59 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/cell.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import './style.css' 3 | import queen from './queen.png'; 4 | class Cell extends Component { 5 | render() { 6 | return ( 7 |
8 | {this.props.cell.isPresent && } 9 |
10 | ); 11 | } 12 | getClassName = () => { 13 | if (this.props.cell.isAttacked) { 14 | return "boardCell attacked"; 15 | } else if (this.props.cell.isCurrent) { 16 | return "boardCell current"; 17 | } else if (this.props.cell.isPresent) { 18 | return "boardCell present"; 19 | } else if (this.props.cell.isChecked) { 20 | return "boardCell checked"; 21 | } else { 22 | return "boardCell"; 23 | } 24 | } 25 | getStyled = () => { 26 | if ((this.props.cell.row + this.props.cell.col) % 2 === 0) { 27 | return { 28 | backgroundColor: "white" 29 | } 30 | } else { 31 | return { 32 | backgroundColor: "#569E61" 33 | } 34 | } 35 | } 36 | } 37 | 38 | export default Cell; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/cells.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Cell from "./cell"; 3 | import './style.css'; 4 | class Cells extends Component { 5 | render() { 6 | return ( 7 |
8 | {this.props.board.map((row, rowidx) => { 9 | return ( 10 |
11 | {row.map((cell, cellidx) => { 12 | return ( 13 | 16 | ); 17 | })} 18 |
19 | ); 20 | })} 21 |
22 | ); 23 | } 24 | } 25 | 26 | export default Cells; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/doubleSlider.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {makeStyles, withStyles} from '@material-ui/core/styles'; 3 | import Typography from '@material-ui/core/Typography'; 4 | import Slider from '@material-ui/core/Slider'; 5 | 6 | const useStyles = makeStyles({ 7 | root: { 8 | width: 200, 9 | }, 10 | }); 11 | 12 | 13 | const CSlider = withStyles({ 14 | root: { 15 | // color: "#ffffff", 16 | height: 3, 17 | padding: "13px 0", 18 | }, 19 | track: { 20 | height: 4, 21 | borderRadius: 2, 22 | }, 23 | thumb: { 24 | backgroundColor: "#fff", 25 | //color: "#fff", 26 | }, 27 | })(Slider); 28 | 29 | function valuetext(value) { 30 | return `${value}`; 31 | } 32 | 33 | 34 | 35 | export default function RangeSlider(props) { 36 | const classes = useStyles(); 37 | const [value, setValue] = React.useState([20, 37]); 38 | 39 | const handleChange = (event, newValue) => { 40 | setValue(newValue); 41 | 42 | }; 43 | const handleCommit = (event, newValue) => { 44 | console.log(newValue); 45 | }; 46 | 47 | return ( 48 |
49 | 59 | 60 | Value range 61 | 62 |
63 | ); 64 | } 65 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/formControlLabel.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import FormGroup from '@material-ui/core/FormGroup'; 3 | import FormControlLabel from '@material-ui/core/FormControlLabel'; 4 | import Switch from '@material-ui/core/Switch'; 5 | 6 | export default function SwitchLabels(props) { 7 | const [state, setState] = React.useState({ 8 | checkedA: false, 9 | }); 10 | 11 | const handleChange = (event) => { 12 | setState({ ...state, [event.target.name]: event.target.checked }); 13 | props.onDoubleChange(event.target.checked); 14 | }; 15 | 16 | return ( 17 | 18 | } 20 | label="Duo" 21 | disabled={props.disable} 22 | /> 23 | 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/menu.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import DiscreteSlider from "./slider"; 3 | 4 | class Menu extends Component { 5 | render() { 6 | return ( 7 | 45 | ); 46 | } 47 | isClickable = () => { 48 | if (this.props.disable) { 49 | return { cursor: "not-allowed" }; 50 | } else { 51 | return {}; 52 | } 53 | } 54 | } 55 | 56 | 57 | export default Menu; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/queen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/nQueens/components/queen.jpg -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/queen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/nQueens/components/queen.png -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | 9 | const useStyles = makeStyles((theme) => ({ 10 | formControl: { 11 | margin: theme.spacing(1), 12 | minWidth: 120, 13 | }, 14 | selectEmpty: { 15 | marginTop: theme.spacing(2), 16 | }, 17 | })); 18 | 19 | const SimpleSelect = (props) => { 20 | const classes = useStyles(); 21 | const [age, setAge] = React.useState('0'); 22 | const [state, setState] = React.useState({ 23 | pos: props.pos, 24 | }); 25 | const handleChange = (event) => { 26 | console.log(state.pos); 27 | setAge(event.target.value); 28 | props.onAlgoChanged(state.pos, event.target.value); 29 | }; 30 | 31 | return ( 32 |
33 | 34 | Algorithm 35 | 45 | 46 |
47 | ); 48 | } 49 | 50 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/slider.jsx: -------------------------------------------------------------------------------- 1 | import React, { useRef } from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import Slider from '@material-ui/core/Slider'; 4 | 5 | const useStyles = makeStyles({ 6 | root: { 7 | width: 200, 8 | }, 9 | }); 10 | 11 | function valuetext(value) { 12 | return `${value}`; 13 | } 14 | 15 | export default function DiscreteSlider(props) { 16 | const classes = useStyles(); 17 | const sliderRef = useRef(); 18 | 19 | const handleChange = (event, value) => { 20 | props.onCountChange(value); 21 | }; 22 | 23 | return ( 24 |
25 | 37 |

{props.title}

38 | 39 |
40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/components/style.css: -------------------------------------------------------------------------------- 1 | .boardCell { 2 | width: 90px; 3 | height: 90px; 4 | outline: 2px solid #607d8b; 5 | display: inline-flex; 6 | } 7 | 8 | .checked { 9 | background-image: radial-gradient(circle, #b3e5fc, #29b6f6); 10 | } 11 | 12 | .attacked { 13 | background-image: radial-gradient(circle, #ef9a9a, darkred); 14 | } 15 | 16 | .current { 17 | background-image: radial-gradient(circle, #fff176, #f57f17); 18 | } 19 | 20 | .present { 21 | background-image: radial-gradient(circle, #dce775, #43a047); 22 | } 23 | 24 | .booard { 25 | font-size: 0; 26 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/nQueens/style.css: -------------------------------------------------------------------------------- 1 | .nQueens { 2 | min-height: 120vh; 3 | } 4 | 5 | .nQueens button { 6 | font-family: 'poppins'; 7 | width: auto; 8 | border: none; 9 | background: #569E61; 10 | color: #ffff; 11 | font-size: 1.3rem; 12 | font-family: "Poppins", sans-serif; 13 | font-weight: 450; 14 | font-style: normal; 15 | padding: 0.1rem 0.6rem; 16 | margin: 0.2rem 0.4rem; 17 | border-radius: 1rem; 18 | cursor: pointer; 19 | transition: 0.5s; 20 | height: 5vh; 21 | margin: 0 2vw; 22 | } 23 | 24 | .nQueens button:hover { 25 | box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.2); 26 | transition: 0.5s; 27 | } 28 | 29 | .nQueens .slider h3 { 30 | font-size: 1.2rem; 31 | color: var(--main-green); 32 | } 33 | 34 | .nQueens .nav { 35 | display: flex; 36 | justify-content: center; 37 | width: 100%; 38 | height: 25vh; 39 | align-items: center; 40 | } 41 | 42 | .nQueens .slider { 43 | width: 12vw; 44 | display: flex; 45 | flex-direction: column; 46 | justify-content: center; 47 | align-items: center; 48 | margin: 0 1vw; 49 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/bfs.jsx: -------------------------------------------------------------------------------- 1 | export function bfsdfs(grid,startNode,endNode,algo){ 2 | var list = []; 3 | const nodesInOrder = []; 4 | nodesInOrder.push(startNode); 5 | list.push(startNode); 6 | startNode.isVisited = true; 7 | while(!!list.length){ 8 | const currentNode = (algo === "bfs" ? list.shift():list.pop()); 9 | nodesInOrder.push(currentNode); 10 | if( currentNode === endNode ) return nodesInOrder; 11 | if( algo === "dfs" ) currentNode.isVisited = true; 12 | const nodesToPush = getNeighbours(grid,currentNode); 13 | for( const node of nodesToPush ){ 14 | if(algo === "bfs"){ 15 | node.isVisited = true; 16 | } 17 | node.previousNode = currentNode; 18 | list.push(node); 19 | 20 | } 21 | } 22 | return nodesInOrder; 23 | } 24 | 25 | function getNeighbours(grid,node){ 26 | const neighbors = []; 27 | const {col, row} = node; 28 | // console.log(node); 29 | 30 | if (col > 0) neighbors.push(grid[row][col - 1]); 31 | if (row > 0) neighbors.push(grid[row - 1][col]); 32 | if (row < grid.length - 1) neighbors.push(grid[row + 1][col]); 33 | if (col < grid[0].length - 1) neighbors.push(grid[row][col + 1]); 34 | return neighbors.filter(neighbor => (!neighbor.isVisited && !neighbor.isWall )); 35 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/grahamScan.js: -------------------------------------------------------------------------------- 1 | export function convex_hull(points){ 2 | if( points.size === 1 ){ 3 | return; 4 | } 5 | const pointStart = points[0]; 6 | const pointEnd = points[ points.length-1 ]; 7 | const up = [], down = []; 8 | const pairs = []; 9 | const lines=[]; 10 | up.push( pointStart); 11 | down.push(pointStart); 12 | for( let i = 1; i< points.length ;i++ ){ 13 | if( (i === (points.length - 1)) || cw( pointStart,points[i],pointEnd ) ){ 14 | while( up.length >=2 && !cw(up[up.length-2],up[up.length-1],points[i] ) ){ 15 | lines.push({ 16 | from:up[up.length-2], 17 | to:up[up.length-1], 18 | add:false 19 | }); 20 | up.pop(); 21 | } 22 | up.push( points[i] ); 23 | lines.push({ 24 | from:up[up.length-2], 25 | to:up[up.length-1], 26 | add:true 27 | }) 28 | } 29 | 30 | } 31 | for(let i = 0; i< points.length;i++){ 32 | if( (i === (points.length - 1)) || ccw( pointStart,points[i],pointEnd ) ){ 33 | while( down.length >=2 && !ccw(down[down.length-2],down[down.length-1],points[i] ) ){ 34 | lines.push({ 35 | from:down[down.length-2], 36 | to:down[down.length-1], 37 | add:false 38 | }); 39 | down.pop(); 40 | } 41 | down.push( points[i] ); 42 | lines.push({ 43 | from:down[down.length-2], 44 | to:down[down.length-1], 45 | add:true 46 | }) 47 | } 48 | } 49 | 50 | for (let i = 0; i < up.length; i++){ 51 | pairs.push(up[i]); 52 | } 53 | for (let i = down.length - 2; i > 0; i--) { 54 | pairs.push(down[i]); 55 | } 56 | return [pairs,lines]; 57 | } 58 | 59 | function cw(a, b, c) { 60 | const f = a.xx*(b.yy-c.yy)+b.xx*(c.yy-a.yy)+c.xx*(a.yy-b.yy); 61 | if( a.xx*(b.yy-c.yy)+b.xx*(c.yy-a.yy)+c.xx*(a.yy-b.yy) < 0 ){ 62 | return true; 63 | } else{ 64 | return false; 65 | } 66 | 67 | } 68 | 69 | function ccw(a, b, c){ 70 | if( a.xx * (b.yy - c.yy) + b.xx * (c.yy - a.yy) + c.xx * (a.yy - b.yy) > 0 ){ 71 | return true; 72 | } else { 73 | return false; 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/heapSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | export default function HeapSort(rects2){ 3 | let rects = rects2.slice(); 4 | values = []; 5 | let sz = rects2.length; 6 | // sz = sz-1; 7 | heapSort(rects,sz); 8 | return values; 9 | } 10 | function heapify(rects,n,i){ 11 | let largest = i; // Initialize largest as root 12 | let l = 2 * i + 1; // left = 2*i + 1 13 | let r = 2 * i + 2; // right = 2*i + 2 14 | 15 | // If left child is larger than root 16 | if (l < n && rects[l].width > rects[largest].width) 17 | largest = l; 18 | 19 | // If right child is larger than largest so far 20 | if (r < n && rects[r].width > rects[largest].width) 21 | largest = r; 22 | 23 | // If largest is not root 24 | if (largest != i) { 25 | let temp = rects[i]; 26 | rects[i] = rects[largest]; 27 | rects[largest] = temp; 28 | let value = { 29 | left:i, 30 | right:largest, 31 | sorted: false 32 | } 33 | values.push(value); 34 | // Recursively heapify the affected sub-tree 35 | heapify(rects, n, largest); 36 | } 37 | } 38 | function heapSort(rects,n){ 39 | for(let i = Math.floor(n/2)-1;i>=0;i--){ 40 | // console.log("heap ",n," ",i); 41 | heapify(rects,n,i); 42 | } 43 | for (let i = n-1 ; i > 0; i--) { 44 | // Move current root to end 45 | let temp = rects[i]; 46 | rects[i] = rects[0]; 47 | rects[0] = temp; 48 | let value = { 49 | left:i, 50 | right:0, 51 | sorted:true 52 | } 53 | values.push(value); 54 | // call max heapify on the reduced heap 55 | heapify(rects, i, 0); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/mergeSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | export default function mergeSort(rects2){ 3 | let rects = rects2.slice(); 4 | values = []; 5 | let sz = rects2.length; 6 | // console.log( "fdsfsd",sz ); 7 | sz = sz-1; 8 | mergeS(rects,0,sz); 9 | return values; 10 | } 11 | 12 | function merge(rects, l, m, r){ 13 | // console.log(l," ",r); 14 | let n1 = m-l+1; 15 | let n2 = r-m; 16 | 17 | const L = rects.slice(l, m+1); 18 | const R = rects.slice(m+1,r+1); 19 | let i = 0; 20 | let j = 0; 21 | let k = l; 22 | while(i=r ) return; 48 | let m = l+ (r-l)/2; 49 | m = Math.floor(m); 50 | // console.log("iiiiiiiiiiiiiiiiiiiiiiiii ",m); 51 | mergeS(rects,l,m); 52 | mergeS(rects,m+1,r); 53 | merge(rects,l,m,r); 54 | let rectsCopy = rects.slice(l,r+1); 55 | let value = { 56 | left:l, 57 | right:r, 58 | mid:m, 59 | val:rectsCopy 60 | } 61 | values.push(value); 62 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/prime.js: -------------------------------------------------------------------------------- 1 | export function seive(n){ 2 | let vis = new Array(n+5).fill(0); 3 | 4 | let primes = []; 5 | for(let p = 2;p<=n;p++){ 6 | if( vis[p] === 0 ){ 7 | primes.push(p); 8 | for(let q = p*p;q<=n;q+=p) 9 | vis[q] = 1; 10 | } 11 | } 12 | return primes; 13 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/quickSort.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | 3 | export function quickSort(rects2){ 4 | let rects = rects2.slice(); 5 | values = []; 6 | let sz = rects2.length; 7 | // console.log( "fdsfsd",sz ); 8 | sz = sz-1; 9 | quick(rects,0,sz); 10 | for(var i=0;i<=sz;i++){ 11 | values.push({ 12 | xx:i, 13 | yy:i, 14 | changed:true 15 | }) 16 | } 17 | return values; 18 | } 19 | 20 | 21 | function getPartition(rects, left, right){ 22 | let pivot = rects[right].width 23 | let it = left-1; 24 | for(var j=left;j<=right-1;j++){ 25 | if( rects[j].width< pivot){ 26 | it++; 27 | if( it!==j ){ 28 | // swap(rects[it],rects[j]; 29 | const rect1 = {...rects[it]}; 30 | const rect2 = {...rects[j]}; 31 | rects[it] = rect2; 32 | rects[j] = rect1; 33 | values.push({ 34 | xx:it, 35 | yy:j, 36 | changed:true 37 | }) 38 | } 39 | } 40 | } 41 | if( it+1!==right ){ 42 | const rect1 = {...rects[it+1]}; 43 | const rect2 = {...rects[right]}; 44 | rects[it+1] = rect2; 45 | rects[right] = rect1; 46 | values.push({ 47 | xx:it+1, 48 | yy:right, 49 | changed:true 50 | }) 51 | } 52 | return it+1; 53 | } 54 | function quick(rects,left,right){ 55 | if( left>=right ) return ; 56 | const partition = getPartition(rects,left,right); 57 | quick(rects,left,partition-1); 58 | quick(rects,partition+1,right); 59 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/quickSortRecursive.js: -------------------------------------------------------------------------------- 1 | let values = []; 2 | 3 | export function quickSortRecursive(rects2){ 4 | let rects = rects2.slice(); 5 | values = []; 6 | let sz = rects2.length; 7 | // console.log( "fdsfsd",sz ); 8 | sz = sz-1; 9 | quick(rects,0,sz); 10 | return values; 11 | } 12 | 13 | 14 | function getPartition(rects, left, right){ 15 | values.push({ 16 | left, 17 | right, 18 | swap:false, 19 | changedRange:true, 20 | }) 21 | let pivot = rects[right].width 22 | let it = left-1; 23 | for(var j=left;j<=right-1;j++){ 24 | if( rects[j].width< pivot){ 25 | it++; 26 | if( it!==j ){ 27 | // swap(rects[it],rects[j]; 28 | const rect1 = {...rects[it]}; 29 | const rect2 = {...rects[j]}; 30 | rects[it] = rect2; 31 | rects[j] = rect1; 32 | values.push({ 33 | left:it, 34 | right:j, 35 | swap:true, 36 | changedRange:false, 37 | }) 38 | } 39 | } 40 | } 41 | if( it+1!==right ){ 42 | const rect1 = {...rects[it+1]}; 43 | const rect2 = {...rects[right]}; 44 | rects[it+1] = rect2; 45 | rects[right] = rect1; 46 | values.push({ 47 | left:it+1, 48 | right:right, 49 | swap:true, 50 | changedRange:false, 51 | }) 52 | } 53 | return it+1; 54 | } 55 | function quick(rects,left,right){ 56 | if( left>=right ) return ; 57 | const partition = getPartition(rects,left,right); 58 | quick(rects,left,partition-1); 59 | quick(rects,partition+1,right); 60 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/algorithms/randomMaze.js: -------------------------------------------------------------------------------- 1 | export function randomMaze(board,row,col){ 2 | let newBoard = board.slice(); 3 | const pairs = []; 4 | for(let i = 0;i { 6 | const [play] = useSound(loud_btn); 7 | 8 | React.useEffect(() => { 9 | if (soundCallback) { 10 | soundCallback(play); 11 | } 12 | }, [soundCallback, play]); 13 | 14 | return null; 15 | }; 16 | 17 | export default PlaySound; 18 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/components/grid.css: -------------------------------------------------------------------------------- 1 | .Grid { 2 | font-size: 0; 3 | } 4 | 5 | div { 6 | padding: 0px; 7 | margin: 0px; 8 | margin-bottom: 0px; 9 | padding-bottom: 0px; 10 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/components/grid.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Node from "./node"; 3 | import './grid.css'; 4 | class Grid extends Component { 5 | state = { 6 | grid: this.props.grid 7 | } 8 | 9 | render() { 10 | return ( 11 |
12 | {this.props.grid.map((row, rowidx) => { 13 | return ( 14 |
15 | {row.map((node, nodeidx) => { 16 | const {row, col, isWall, visitedNode, } = node; 17 | return ( 18 | 29 | ); 30 | })} 31 |
32 | ); 33 | })} 34 |
35 | ); 36 | } 37 | } 38 | 39 | export default Grid; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/components/menu.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import SimpleSelect from "./simpleSelect"; 3 | import PlaySound from './PlaySound'; 4 | 5 | class Menu extends Component { 6 | 7 | playSound = null; 8 | 9 | setPlaySoundCallback = (play) => { 10 | this.playSound = play; 11 | }; 12 | 13 | handleButtonClick = (action) => { 14 | return () => { 15 | if (this.playSound) { 16 | this.playSound(); 17 | } 18 | action(); 19 | }; 20 | }; 21 | 22 | render() { 23 | return ( 24 | 55 | ); 56 | } 57 | } 58 | 59 | export default Menu; 60 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/components/node.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import './node.css' 3 | class Node extends Component { 4 | static = { 5 | row: this.props.row, 6 | col: this.props.col 7 | } 8 | render() { 9 | const { row,col,isVisited, onMouseDown, onMouseEnter,onMouseUp } = this.props; 10 | return ( 11 |
onMouseDown(row,col)} 15 | onMouseEnter={() => onMouseEnter(row,col)} 16 | onMouseUp={() => onMouseUp(row,col)} 17 | /> 18 | ); 19 | } 20 | getClassName(){ 21 | if(this.props.node.isWall === true){ 22 | return "node node-wall"; 23 | } else if( this.props.node.isStartNode === true ){ 24 | return "node node-start"; 25 | } else if( this.props.node.isEndNode === true ){ 26 | return "node node-end"; 27 | } else if(this.props.node.ispathNode){ 28 | return 'node node-shortest-path'; 29 | }else if( this.props.node.isVisited === true ){ 30 | return "node node-visited"; 31 | } else{ 32 | return "node"; 33 | } 34 | } 35 | } 36 | 37 | export default Node; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/components/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | 9 | const useStyles = makeStyles((theme) => ({ 10 | formControl: { 11 | margin: theme.spacing(1), 12 | minWidth: 120, 13 | }, 14 | selectEmpty: { 15 | marginTop: theme.spacing(2), 16 | }, 17 | })); 18 | 19 | const SimpleSelect = (props) => { 20 | const classes = useStyles(); 21 | const [age, setAge] = React.useState('0'); 22 | 23 | const handleChange = (event) => { 24 | setAge(event.target.value); 25 | props.onAlgoChanged(event.target.value); 26 | }; 27 | 28 | return ( 29 |
30 | 31 | Algorithm 32 | 46 | 47 |
48 | ); 49 | } 50 | 51 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/darktheme.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/pathfinder/darktheme.css -------------------------------------------------------------------------------- /src/pages/algoVisualiser/pathfinder/style.css: -------------------------------------------------------------------------------- 1 | .pathfinder nav { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | } 6 | 7 | .pathfinder { 8 | min-height: 95vh; 9 | } 10 | 11 | .PathFinder { 12 | height: 85vh; 13 | display: flex; 14 | flex-direction: column; 15 | align-items: center; 16 | justify-content: center; 17 | } 18 | 19 | .pathfinder .selectAlgo { 20 | display: flex; 21 | } 22 | 23 | .pathfinder .selectOtions { 24 | display: flex; 25 | flex-wrap: wrap; 26 | } 27 | 28 | .pathfinder .selectOptions button { 29 | background: #569E61; 30 | color: #fff; 31 | cursor: pointer; 32 | outline: none; 33 | border: none; 34 | font-size: 1.2rem; 35 | border-radius: 0.6rem; 36 | padding: 0.4rem 1rem; 37 | margin: 0 0.4rem; 38 | transition: 0.5s; 39 | } 40 | 41 | .pathfinder .selectOptions button:hover { 42 | color: #569E61; 43 | background: #fff; 44 | box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.4); 45 | transition: 0.5s; 46 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/primeNumbers/style.css: -------------------------------------------------------------------------------- 1 | .primeNumbers .main { 2 | min-height: 85vh; 3 | display: flex; 4 | justify-content: center; 5 | flex-direction: column; 6 | text-align: center; 7 | color: var(--main-green); 8 | } 9 | 10 | .primeNumbers .main h1 { 11 | color: var(--main-green); 12 | font-size: 2.5rem; 13 | margin: 0; 14 | } 15 | 16 | .primeNumbers .main h3 { 17 | font-size: 1.7rem; 18 | margin: 0; 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/recursiveSorting/style.css: -------------------------------------------------------------------------------- 1 | .recursiveSorting .main { 2 | min-height: 85vh; 3 | display: flex; 4 | justify-content: center; 5 | flex-direction: column; 6 | text-align: center; 7 | color: var(--main-green); 8 | } 9 | 10 | .recursiveSorting .main h1 { 11 | color: var(--main-green); 12 | font-size: 2.5rem; 13 | margin: 0; 14 | } 15 | 16 | .recursiveSorting .main h3 { 17 | font-size: 1.7rem; 18 | margin: 0; 19 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/doubleSlider.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {makeStyles, withStyles} from '@material-ui/core/styles'; 3 | import Typography from '@material-ui/core/Typography'; 4 | import Slider from '@material-ui/core/Slider'; 5 | 6 | const useStyles = makeStyles({ 7 | root: { 8 | width: 200, 9 | }, 10 | }); 11 | 12 | 13 | const CSlider = withStyles({ 14 | root: { 15 | // color: "#ffffff", 16 | height: 3, 17 | padding: "13px 0", 18 | }, 19 | track: { 20 | height: 4, 21 | borderRadius: 2, 22 | }, 23 | thumb: { 24 | backgroundColor: "#fff", 25 | //color: "#fff", 26 | }, 27 | })(Slider); 28 | 29 | function valuetext(value) { 30 | return `${value}`; 31 | } 32 | 33 | 34 | 35 | export default function RangeSlider(props) { 36 | const classes = useStyles(); 37 | const [value, setValue] = React.useState([20, 37]); 38 | 39 | const handleChange = (event, newValue) => { 40 | setValue(newValue); 41 | 42 | }; 43 | const handleCommit = (event, newValue) => { 44 | console.log(newValue); 45 | }; 46 | 47 | return ( 48 |
49 | 59 | 60 | Value range 61 | 62 |
63 | ); 64 | } 65 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/formControlLabel.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import FormGroup from '@material-ui/core/FormGroup'; 3 | import FormControlLabel from '@material-ui/core/FormControlLabel'; 4 | import Switch from '@material-ui/core/Switch'; 5 | 6 | export default function SwitchLabels(props) { 7 | const [state, setState] = React.useState({ 8 | checkedA: false, 9 | }); 10 | 11 | const handleChange = (event) => { 12 | setState({ ...state, [event.target.name]: event.target.checked }); 13 | props.onDoubleChange(event.target.checked); 14 | }; 15 | 16 | return ( 17 | 18 | } 20 | label="Duo" 21 | disabled={props.disable} 22 | /> 23 | 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {Link} from "react-router-dom"; 3 | 4 | class Navbar extends Component { 5 | render() { 6 | return ( 7 | 23 | ); 24 | } 25 | } 26 | 27 | export default Navbar; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/rect.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import './style.css'; 3 | class Rect extends Component { 4 | 5 | render() { 6 | return ( 7 |
15 | 16 |
17 | ); 18 | } 19 | checkColor = () => { 20 | if (this.props.rect.isSorted) { 21 | return "#569E61"; 22 | } else if (this.props.rect.isSorting) { 23 | return "rgb(217, 72, 72)"; 24 | } else { 25 | return "#292c29" 26 | } 27 | } 28 | } 29 | 30 | export default Rect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/rects.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Rect from "./rect"; 3 | import FlipMove from 'react-flip-move'; 4 | 5 | class Rects extends Component { 6 | render() { 7 | let margin = 5; 8 | if (this.props.rects.length > 50) { 9 | margin = 1; 10 | } 11 | return ( 12 | <> 13 | 17 | {this.props.rects.map((rect, rectidx) => { 18 | return ( 19 | 24 | ); 25 | })} 26 | 27 | 28 | ); 29 | } 30 | } 31 | 32 | export default Rects; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/simpleSelect.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import InputLabel from '@material-ui/core/InputLabel'; 4 | import MenuItem from '@material-ui/core/MenuItem'; 5 | import FormHelperText from '@material-ui/core/FormHelperText'; 6 | import FormControl from '@material-ui/core/FormControl'; 7 | import Select from '@material-ui/core/Select'; 8 | 9 | const useStyles = makeStyles((theme) => ({ 10 | formControl: { 11 | margin: theme.spacing(1), 12 | minWidth: 120, 13 | }, 14 | selectEmpty: { 15 | marginTop: theme.spacing(2), 16 | }, 17 | })); 18 | 19 | const SimpleSelect = (props) => { 20 | const classes = useStyles(); 21 | const [age, setAge] = React.useState('0'); 22 | const [state, setState] = React.useState({ 23 | pos: props.pos, 24 | }); 25 | const handleChange = (event) => { 26 | console.log(state.pos); 27 | setAge(event.target.value); 28 | props.onAlgoChanged(state.pos,event.target.value); 29 | }; 30 | 31 | return ( 32 |
33 | 34 | Algorithm 35 | 46 | 47 |
48 | ); 49 | } 50 | 51 | export default SimpleSelect; -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/slider.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { makeStyles } from '@material-ui/core/styles'; 3 | import Typography from '@material-ui/core/Typography'; 4 | import Slider from '@material-ui/core/Slider'; 5 | 6 | const useStyles = makeStyles({ 7 | root: { 8 | width: 200, 9 | }, 10 | }); 11 | 12 | function valuetext(value) { 13 | return `${value}`; 14 | } 15 | 16 | 17 | export default function DiscreteSlider(props) { 18 | const classes = useStyles(); 19 | const handleChange = (event) =>{ 20 | if( event.target.innerText === "" ){ 21 | return; 22 | } 23 | const num = parseInt(event.target.innerText,10); 24 | props.onCountChange(num); 25 | } 26 | return ( 27 |
28 | 29 | 42 | 43 | {props.title} 44 | 45 |
46 | ); 47 | } 48 | -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/components/style.css: -------------------------------------------------------------------------------- 1 | .rect{ 2 | background-color: steelblue; 3 | outline: 1px black; 4 | height: 20px; 5 | width: 20px; 6 | border-radius: 5px; 7 | margin: 5px; 8 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sorting/style.css: -------------------------------------------------------------------------------- 1 | .sorting .flip-move { 2 | justify-content: center; 3 | display: flex; 4 | align-items: flex-end; 5 | } 6 | 7 | .mainSorting { 8 | min-height: 85vh; 9 | display: flex; 10 | flex-direction: column; 11 | align-items: center; 12 | justify-content: center; 13 | } 14 | 15 | .sorting .mainSorting .nav { 16 | display: flex; 17 | flex-direction: column; 18 | width: 50vw; 19 | align-items: center; 20 | margin: 0 auto; 21 | } 22 | 23 | .sorting .mainSorting .nav .outer { 24 | display: flex; 25 | align-items: center; 26 | margin: 1.3rem 0; 27 | gap: 5vw; 28 | } 29 | 30 | .sorting .mainSorting .nav .outer div { 31 | display: flex; 32 | flex-direction: column; 33 | align-items: flex-start; 34 | justify-content: center; 35 | } 36 | 37 | .sorting .nav .visualize { 38 | margin-bottom: 4rem; 39 | } 40 | 41 | .sorting .nav button { 42 | font-family: 'poppins'; 43 | width: auto; 44 | border: none; 45 | background: #569E61; 46 | color: #ffff; 47 | font-size: 1.1rem; 48 | font-family: "Poppins", sans-serif; 49 | font-weight: 450; 50 | font-style: normal; 51 | padding: 0.3rem 0.6rem; 52 | margin: 0.2rem 0.4rem; 53 | border-radius: 0.6rem; 54 | cursor: pointer; 55 | transition: 0.5s; 56 | } 57 | 58 | .sorting .nav button:hover { 59 | box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.2); 60 | transition: 0.2s; 61 | } -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/buttonClick.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/buttonClick.mp3 -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/card-hover.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/card-hover.mp3 -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/card_flip.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/card_flip.mp3 -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/hover_quest.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/hover_quest.wav -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/loud_btn_clk.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/loud_btn_clk.wav -------------------------------------------------------------------------------- /src/pages/algoVisualiser/sounds/mech-keyboard.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/algoVisualiser/sounds/mech-keyboard.mp3 -------------------------------------------------------------------------------- /src/pages/auth/AuthContext.jsx: -------------------------------------------------------------------------------- 1 | import React, { createContext, useContext, useEffect, useState } from "react"; 2 | import { 3 | getAuth, 4 | createUserWithEmailAndPassword, 5 | signInWithEmailAndPassword, 6 | signOut, 7 | onAuthStateChanged, 8 | } from "firebase/auth"; 9 | import { app } from "./firebase"; 10 | 11 | const AuthContext = createContext(); 12 | 13 | export const useAuth = () => useContext(AuthContext); 14 | 15 | export const AuthProvider = ({ children }) => { 16 | const [currentUser, setCurrentUser] = useState(null); 17 | const [loading, setLoading] = useState(true); 18 | const auth = getAuth(app); 19 | 20 | const signup = (email, password) => { 21 | return createUserWithEmailAndPassword(auth, email, password); 22 | }; 23 | 24 | const login = (email, password) => { 25 | return signInWithEmailAndPassword(auth, email, password); 26 | }; 27 | 28 | const logout = () => { 29 | return signOut(auth); 30 | }; 31 | 32 | useEffect(() => { 33 | const unsubscribe = onAuthStateChanged(auth, (user) => { 34 | setCurrentUser(user); 35 | setLoading(false); 36 | }); 37 | 38 | return unsubscribe; 39 | }, [auth]); 40 | 41 | const value = { 42 | currentUser, 43 | signup, 44 | login, 45 | logout, 46 | }; 47 | 48 | return ( 49 | 50 | {!loading && children} 51 | 52 | ); 53 | }; 54 | -------------------------------------------------------------------------------- /src/pages/auth/Dashboard.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useAuth } from "./AuthContext"; 3 | import { useNavigate } from "react-router-dom"; 4 | 5 | const Dashboard = () => { 6 | const { currentUser, logout } = useAuth(); 7 | const navigate = useNavigate(); 8 | 9 | const handleLogout = async () => { 10 | try { 11 | await logout(); 12 | navigate("/login"); 13 | } catch { 14 | console.error("Failed to log out"); 15 | } 16 | }; 17 | 18 | return ( 19 |
20 |

Dashboard

21 |

Welcome, {currentUser.email}

22 | 23 |
24 | ); 25 | }; 26 | 27 | export default Dashboard; 28 | -------------------------------------------------------------------------------- /src/pages/auth/PrivateRoute.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Navigate } from "react-router-dom"; 3 | import { useAuth } from "./AuthContext"; 4 | 5 | const PrivateRoute = ({ children }) => { 6 | const { currentUser } = useAuth(); 7 | 8 | return currentUser ? children : ; 9 | }; 10 | 11 | export default PrivateRoute; 12 | -------------------------------------------------------------------------------- /src/pages/auth/firebase.js: -------------------------------------------------------------------------------- 1 | import { initializeApp } from "firebase/app"; 2 | import { getFirestore } from "firebase/firestore"; 3 | import { getAuth, GoogleAuthProvider } from "firebase/auth"; 4 | const firebaseConfig = { 5 | apiKey: "AIzaSyC3a-2ZNR_bGh8D6jKZlfs95gVbv-t3RIM", 6 | authDomain: "skill-2040.firebaseapp.com", 7 | projectId: "skill-2040", 8 | storageBucket: "skill-2040.appspot.com", 9 | messagingSenderId: "613789960195", 10 | appId: "1:613789960195:web:b1b417578d902fcfb8a636", 11 | }; 12 | 13 | const app = initializeApp(firebaseConfig); 14 | const db = getFirestore(app); // Initialize Firestore 15 | const auth = getAuth(app); 16 | const googleProvider = new GoogleAuthProvider(); 17 | 18 | 19 | export { app, db, auth, googleProvider }; 20 | -------------------------------------------------------------------------------- /src/pages/components/PlaySound.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import useSound from 'use-sound'; 3 | import loud_btn from './sounds/buttonClick.mp3'; 4 | 5 | const PlaySound = ({ soundCallback }) => { 6 | const [play] = useSound(loud_btn); 7 | 8 | React.useEffect(() => { 9 | if (soundCallback) { 10 | soundCallback(play); 11 | } 12 | }, [soundCallback, play]); 13 | 14 | return null; 15 | }; 16 | 17 | export default PlaySound; 18 | -------------------------------------------------------------------------------- /src/pages/components/footer/Footer.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import GVKDetails from '../gvkDetails/GVKDetails'; 4 | import './style.css' 5 | import loud_btn from '../../pages/sounds/card-hover.mp3'; 6 | import loud_btn2 from '../../pages/sounds/buttonClick.mp3'; 7 | function Footer() { 8 | const sound = new Audio(loud_btn); 9 | const sound2 = new Audio(loud_btn2); 10 | const [isVisible, setIsVisible] = useState(false); 11 | 12 | const handleFooterClick = () => { 13 | sound.play(); 14 | setIsVisible(true); 15 | }; 16 | 17 | const handleClose = () => { 18 | sound2.play(); 19 | setIsVisible(false); 20 | }; 21 | 22 | return ( 23 | <> 24 |
25 |

Made with ❤ by GantaVenkataKousik

26 | 27 |
28 | {isVisible && } 29 | 30 | 31 | ); 32 | } 33 | 34 | export default Footer; 35 | -------------------------------------------------------------------------------- /src/pages/components/footer/style.css: -------------------------------------------------------------------------------- 1 | .footer { 2 | background: #569E61; 3 | height: 5vh; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | opacity: 0.88; 8 | width: 100%; 9 | color: #fff; 10 | } -------------------------------------------------------------------------------- /src/pages/components/gvkDetails/style.css: -------------------------------------------------------------------------------- 1 | .gvkdetails { 2 | position: fixed; 3 | top: 50%; 4 | left: 50%; 5 | transform: translate(-50%, -50%); 6 | background-color: white; 7 | border-radius: 8px; 8 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); 9 | padding: 20px; 10 | z-index: 1000; 11 | max-width: 90%; 12 | font-size: 1.2rem; 13 | color: #569E61; 14 | padding-bottom: 2rem; 15 | } 16 | 17 | .gvkdetails .container { 18 | text-align: center; 19 | } 20 | 21 | .gvkdetails .socialProfiles ul { 22 | display: flex; 23 | justify-content: center; 24 | flex-wrap: wrap; 25 | list-style-type: none; 26 | } 27 | 28 | .gvkdetails .socialProfiles ul li { 29 | margin: 10px; 30 | margin-top: 0px; 31 | width: 7vw; 32 | } 33 | 34 | .gvkdetails .socialProfiles a i { 35 | font-size: 45px; 36 | } 37 | 38 | .gvkdetails .socialProfiles a { 39 | text-decoration: none; 40 | color: #333; 41 | cursor: pointer; 42 | } 43 | 44 | .gvkdetails .close { 45 | position: absolute; 46 | top: 10px; 47 | right: 10px; 48 | cursor: pointer; 49 | } 50 | 51 | .gvkdetails .share { 52 | font-size: 1.5rem; 53 | margin: 0.4rem 0; 54 | } 55 | 56 | .gvkdetails h4 { 57 | font-weight: 500; 58 | font-size: 1.4rem; 59 | } 60 | 61 | .gvkdetails h2 { 62 | margin: 0.6rem 0; 63 | font-size: 1.8rem; 64 | } 65 | 66 | .gvkdetails .email a { 67 | color: #000; 68 | } 69 | 70 | .gvkdetails .mailme { 71 | margin-bottom: 0.4rem; 72 | } -------------------------------------------------------------------------------- /src/pages/components/sounds/PlaySound.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import useSound from 'use-sound'; 3 | import loud_btn from './sounds/buttonClick.wav'; 4 | 5 | const PlaySound = ({ soundCallback }) => { 6 | const [play] = useSound(loud_btn); 7 | 8 | React.useEffect(() => { 9 | if (soundCallback) { 10 | soundCallback(play); 11 | } 12 | }, [soundCallback, play]); 13 | 14 | return null; 15 | }; 16 | 17 | export default PlaySound; 18 | -------------------------------------------------------------------------------- /src/pages/components/sounds/buttonClick.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/components/sounds/buttonClick.mp3 -------------------------------------------------------------------------------- /src/pages/components/sounds/hover_quest.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/components/sounds/hover_quest.wav -------------------------------------------------------------------------------- /src/pages/components/sounds/loud_btn_clk.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/components/sounds/loud_btn_clk.wav -------------------------------------------------------------------------------- /src/pages/contibutionboard/style.css: -------------------------------------------------------------------------------- 1 | .contribution-Container { 2 | margin: 0 auto; 3 | } 4 | 5 | .react-calendar-heatmap text { 6 | font-size: 0.5rem; 7 | fill: #aaa; 8 | } 9 | 10 | .react-calendar-heatmap .react-calendar-heatmap-small-text { 11 | font-size: 0.5vw; 12 | } 13 | 14 | .react-calendar-heatmap rect:hover { 15 | stroke: #555; 16 | stroke-width: 0.1vw; 17 | } 18 | 19 | .react-calendar-heatmap .color-empty { 20 | fill: #eeeeee; 21 | } 22 | 23 | .react-calendar-heatmap .color-scale-1 { 24 | fill: #d6e685; 25 | } 26 | 27 | .react-calendar-heatmap .color-scale-2 { 28 | fill: #8cc665; 29 | } 30 | 31 | .react-calendar-heatmap .color-scale-3 { 32 | fill: #44a340; 33 | } 34 | 35 | .react-calendar-heatmap .color-scale-4 { 36 | fill: #1e6823; 37 | } 38 | 39 | .react-calendar-heatmap rect { 40 | rx: 2px; 41 | ry: 2px; 42 | } -------------------------------------------------------------------------------- /src/pages/dsajourney/components/ProblemHistory.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "./style.css"; 3 | 4 | export default function ProblemHistory({ problemName, timestamp, status }) { 5 | console.log("Received timestamp:", timestamp); // Debugging: Log the timestamp 6 | 7 | // Ensure the timestamp is valid 8 | const dateObject = new Date(timestamp); 9 | const formattedDate = isNaN(dateObject.getTime()) 10 | ? "Invalid Date" 11 | : dateObject.toLocaleDateString(); 12 | const formattedTime = isNaN(dateObject.getTime()) 13 | ? "Invalid Time" 14 | : dateObject.toLocaleTimeString(); 15 | 16 | // Define status colors 17 | const statusColors = { 18 | Solved: "rgba(50, 222, 132, 0.7)", 19 | Revision: "rgba(255, 159, 64, 0.7)", 20 | Unsolved: "rgba(229, 85, 78, 0.7)", 21 | Bookmarked: "rgba(54, 162, 235, 0.7)", 22 | "Showed Interest": "rgba(153, 102, 255, 0.7)", 23 | "Added Notes": "rgba(255, 205, 86, 0.7)", 24 | }; 25 | 26 | // Set the background color based on the status 27 | const backgroundColor = statusColors[status] || "rgba(200, 200, 200, 0.7)"; // Default color if status is not found 28 | 29 | return ( 30 |
31 |
32 |

{problemName}

{/* Display the problem name */} 33 |

{formattedTime}

34 |

{formattedDate}

35 |
36 |
37 | {status} 38 |
39 |
40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /src/pages/dsajourney/components/style.css: -------------------------------------------------------------------------------- 1 | .problem-history-container { 2 | display: flex; 3 | font-family: "Poppins", system-ui; 4 | font-weight: 400; 5 | font-style: normal; 6 | width: 90vw; 7 | position: relative; 8 | align-items: center; 9 | border-bottom: 1px solid rgba(199, 194, 194, 1); 10 | padding: 1.5vw; 11 | box-sizing: border-box; 12 | } 13 | 14 | .problem-history-left-part h1 { 15 | font-weight: 400; 16 | font-size: 1.5rem; 17 | margin: 0; 18 | } 19 | 20 | .problem-history-left-part h2 { 21 | font-weight: 400; 22 | font-size: 2vh; 23 | margin: 0; 24 | margin-top: 1vh; 25 | } 26 | 27 | .problem-history-right-part { 28 | display: flex; 29 | justify-content: center; 30 | font-size: 2.6vh; 31 | font-weight: 600; 32 | height: fit-content; 33 | padding: 0.7vw 2.5vw; 34 | border-radius: 2vw; 35 | color: white; 36 | position: absolute; 37 | right: 0; 38 | } 39 | 40 | /* Responsive Styles */ 41 | @media (max-width: 1000px) { 42 | .problem-history-container { 43 | width: 95vw; 44 | padding: 2vw; 45 | } 46 | 47 | .problem-history-left-part h1 { 48 | font-size: 1.3rem; 49 | } 50 | 51 | .problem-history-left-part h2 { 52 | font-size: 1.9vh; 53 | margin-top: 1.2vh; 54 | } 55 | 56 | .problem-history-right-part { 57 | font-size: 2.3vh; 58 | padding: 1vw 2vw; 59 | border-radius: 1.8vw; 60 | } 61 | } 62 | 63 | @media (max-width: 768px) { 64 | .problem-history-container { 65 | width: 95vw; 66 | padding: 2vw; 67 | } 68 | 69 | .problem-history-left-part h1 { 70 | font-size: 1.2rem; 71 | } 72 | 73 | .problem-history-left-part h2 { 74 | font-size: 1.8vh; 75 | margin-top: 1.5vh; 76 | } 77 | 78 | .problem-history-right-part { 79 | font-size: 2.2vh; 80 | padding: 1vw 2vw; 81 | border-radius: 1.5vw; 82 | } 83 | } 84 | 85 | @media (max-width: 430px) { 86 | .problem-history-container { 87 | width: 100vw; 88 | padding: 3vw; 89 | flex-direction: column; 90 | align-items: flex-start; 91 | } 92 | 93 | .problem-history-left-part h1 { 94 | font-size: 1rem; 95 | } 96 | 97 | .problem-history-left-part h2 { 98 | font-size: 1.5vh; 99 | margin-top: 1vh; 100 | } 101 | 102 | .problem-history-right-part { 103 | font-size: 2vh; 104 | padding: 1.5vw 2vw; 105 | border-radius: 1vw; 106 | position: relative; /* Ensures no overlap */ 107 | margin-top: 2vw; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/pages/dsajourney/style.css: -------------------------------------------------------------------------------- 1 | .dsa-journey { 2 | display: flex; 3 | flex-direction: column; 4 | align-items: center; 5 | } 6 | .dsa-journey-header { 7 | font-family: "Poppins", system-ui; 8 | font-weight: 700; 9 | font-style: normal; 10 | text-align: center; 11 | color: #393e46; 12 | font-size: 5vh; 13 | margin-top: 15vh; 14 | } 15 | @media (max-width: 770px) { 16 | .dsa-journey { 17 | padding-left: 1vw; 18 | padding-right: 1vw; 19 | } 20 | .dsa-journey-header { 21 | margin-top: 0; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/pages/helpers/array_helpers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A set of monkey-patched Array helpers. 3 | * Probably a bad idea to use these in a real production environment. 4 | * Monkey-patching is confusing to anyone seeing the project for the first 5 | * time (or coming back to it after a few weeks). 6 | * That said, this is a simple demo project, so what the hell, let's break 7 | * some rules =D 8 | */ 9 | 10 | 11 | /** 12 | * Array.prototype.swap 13 | * Rearrange an array to swap the positions of two elements. 14 | * @param {Number} a - the index of the first element to swap. 15 | * @param {Number} b - the index of the second element to swap. 16 | * @returns {Array} 17 | * @example 18 | * // returns [ 'a', 'c', 'b' ] 19 | * [ 'a', 'b', 'c' ].swap(1, 2) 20 | */ 21 | Array.prototype.swap = function (a, b) { 22 | if ( b >= this.length || b < 0 ) return this; 23 | 24 | // Temporary variable to hold data while we juggle 25 | let temp = this[a]; 26 | this[a] = this[b]; 27 | this[b] = temp; 28 | return this; 29 | }; 30 | 31 | /** 32 | * Array.range 33 | * Create a new array of length n, where the elements are numbers 34 | * from 0 to n - 1. 35 | * @param {Number} n - the desired length of the range. 36 | * @returns {Array} 37 | * @example 38 | * // returns [ 0, 1, 2, 3 ] 39 | * Array.range(4); 40 | */ 41 | Array.range = n => Array.from(new Array(n), (x,i) => i); 42 | 43 | /** 44 | * Array.matrix 45 | * Create a new two-dimensional array, where each element is its own index. 46 | * @param {Number} x - the desired number of columns (possible x values) 47 | * @param {Number} y - the desired number of rows (possible y values) 48 | * @returns {Array} 49 | * @example 50 | * // returns [ 51 | * // [ 0, 1, 2 ], 52 | * // [ 0, 1, 2 ] 53 | * // ] 54 | * Array.matrix(3, 2); 55 | */ 56 | Array.matrix = (x, y) => { 57 | const rows = Array.range(y); 58 | const columns = Array.range(x); 59 | return rows.map( (row, i) => columns.slice() ); 60 | } 61 | -------------------------------------------------------------------------------- /src/pages/home/Home.jsx: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | import React, { useState } from 'react'; 3 | import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; 4 | import Intro from './components/intro/Intro'; 5 | import Problems from './problems/Problems.jsx' 6 | import { Analytics } from "@vercel/analytics/react"; 7 | import Nav from '../../components/nav/Nav.jsx'; 8 | import NewFooter from '../../components/footer/NewFooter.jsx'; 9 | import DateStreak from '../../components/datestreak/DateStreak.jsx'; 10 | 11 | function Home() { 12 | return ( 13 |
14 | 15 |
16 | 17 | 18 | 19 |
20 | 21 |
22 | ); 23 | } 24 | 25 | export default Home; 26 | -------------------------------------------------------------------------------- /src/pages/home/components/Status/status.js: -------------------------------------------------------------------------------- 1 | const status = [ 2 | "Solved", 3 | "Unsolved", 4 | "Revise" 5 | ]; 6 | export default status; -------------------------------------------------------------------------------- /src/pages/home/components/Status/style.css: -------------------------------------------------------------------------------- 1 | .difficulty .eachTopic { 2 | background: #ECECEC; 3 | padding: 0.4rem 1rem; 4 | border-radius: 1.4rem; 5 | font-size: 0.92rem; 6 | margin: 0.2rem; 7 | transition: 0.5s; 8 | cursor: pointer; 9 | } 10 | 11 | .difficulty .eachTopic:hover { 12 | background: #ECECEC; 13 | transition: 0.5s; 14 | box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1); 15 | } 16 | 17 | .difficulty { 18 | border: 1.5px solid #ECECEC; 19 | border-radius: 2rem; 20 | height: auto; 21 | width: 20vw; 22 | margin-top: 3vh; 23 | } 24 | 25 | .difficulty .available-topics, 26 | .difficulty .selected { 27 | 28 | display: flex; 29 | flex-wrap: wrap; 30 | } 31 | 32 | .difficulty .topics { 33 | padding: 0.75rem; 34 | } 35 | 36 | .difficulty .selected .eachTopic { 37 | border: 1px solid rgb(208, 208, 208); 38 | background: #A1E5CD; 39 | } 40 | 41 | 42 | .difficulty .header { 43 | height: 4vh; 44 | background: #ECECEC; 45 | padding: 0.3rem 1.2rem; 46 | font-size: 1.3rem; 47 | display: flex; 48 | font-weight: 550; 49 | align-items: center; 50 | justify-content: center; 51 | color: rgb(65, 64, 64); 52 | font-size: 1.8rem; 53 | border-radius: 2rem; 54 | border-bottom-left-radius: 0rem; 55 | border-bottom-right-radius: 0rem; 56 | } -------------------------------------------------------------------------------- /src/pages/home/components/difficulty/data.js: -------------------------------------------------------------------------------- 1 | const topics = [ 2 | "Easy", 3 | "Medium", 4 | "Hard" 5 | ]; 6 | export default topics; -------------------------------------------------------------------------------- /src/pages/home/components/difficulty/style.css: -------------------------------------------------------------------------------- 1 | .difficulty .eachTopic { 2 | background: #ECECEC; 3 | padding: 0.4rem 1rem; 4 | border-radius: 1.4rem; 5 | font-size: 0.92rem; 6 | margin: 0.2rem; 7 | transition: 0.5s; 8 | cursor: pointer; 9 | } 10 | 11 | .difficulty .eachTopic:hover { 12 | background: #ECECEC; 13 | transition: 0.5s; 14 | box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1); 15 | } 16 | 17 | .difficulty { 18 | border: 1.5px solid #ECECEC; 19 | border-radius: 2rem; 20 | height: auto; 21 | width: 20vw; 22 | margin-top: 3vh; 23 | } 24 | 25 | .difficulty .available-topics, 26 | .difficulty .selected { 27 | 28 | display: flex; 29 | flex-wrap: wrap; 30 | } 31 | 32 | .difficulty .topics { 33 | padding: 0.75rem; 34 | } 35 | 36 | .difficulty .selected .eachTopic { 37 | border: 1px solid rgb(208, 208, 208); 38 | background: #A1E5CD; 39 | } 40 | 41 | 42 | .difficulty .header { 43 | height: 4vh; 44 | background: #ECECEC; 45 | padding: 0.3rem 1.2rem; 46 | font-size: 1.3rem; 47 | display: flex; 48 | font-weight: 550; 49 | align-items: center; 50 | justify-content: center; 51 | color: rgb(65, 64, 64); 52 | font-size: 1.8rem; 53 | border-radius: 2rem; 54 | border-bottom-left-radius: 0rem; 55 | border-bottom-right-radius: 0rem; 56 | } -------------------------------------------------------------------------------- /src/pages/home/components/horizontalScroll/style.css: -------------------------------------------------------------------------------- 1 | /* @import url("https://fonts.googleapis.com/css2?family=Anta&family=Archivo:ital,wght@0,100..900;1,100..900&family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Cutive&family=Kanit&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Poppins:wght@400;500;700&family=REM:ital,wght@0,100..900;1,100..900&family=Radio+Canada+Big:ital,wght@0,400..700;1,400..700&family=Raleway:ital,wght@0,100..900;1,100..900&family=Special+Elite&display=swap"); */ 2 | 3 | .horizontal-scroll-container { 4 | overflow: hidden; 5 | white-space: nowrap; 6 | position: relative; 7 | width: 100%; 8 | margin-top: 2.5vh; 9 | } 10 | 11 | .horizontal-scroll-content { 12 | display: flex; 13 | white-space: nowrap; 14 | font-size: 1.5rem; 15 | } 16 | 17 | .horizontal-scroll-span-text { 18 | display: inline-block; 19 | padding: 1px 2.2vw; 20 | white-space: nowrap; 21 | font-family: "Poppins", sans-serif; 22 | font-weight: 600; 23 | font-style: normal; 24 | color: #61d8ad; 25 | } -------------------------------------------------------------------------------- /src/pages/home/components/intro/assets/Programmer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/intro/assets/Programmer.gif -------------------------------------------------------------------------------- /src/pages/home/components/intro/assets/Telecommuting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/intro/assets/Telecommuting.gif -------------------------------------------------------------------------------- /src/pages/home/components/intro/assets/about.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/intro/assets/about.jpg -------------------------------------------------------------------------------- /src/pages/home/components/intro/assets/about1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/intro/assets/about1.jpg -------------------------------------------------------------------------------- /src/pages/home/components/intro/assets/coding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/intro/assets/coding.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/combineData.js: -------------------------------------------------------------------------------- 1 | const combineData = (problemsData, userProgressData) => { 2 | // If userProgressData is undefined, return problemsData directly 3 | if (!userProgressData) { 4 | return problemsData; 5 | } 6 | 7 | const combinedData = {}; 8 | 9 | for (const topic in problemsData) { 10 | combinedData[topic] = problemsData[topic].map(problem => { 11 | const { _id } = problem; 12 | 13 | // Check if the problem is bookmarked 14 | const isBookmarked = userProgressData.bookmarks.some(bookmark => bookmark.value === _id); 15 | 16 | // Check if the problem is a favorite 17 | const isFavourite = userProgressData.favourites.some(favourite => favourite.value === _id); 18 | 19 | // Get the notes associated with this problem 20 | const notesEntry = userProgressData.notes.find(note => note[0] === _id); 21 | const notes = notesEntry ? notesEntry[1] : []; 22 | 23 | // Get the solutions associated with this problem 24 | const solutionsEntry = userProgressData.solutions.find(solution => solution[0] === _id); 25 | const solutions = solutionsEntry ? solutionsEntry[1] : []; 26 | 27 | // Check if the problem is solved 28 | const isSolved = userProgressData.solvedProblems.some(solved => solved.value === _id); 29 | 30 | // Check if the problem is for revision 31 | const isRevision = userProgressData.revisionProblems.some(revision => revision.value === _id); 32 | 33 | return { 34 | ...problem, 35 | isBookmarked, 36 | isFavourite, 37 | notes, 38 | solutions, 39 | isSolved, 40 | isRevision 41 | }; 42 | }); 43 | } 44 | 45 | return combinedData; 46 | }; 47 | 48 | export default combineData; 49 | -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Apple.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Dell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Dell.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/GFG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/GFG.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/GFG.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Google.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Google.jpg -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/LeetCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/LeetCode.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Microsoft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Microsoft.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Spotify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Spotify.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/components/styles/Telegram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/problems/components/styles/Telegram.png -------------------------------------------------------------------------------- /src/pages/home/components/problems/style.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Anta&family=Archivo:ital,wght@0,100..900;1,100..900&family=Kanit&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Poppins:wght@400;500;700&family=Radio+Canada+Big:ital,wght@0,400..700;1,400..700&display=swap"); 2 | 3 | .DSA-problems-pagination { 4 | display: flex; 5 | margin-top: 20px; 6 | flex-wrap: wrap; 7 | margin-bottom: 2rem; 8 | align-items: center; 9 | justify-content: center; 10 | } 11 | 12 | .Topics { 13 | display: flex; 14 | justify-content: space-between; 15 | align-items: center; 16 | font-weight: 400; 17 | font-size: 1.5rem; 18 | margin: 0.5rem 0; 19 | margin-top: 0.7rem; 20 | min-height: 4vh; 21 | padding: 0.5rem 1.7rem; 22 | width: 92%; 23 | border-radius: 1rem; 24 | background-color: #a1e5cd; 25 | border: 1px solid black; 26 | box-sizing: border-box; 27 | } 28 | 29 | .Topics i { 30 | font-size: 1.5rem; 31 | } 32 | 33 | .DSA-problems-pagination-button { 34 | background-color: none; 35 | /* border: 1px solid #ccc; */ 36 | /* color: #333; */ 37 | padding: 5px 10px; 38 | margin: 0 5px; 39 | cursor: pointer; 40 | border-radius: 50%; 41 | font-family: "Radio Canada Big", sans-serif; 42 | font-optical-sizing: auto; 43 | font-weight: 400; 44 | font-style: normal; 45 | font-size: 1.2rem; 46 | border: 1px solid white; 47 | background-color: white; 48 | border-radius: 50%; 49 | width: 40px; 50 | height: 40px; 51 | color: grey; 52 | } 53 | 54 | .DSA-problems-pagination-button:hover { 55 | background-color: #bcffe9; 56 | color: black; 57 | } 58 | 59 | .DSA-problems-pagination-button:disabled { 60 | background-color: #bcffe9; 61 | color: black; 62 | /* cursor: not-allowed; */ 63 | /* border: 1px solid #aaa; */ 64 | } 65 | 66 | .DSA-problems-pagination-director { 67 | margin: 0.6rem 0rem; 68 | background-color: white; 69 | border: 0px; 70 | } 71 | 72 | .DSA-problems-pagination-director:hover { 73 | cursor: pointer; 74 | /* background-color: aliceblue; */ 75 | } 76 | .ellipse-pagination { 77 | display: flex; 78 | justify-content: center; 79 | align-items: center; 80 | } 81 | /* .DSA-problems-pagination 82 | 83 | .DSA-problems-pagination */ 84 | -------------------------------------------------------------------------------- /src/pages/home/components/sounds/buttonClick.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/sounds/buttonClick.mp3 -------------------------------------------------------------------------------- /src/pages/home/components/sounds/card-hover.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/sounds/card-hover.mp3 -------------------------------------------------------------------------------- /src/pages/home/components/sounds/card_flip.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/sounds/card_flip.mp3 -------------------------------------------------------------------------------- /src/pages/home/components/sounds/hover_quest.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/sounds/hover_quest.wav -------------------------------------------------------------------------------- /src/pages/home/components/sounds/loud_btn_clk.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/components/sounds/loud_btn_clk.wav -------------------------------------------------------------------------------- /src/pages/home/components/topics/Topics.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import topicsData from './data'; 3 | import './style.css'; 4 | import useSound from 'use-sound'; 5 | import loud_btn from '../sounds/loud_btn_clk.wav'; 6 | 7 | function Topics({ setSelectedTopics }) { 8 | const [play] = useSound(loud_btn); 9 | const [availableTopics, setAvailableTopics] = useState(topicsData); 10 | const [selectedTopics, setSelectedTopicsLocal] = useState([]); 11 | 12 | const handleTopicClick = (topic) => { 13 | play(); 14 | setAvailableTopics(availableTopics.filter(t => t !== topic)); 15 | const newSelectedTopics = [...selectedTopics, topic]; 16 | setSelectedTopicsLocal(newSelectedTopics); 17 | setSelectedTopics(newSelectedTopics); // Update parent state 18 | }; 19 | 20 | const handleSelectedTopicClick = (topic) => { 21 | play(); 22 | setSelectedTopicsLocal(selectedTopics.filter(t => t !== topic)); 23 | setAvailableTopics([...availableTopics, topic]); 24 | setSelectedTopics(selectedTopics.filter(t => t !== topic)); // Update parent state 25 | }; 26 | 27 | return ( 28 |
29 |
30 |

Topics

31 |
32 |
33 |
34 | {selectedTopics.map((topic, index) => ( 35 | handleSelectedTopicClick(topic)} className='eachTopic'> 36 | {topic} 37 | 38 | ))} 39 |
40 |
41 | {availableTopics.map((topic, index) => ( 42 | handleTopicClick(topic)} className='eachTopic'> 43 | {topic} 44 | 45 | ))} 46 |
47 |
48 |
49 | ); 50 | } 51 | 52 | export default Topics; -------------------------------------------------------------------------------- /src/pages/home/components/topics/data.js: -------------------------------------------------------------------------------- 1 | const topics = [ 2 | "Array", "String", "Stacks & Queues", "Matrix", "LinkedList", "Searching & Sorting", "Bit Manipulation", "Binary Trees", "Binary Search Trees", "Greedy", "Heap", "BackTracking", "Dynamic Programming", "Graph", 3 | "Trie" 4 | ]; 5 | export default topics; -------------------------------------------------------------------------------- /src/pages/home/components/topics/style.css: -------------------------------------------------------------------------------- 1 | .topicsComponent .eachTopic { 2 | background: #ECECEC; 3 | padding: 0.4rem 1rem; 4 | border-radius: 1.4rem; 5 | font-size: 1.1rem; 6 | margin: 0.2rem; 7 | transition: 0.5s; 8 | cursor: pointer; 9 | } 10 | 11 | .topicsComponent .eachTopic:hover { 12 | background: #ECECEC; 13 | transition: 0.5s; 14 | box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1); 15 | } 16 | 17 | .topicsComponent { 18 | border: 1.5px solid #ECECEC; 19 | border-radius: 2rem; 20 | height: auto; 21 | width: 20vw; 22 | margin-bottom: 2vh; 23 | 24 | } 25 | 26 | .topicsComponent .available-topics, 27 | .topicsComponent .selected { 28 | display: flex; 29 | flex-wrap: wrap; 30 | } 31 | 32 | .topicsComponent .topics { 33 | padding: 0.75rem; 34 | } 35 | 36 | .topicsComponent .selected .eachTopic { 37 | border: 1px solid rgb(208, 208, 208); 38 | background: #A1E5CD; 39 | } 40 | 41 | 42 | .topicsComponent .header { 43 | height: 4vh; 44 | background: #ECECEC; 45 | padding: 0.3rem 1.2rem; 46 | font-size: 1.3rem; 47 | display: flex; 48 | font-weight: 550; 49 | align-items: center; 50 | justify-content: center; 51 | color: rgb(65, 64, 64); 52 | font-size: 1.8rem; 53 | border-radius: 2rem; 54 | border-bottom-left-radius: 0rem; 55 | border-bottom-right-radius: 0rem; 56 | } 57 | @media (max-width: 700px){ 58 | .topicsComponent{ 59 | width: 80vw; 60 | } 61 | } -------------------------------------------------------------------------------- /src/pages/home/problems/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/home/problems/history.png -------------------------------------------------------------------------------- /src/pages/home/problems/style2.css: -------------------------------------------------------------------------------- 1 | 2 | @media (max-width: 700px) { 3 | .overtopics-container{ 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: center; 8 | margin-top: 20%; 9 | } 10 | .filter-button-opening{ 11 | position: fixed; 12 | top: 90%; 13 | left: 80%; 14 | display: flex; 15 | flex-direction: column; 16 | justify-content: center; 17 | align-items: center; 18 | padding: 1em; 19 | border: 0px solid transparent; 20 | background-color: rgba(161, 229, 205, 0.84); 21 | border-radius: 1.5em; 22 | transition: all 0.2s linear; 23 | font-size: 1.25em; 24 | } 25 | .filter-container { 26 | position: fixed; 27 | right: 0; 28 | top: 0; 29 | height: 100%; 30 | width: 100%; 31 | background: white; 32 | box-shadow: -2px 0 5px rgba(0,0,0,0.5); 33 | transform: translateX(100%); 34 | transition: transform 0.3s ease-in-out; 35 | z-index: 10; 36 | } 37 | 38 | .filter-container.open { 39 | transform: translateX(0); 40 | } 41 | 42 | .filter-overlay { 43 | display: none; 44 | } 45 | 46 | .filter-overlay.show { 47 | display: block; 48 | position: fixed; 49 | top: 0; 50 | left: 0; 51 | right: 0; 52 | bottom: 0; 53 | background: rgba(0,0,0,0.5); 54 | z-index: 5; 55 | } 56 | .filter-responsive-closing-button{ 57 | position: absolute; 58 | top: 3%; 59 | left: 7.5%; 60 | display: flex; 61 | flex-direction: column; 62 | justify-content: center; 63 | align-items: center; 64 | padding: 1em; 65 | border: 0px solid transparent; 66 | background-color: rgba(161, 229, 205, 0.84); 67 | border-radius: 1.5em; 68 | transition: all 0.2s linear; 69 | font-size: 1.25em; 70 | } 71 | } 72 | @media (min-width: 701px) { 73 | .filter-button-opening { 74 | display: none; 75 | } 76 | .filter-responsive-closing-button{ 77 | display: none; 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /src/pages/home/style.css: -------------------------------------------------------------------------------- 1 | .main { 2 | margin-top: 8vh; 3 | } 4 | @media (max-width: 800px) { 5 | .main { 6 | margin-top: 0vh; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/pages/profile/components/geeksforgeeks/GFG.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/pages/profile/components/geeksforgeeks/style.css: -------------------------------------------------------------------------------- 1 | .profile-page-geeksforgeeks-container { 2 | width: 90%; 3 | margin-left: 5vw; 4 | border: 1px solid #ccc; 5 | display: flex; 6 | flex-direction: column; 7 | margin-bottom: 5%; 8 | border-radius: 2rem; 9 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 10 | } 11 | .profile-page-geeksforgeeks-header { 12 | font-family: "Poppins", sans-serif; 13 | font-weight: 700; 14 | font-style: normal; 15 | font-size: 2.5vw; 16 | display: flex; 17 | align-items: center; 18 | margin-top: 6vh; 19 | justify-content: center; 20 | } 21 | .profile-page-geeksforgeeks-header img { 22 | padding-left: 1vw; 23 | } 24 | .profile-page-geeksforgeeks-inner-container { 25 | display: flex; 26 | height: 100%; 27 | margin-bottom: 8vh; 28 | } 29 | .profile-page-geeksforgeeks-inner-container-1 { 30 | width: 50%; 31 | display: flex; 32 | flex-direction: column; 33 | justify-content: center; 34 | align-items: center; 35 | } 36 | .profile-page-geeksforgeeks-username { 37 | color: #2f8d46; 38 | font-family: "Poppins", sans-serif; 39 | font-weight: 600; 40 | font-style: normal; 41 | margin-bottom: 1vh; 42 | 43 | font-size: 4vh; 44 | } 45 | .profile-page-geeksforgeeks-institute-rank { 46 | display: flex; 47 | align-items: center; 48 | justify-content: center; 49 | } 50 | .profile-page-geeksforgeeks-medal-icon { 51 | font-size: 4vh; 52 | margin-right: 0.5vw; 53 | margin-left: -1vw; 54 | } 55 | .profile-page-geeksforgeeks-institute-rank h2 { 56 | margin: 0; 57 | font-family: "Poppins", sans-serif; 58 | font-weight: 400; 59 | font-style: normal; 60 | 61 | font-size: 3.5vh; 62 | } 63 | .profile-page-geeksforgeeks-institute-rank span { 64 | font-weight: 600; 65 | } 66 | .profile-page-geeksforgeeks-inner-sub-container { 67 | display: flex; 68 | justify-content: space-around; 69 | width: 100%; 70 | margin-top: 7vh; 71 | } 72 | .profile-page-geeksforgeeks-problems-solved { 73 | display: flex; 74 | justify-content: center; 75 | align-items: center; 76 | flex-direction: column; 77 | width: 50%; 78 | } 79 | .profile-page-geeksforgeeks-problems-solved h2 { 80 | margin: 0; 81 | font-family: "Poppins", sans-serif; 82 | font-weight: 600; 83 | font-style: normal; 84 | display: flex; 85 | flex-wrap: wrap; 86 | font-size: 3.5vh; 87 | } 88 | .profile-page-geeksforgeeks-vertical-line { 89 | border-left: 2px solid #c7c2c2; 90 | height: auto; 91 | align-self: stretch; 92 | } 93 | .profile-page-geeksforgeeks-donutchart { 94 | border: none; 95 | } 96 | -------------------------------------------------------------------------------- /src/pages/profile/components/leetcode/LeetCode.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { LuMedal } from "react-icons/lu"; 3 | import DonutChart from "../donutchart/DonutChart"; 4 | import LC from "./LeetCode.png"; 5 | export default function LeetCode() { 6 | return ( 7 |
8 |

9 | Leetcode Leetcode{" "} 10 |

11 | 12 |
13 |
17 | 18 |
19 | 20 |
21 |
22 |
23 |

27 | johndoe586 28 |

29 |
30 | 31 |

32 | 28 rank 33 |

34 |
35 |
36 |
37 |
38 |

Problems solved

39 |

135

40 |
41 |
42 |

Languages Used

43 |

C++, Java, Python

44 |
45 |
46 |
47 |
48 |

Badges

49 |

5

50 |
51 |
52 |

Total Submissions

53 |

450

54 |
55 |
56 |
57 |
58 |
59 | ); 60 | } 61 | -------------------------------------------------------------------------------- /src/pages/profile/components/leetcode/LeetCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/profile/components/leetcode/LeetCode.png -------------------------------------------------------------------------------- /src/pages/profile/components/problemSolvedChart/style.css: -------------------------------------------------------------------------------- 1 | /* Import the Poppins font from Google Fonts */ 2 | @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"); 3 | 4 | .ProblemSolvedFrame { 5 | padding: 20px; 6 | border: 1px solid #ccc; 7 | border-radius: 8px; 8 | width: 90%; 9 | max-height: 300px; 10 | margin: 0 auto; 11 | font-family: "Poppins", sans-serif; 12 | } 13 | 14 | .ProblemsSolvedHeader { 15 | display: flex; 16 | justify-content: space-between; 17 | align-items: center; 18 | margin-bottom: 20px; 19 | } 20 | 21 | .ProblemSolvedNavigation { 22 | display: flex; 23 | align-items: center; 24 | } 25 | 26 | .ProblemSolvedNavigation button { 27 | background: none; 28 | border: none; 29 | cursor: pointer; 30 | padding: 0 10px; 31 | } 32 | 33 | .ProblemSolvedNavigation span { 34 | margin: 0 10px; 35 | } 36 | .ProblemsSolvedLineChart { 37 | width: 90%; 38 | height: 40%; 39 | } 40 | -------------------------------------------------------------------------------- /src/pages/profile/components/problemSolvedChart/style2.css: -------------------------------------------------------------------------------- 1 | .ProblemSolvedFrame { 2 | padding: 2%; 3 | border-radius: 5%; 4 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 5 | background-color: #fff; 6 | width: 60%; /* Adjusted to use percentage */ 7 | margin: auto; 8 | font-family: "Poppins", sans-serif; 9 | box-sizing: border-box; 10 | margin: 0; 11 | display: flex; 12 | flex-direction: column; 13 | align-items: center; 14 | justify-content: center; 15 | position: relative; 16 | } 17 | 18 | .ProblemsSolvedHeader { 19 | display: flex; 20 | /* position: relative; */ 21 | align-items: center; 22 | margin-bottom: 2%; 23 | /* Adjusted to use percentage */ 24 | width: 100%; 25 | justify-content: space-around; 26 | } 27 | 28 | .ProblemSolvedNavigation { 29 | display: flex; 30 | align-items: center; 31 | } 32 | 33 | .ProblemSolvedNavigation button { 34 | background: none; 35 | border: none; 36 | cursor: pointer; 37 | } 38 | 39 | .RangeSelector { 40 | display: flex; 41 | gap: 5%; /* Adjusted to use percentage */ 42 | } 43 | 44 | .RangeSelector span { 45 | display: flex; 46 | align-items: center; 47 | justify-content: center; 48 | cursor: pointer; 49 | padding: 6px; /* Adjusted to use percentage */ 50 | border-radius: 5px; 51 | background-color: #f0f0f0; 52 | transition: background-color 0.3s; 53 | font-size: 0.6em; /* Adjusted for readability */ 54 | width: 4vw; /* Ensures uniform width */ 55 | height: 3vh; /* Ensures uniform height */ 56 | text-align: center; 57 | } 58 | 59 | .RangeSelector span.active, 60 | .RangeSelector span:hover { 61 | background-color: #d0d0d0; 62 | } 63 | -------------------------------------------------------------------------------- /src/pages/profile/components/userDetails/style.css: -------------------------------------------------------------------------------- 1 | .profile-card { 2 | width: 85%; 3 | border: 1px solid #ddd; 4 | border-radius: 2rem; 5 | padding: 16px; 6 | text-align: center; 7 | background-color: #fff; 8 | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); 9 | margin: 0 auto; 10 | display: flex; 11 | justify-content: space-evenly; 12 | align-items: center; 13 | font-family: "Poppins"; 14 | margin-top: 5%; 15 | } 16 | 17 | .profile-image { 18 | width: 200px; 19 | height: 200px; 20 | margin: 0 auto 16px; 21 | border-radius: 50%; 22 | overflow: hidden; 23 | background-color: #f0f0f0; 24 | display: flex; 25 | align-items: center; 26 | justify-content: center; 27 | } 28 | 29 | .profile-image img { 30 | width: 100%; 31 | height: 100%; 32 | object-fit: cover; 33 | } 34 | 35 | .image-placeholder { 36 | color: #999; 37 | font-size: 14px; 38 | } 39 | 40 | .profile-info { 41 | text-align: left; 42 | font-size: 1.2rem; 43 | } 44 | 45 | .profile-info-item { 46 | display: flex; 47 | align-items: center; 48 | margin-bottom: 5%; 49 | } 50 | 51 | .profile-info-icon { 52 | margin-right: 1.3rem; 53 | font-size: 1.5rem; 54 | } 55 | .profile-info-item a { 56 | text-decoration: none; 57 | color: #000; 58 | } 59 | 60 | .upload__image-wrapper { 61 | margin-top: 16px; 62 | } 63 | 64 | .image-item__btn-wrapper { 65 | display: flex; 66 | justify-content: center; 67 | margin-top: 8px; 68 | } 69 | 70 | .profile-page-user-details-button { 71 | margin: 4px; 72 | } 73 | .profile-page-user-details-button { 74 | padding: 1.3em 3em; 75 | font-size: 12px; 76 | text-transform: uppercase; 77 | letter-spacing: 2.5px; 78 | font-weight: 500; 79 | color: #000; 80 | background-color: #fff; 81 | border: none; 82 | border-radius: 45px; 83 | box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1); 84 | transition: all 0.3s ease 0s; 85 | cursor: pointer; 86 | outline: none; 87 | } 88 | 89 | .profile-page-user-details-button:hover { 90 | background-color: #23c483; 91 | box-shadow: 0px 15px 20px rgba(46, 229, 157, 0.4); 92 | color: #fff; 93 | transform: translateY(-7px); 94 | } 95 | 96 | .profile-page-user-details-button:active { 97 | transform: translateY(-1px); 98 | } 99 | -------------------------------------------------------------------------------- /src/pages/profile/style.css: -------------------------------------------------------------------------------- 1 | .first-divider-profile { 2 | width: 90%; 3 | margin: 5%; 4 | color: #c7c2c2; 5 | } 6 | .second-section-profile-page { 7 | display: flex; 8 | margin: 0 5%; 9 | } 10 | .third-section-profile-page { 11 | margin: 5%; 12 | display: flex; 13 | align-items: center; 14 | justify-content: center; 15 | /* width: 100%; */ 16 | } 17 | .fourth-section-profile-page { 18 | width: 90%; 19 | margin: 5%; 20 | margin-bottom: 0; 21 | } 22 | .fifth-section-profile-page { 23 | width: 90%; 24 | margin: 5%; 25 | margin-top: 0; 26 | } 27 | -------------------------------------------------------------------------------- /src/pages/settings/Settings.jsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Surya-0804/dsa-tracker-website/75916b037994bf278a4e50790cf2508647f088eb/src/pages/settings/Settings.jsx -------------------------------------------------------------------------------- /src/pages/solution/Solution.jsx: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | import React, { useState } from 'react'; 3 | import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; 4 | import { Analytics } from "@vercel/analytics/react"; 5 | import Nav from '../../components/nav/Nav.jsx'; 6 | import SolutionPage from '../solutionpage/SolutionPage.jsx'; 7 | import NewFooter from '../../components/footer/NewFooter.jsx'; 8 | function Home() { 9 | return ( 10 |
11 | 12 |
18 | ); 19 | } 20 | 21 | export default Home; 22 | -------------------------------------------------------------------------------- /src/pages/solution/style.css: -------------------------------------------------------------------------------- 1 | .Solution { 2 | margin-top: 15vh; 3 | } -------------------------------------------------------------------------------- /src/pages/solutionpage/SolutionPage.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Anta&family=Archivo:ital,wght@0,100..900;1,100..900&family=Kanit&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Poppins:wght@400;500;700&display=swap"); 2 | @keyframes borderAnimation { 3 | 0% { 4 | border-color: #06ffb0; 5 | } 6 | 25% { 7 | border-color: #37b68e; 8 | } 9 | 50% { 10 | border-color: #128560; 11 | } 12 | 75% { 13 | border-color: #65edc2; 14 | } 15 | 100% { 16 | border-color: #06ffb0; 17 | } 18 | } 19 | .solution-page-container { 20 | border: 2px solid #1fbd84; 21 | animation: borderAnimation 4s infinite; 22 | padding: 2rem; 23 | max-width: 800px; 24 | margin: 2rem auto; 25 | border-radius: 8px; 26 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 27 | } 28 | 29 | .solution-page-problem-name { 30 | font-family: "Poppins", sans-serif; 31 | font-weight: 700; 32 | font-style: normal; 33 | color: #252424; 34 | font-size: 2.5rem; 35 | margin-bottom: 1rem; 36 | } 37 | 38 | .solution-page-problem-sub-heading { 39 | font-family: "Poppins", sans-serif; 40 | font-weight: 500; 41 | font-style: normal; 42 | color: #1fbd84; 43 | font-size: 1.8rem; 44 | margin: 1rem 0 0.5rem; 45 | } 46 | 47 | .solution-page-problem-description { 48 | font-family: "Poppins", sans-serif; 49 | font-weight: 400; 50 | font-style: normal; 51 | font-size: 1.1rem; 52 | color: #575555; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | .tabs { 57 | display: flex; 58 | border-bottom: 2px solid #ddd; 59 | margin-bottom: 20px; 60 | } 61 | 62 | .tabs .tab { 63 | background: none; 64 | border: none; 65 | padding: 10px 20px; 66 | cursor: pointer; 67 | font-family: "Poppins", sans-serif; 68 | font-weight: 500; 69 | font-size: 1.2rem; 70 | color: #575555; 71 | margin-right: 5px; 72 | border-bottom: 2px solid transparent; 73 | transition: color 0.3s, border-bottom-color 0.3s; 74 | } 75 | 76 | .tabs .tab:hover { 77 | color: #1fbd84; 78 | } 79 | 80 | .tabs .tab.active { 81 | color: #1fbd84; 82 | border-bottom-color: #1fbd84; 83 | text-transform: uppercase; 84 | 85 | } 86 | 87 | .copyBtn { 88 | background-color: #d7d8df; 89 | color: #f8f8f2; 90 | border: none; 91 | padding: 5px 10px; 92 | cursor: pointer; 93 | border-radius: 5px; 94 | } -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/store/userInfo.js: -------------------------------------------------------------------------------- 1 | import { jwtDecode } from 'jwt-decode'; // Correct import syntax for jwt-decode 2 | 3 | const getUserIdFromToken = () => { 4 | const token = localStorage.getItem('token'); 5 | if (!token) { 6 | return null; 7 | } 8 | try { 9 | const decoded = jwtDecode(token); 10 | return decoded._id; 11 | } catch (error) { 12 | console.error('Invalid token:', error); 13 | return null; 14 | } 15 | }; 16 | 17 | const getUserName = () => { 18 | const user = localStorage.getItem('user'); 19 | if (!user) { 20 | return null; 21 | } 22 | try { 23 | const parsedUser = JSON.parse(user); // Parse the user object from local storage 24 | return parsedUser.name; 25 | } catch (error) { 26 | console.error('Invalid user data:', error); 27 | return null; 28 | } 29 | }; 30 | 31 | export { getUserIdFromToken, getUserName }; // Exporting functions correctly 32 | --------------------------------------------------------------------------------