diff --git a/package-lock.json b/package-lock.json index 4a61b00bf..fbf0d0f87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,6 +52,7 @@ "react-day-picker": "^8.10.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.0", + "react-loading-skeleton": "^3.5.0", "react-markdown": "^10.1.0", "react-quill": "^2.0.0", "react-resizable-panels": "^2.1.3", @@ -7438,6 +7439,15 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "license": "MIT" }, + "node_modules/react-loading-skeleton": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/react-loading-skeleton/-/react-loading-skeleton-3.5.0.tgz", + "integrity": "sha512-gxxSyLbrEAdXTKgfbpBEFZCO/P153DnqSCQau2+o6lNy1jgMRr2MmRmOzMmyrwSaSYLRB8g7b0waYPmUjz7IhQ==", + "license": "MIT", + "peerDependencies": { + "react": ">=16.8.0" + } + }, "node_modules/react-markdown": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", diff --git a/package.json b/package.json index ca21d37a4..32a4fc7b7 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "react-day-picker": "^8.10.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.0", + "react-loading-skeleton": "^3.5.0", "react-markdown": "^10.1.0", "react-quill": "^2.0.0", "react-resizable-panels": "^2.1.3", diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 0aa7e8246..74ec870f3 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -14,6 +14,17 @@ const Navbar = () => { setIsMenuOpen(!isMenuOpen); }; + const navigateAndScroll = (sectionId: string) => { + if (window.location.pathname !== "/") { + navigate("/", { state: { scrollTo: sectionId } }); + } else { + const el = document.getElementById(sectionId); + if (el) { + el.scrollIntoView({ behavior: "smooth" }); + } + } + }; + return (