From 982a0861c716126760b01f695cc3bad20f77e1d0 Mon Sep 17 00:00:00 2001 From: Sohan Rout Date: Sun, 16 Aug 2026 14:27:18 +0530 Subject: [PATCH] fix : fixed mobile responsiveness --- app/components/SectionsDisplay.jsx | 83 ++- app/components/hero.jsx | 4 +- app/components/modules/CodeBlock.jsx | 26 +- app/components/ui/NewsletterEmbed.jsx | 21 +- app/components/ui/graph.jsx | 230 ++------- app/components/ui/graphChart.jsx | 222 ++++++++ .../graph/algorithms/dijkstra/page.jsx | 12 +- .../graph/algorithms/kruskal/page.jsx | 12 +- app/visualizer/graph/algorithms/prim/page.jsx | 12 +- .../algorithms/topological-sort/page.jsx | 12 +- .../representation/adjacency-list/page.jsx | 12 +- .../representation/adjacency-matrix/page.jsx | 12 +- app/visualizer/graph/traversal/bfs/page.jsx | 12 +- app/visualizer/graph/traversal/dfs/page.jsx | 12 +- .../linkedList/operations/comparison/page.jsx | 10 +- .../linkedList/operations/deletion/page.jsx | 10 +- .../linkedList/operations/insertion/page.jsx | 10 +- .../linkedList/operations/merge/page.jsx | 10 +- .../linkedList/operations/reverse/page.jsx | 10 +- .../linkedList/operations/search/page.jsx | 10 +- .../linkedList/operations/traversal/page.jsx | 10 +- .../linkedList/types/circular/animation.jsx | 2 +- .../linkedList/types/circular/page.jsx | 10 +- .../linkedList/types/doubly/page.jsx | 10 +- .../linkedList/types/singly/animation.jsx | 2 +- .../linkedList/types/singly/page.jsx | 12 +- .../queue/implementation/array/codeblock.jsx | 7 +- .../queue/implementation/array/page.jsx | 8 +- .../queue/implementation/linkedList/page.jsx | 8 +- .../queue/operations/enqueue-dequeue/page.jsx | 12 +- .../queue/operations/isempty/animation.jsx | 2 +- .../queue/operations/isempty/page.jsx | 12 +- .../queue/operations/isfull/animation.jsx | 2 +- .../queue/operations/isfull/page.jsx | 12 +- .../queue/operations/peek-front/page.jsx | 12 +- .../queue/types/circular/animation.jsx | 2 +- app/visualizer/queue/types/circular/page.jsx | 12 +- .../queue/types/deque/animation.jsx | 2 +- app/visualizer/queue/types/deque/page.jsx | 12 +- .../queue/types/priority/animation.jsx | 2 +- app/visualizer/queue/types/priority/page.jsx | 12 +- .../queue/types/singleEnded/animation.jsx | 2 +- .../queue/types/singleEnded/page.jsx | 12 +- .../searching/binarysearch/page.jsx | 12 +- .../searching/linearsearch/animation.jsx | 2 +- .../searching/linearsearch/content.jsx | 1 - .../searching/linearsearch/page.jsx | 13 +- app/visualizer/sorting/.next/trace | 1 + app/visualizer/sorting/.next/trace-build | 1 + .../sorting/bubblesort/animation.jsx | 2 +- app/visualizer/sorting/bubblesort/page.jsx | 10 +- .../sorting/insertionsort/animation.jsx | 2 +- app/visualizer/sorting/insertionsort/page.jsx | 10 +- .../sorting/mergesort/animation.jsx | 2 +- app/visualizer/sorting/mergesort/content.jsx | 485 ++++++++++++++++++ app/visualizer/sorting/mergesort/page.jsx | 10 +- .../sorting/quicksort/animation.jsx | 2 +- app/visualizer/sorting/quicksort/page.jsx | 10 +- .../sorting/selectionsort/animation.jsx | 2 +- app/visualizer/sorting/selectionsort/page.jsx | 10 +- .../stack/implementation/usingArray/page.jsx | 6 +- .../implementation/usingLinkedList/page.jsx | 6 +- app/visualizer/stack/isempty/content.jsx | 198 ++++++- app/visualizer/stack/isempty/page.jsx | 8 +- app/visualizer/stack/isfull/animation.jsx | 262 ++++++---- app/visualizer/stack/isfull/content.jsx | 264 ++++++++-- app/visualizer/stack/isfull/page.jsx | 8 +- app/visualizer/stack/peek/animation.jsx | 218 ++++---- app/visualizer/stack/peek/content.jsx | 238 ++++++++- app/visualizer/stack/peek/page.jsx | 10 +- .../stack/polish/postfix/animation.jsx | 2 +- app/visualizer/stack/polish/postfix/page.jsx | 8 +- .../stack/polish/prefix/animation.jsx | 2 +- app/visualizer/stack/polish/prefix/page.jsx | 8 +- app/visualizer/stack/push-pop/page.jsx | 10 +- .../trees/advanced/b-trees/page.jsx | 12 +- .../trees/advanced/fenwick-tree/page.jsx | 12 +- .../trees/advanced/prefix-tree/page.jsx | 12 +- .../trees/advanced/red-black/page.jsx | 12 +- .../trees/advanced/segment-trees/page.jsx | 12 +- .../lowest-common-ancestor/page.jsx | 12 +- .../algorithms/serialize-deserialize/page.jsx | 12 +- .../trees/algorithms/tree-diameter/page.jsx | 12 +- .../algorithms/tree-isomorphism/page.jsx | 12 +- .../applications/decision-trees/page.jsx | 12 +- .../trees/applications/heap-sort/page.jsx | 12 +- .../applications/huffman-coding/page.jsx | 12 +- .../trees/applications/syntax-trees/page.jsx | 12 +- .../trees/binaryTree/properties/page.jsx | 12 +- .../trees/binaryTree/types/page.jsx | 8 +- app/visualizer/trees/bst/avl/page.jsx | 12 +- app/visualizer/trees/bst/deletion/page.jsx | 12 +- app/visualizer/trees/bst/insertion/page.jsx | 12 +- app/visualizer/trees/bst/searching/page.jsx | 12 +- .../trees/traversal/in-order/page.jsx | 12 +- .../trees/traversal/level-order/page.jsx | 12 +- .../trees/traversal/morris/page.jsx | 12 +- .../trees/traversal/post-order/page.jsx | 12 +- .../trees/traversal/pre-order/page.jsx | 12 +- bun.lock | 0 public/sitemap-0.xml | 156 +++--- 101 files changed, 2269 insertions(+), 913 deletions(-) create mode 100755 app/components/ui/graphChart.jsx create mode 100755 app/visualizer/sorting/.next/trace create mode 100755 app/visualizer/sorting/.next/trace-build mode change 100644 => 100755 bun.lock diff --git a/app/components/SectionsDisplay.jsx b/app/components/SectionsDisplay.jsx index 7ef4919..c4e2c50 100755 --- a/app/components/SectionsDisplay.jsx +++ b/app/components/SectionsDisplay.jsx @@ -1,27 +1,69 @@ 'use client'; import Link from 'next/link'; -import { motion } from 'framer-motion'; +import { motion, AnimatePresence } from 'framer-motion'; import { FiChevronRight, FiSearch, FiInfo } from 'react-icons/fi'; -import { useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; const InfoPopup = ({ info }) => { return ( -
+ {Object.entries(info).map(([key, value]) => (
{key}: {value}
))} -
+ ); }; const SectionsDisplay = ({ sections, searchQuery }) => { const [hoveredSection, setHoveredSection] = useState(null); + // Touch devices get tap-to-toggle; pointer devices keep the hover behaviour. + const [hasHover, setHasHover] = useState(true); + const infoRef = useRef(null); + + useEffect(() => { + const mq = window.matchMedia('(hover: hover) and (pointer: fine)'); + const update = () => setHasHover(mq.matches); + update(); + mq.addEventListener('change', update); + return () => mq.removeEventListener('change', update); + }, []); + + // Dismiss the popup on scroll, on a tap outside it, or on Escape. + useEffect(() => { + if (hoveredSection === null || hasHover) return; + + const close = () => setHoveredSection(null); + const onPointerDown = (e) => { + if (!infoRef.current?.contains(e.target)) close(); + }; + const onKeyDown = (e) => { + if (e.key === 'Escape') close(); + }; + + window.addEventListener('scroll', close, { passive: true, capture: true }); + window.addEventListener('resize', close); + document.addEventListener('pointerdown', onPointerDown); + document.addEventListener('keydown', onKeyDown); + return () => { + window.removeEventListener('scroll', close, { capture: true }); + window.removeEventListener('resize', close); + document.removeEventListener('pointerdown', onPointerDown); + document.removeEventListener('keydown', onKeyDown); + }; + }, [hoveredSection, hasHover]); return ( -
+
{sections.map((section, sectionIndex) => ( { className="group relative bg-white dark:bg-neutral-950 rounded-2xl shadow-sm border border-gray-200 dark:border-gray-700/50 overflow-hidden transition-all duration-300 hover:shadow-lg hover:border-blue-400/30 dark:hover:border-blue-500/30" > {/* Section Header */} -
+
{section.icon} @@ -39,15 +81,30 @@ const SectionsDisplay = ({ sections, searchQuery }) => {

{section.title}

{section.info && ( -
setHoveredSection(sectionIndex)} - onMouseLeave={() => setHoveredSection(null)} + ref={hoveredSection === sectionIndex ? infoRef : null} + onMouseEnter={hasHover ? () => setHoveredSection(sectionIndex) : undefined} + onMouseLeave={hasHover ? () => setHoveredSection(null) : undefined} > - - {hoveredSection === sectionIndex && ( - - )} + + + {hoveredSection === sectionIndex && ( + + )} +
)}
diff --git a/app/components/hero.jsx b/app/components/hero.jsx index 3ab0185..0410fdf 100755 --- a/app/components/hero.jsx +++ b/app/components/hero.jsx @@ -51,9 +51,9 @@ const HeroSection = () => { className="path" /> - Updates: Stack Visualization Updated ! + New : Added Graphs & Trees visualizer ! - +