Skip to content

Commit 6da9721

Browse files
feat: implement MainLayout with secret admin redirect and create DashboardLayout for admin portal navigation
1 parent 615e3f1 commit 6da9721

5 files changed

Lines changed: 15 additions & 100 deletions

File tree

‎Frontend/package-lock.json‎

Lines changed: 4 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Frontend/package.json‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@
1313
"dependencies": {
1414
"@marsidev/react-turnstile": "^1.5.3",
1515
"@reduxjs/toolkit": "^2.12.0",
16-
"@tailwindcss/vite": "^4.3.0",
1716
"@tinymce/tinymce-react": "^6.3.0",
1817
"axios": "^1.18.1",
19-
"framer-motion": "^12.39.0",
2018
"lucide-react": "^1.25.0",
2119
"react": "^19.2.0",
2220
"react-dom": "^19.2.0",
2321
"react-hook-form": "^7.81.0",
2422
"react-redux": "^9.3.0",
2523
"react-router-dom": "^7.15.1",
26-
"react-scroll": "^1.9.3",
2724
"tinymce": "^8.7.0"
2825
},
2926
"devDependencies": {
3027
"@eslint/js": "^9.39.1",
28+
"@tailwindcss/vite": "^4.3.0",
3129
"@types/react": "^19.2.7",
3230
"@types/react-dom": "^19.2.3",
3331
"@vitejs/plugin-react": "^5.1.1",

‎Frontend/src/layout/MainLayout.jsx‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Outlet, useNavigate, useLocation } from "react-router-dom";
33
import Navbar from "./Navbar";
44
import Footer from "./Footer"; // Import the new component
55
import contentData from "../data/content.json";
6-
import { AnimatePresence, motion } from "framer-motion";
76

87
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
98

@@ -33,20 +32,10 @@ const MainLayout = () => {
3332
<div className="app-shell flex flex-col min-h-screen">
3433
<Navbar layout={layout} />
3534

36-
3735
<Suspense fallback={<div className="flex h-[60vh] items-center justify-center"><div className="animate-spin h-8 w-8 border-4 border-accent border-t-transparent rounded-full"></div></div>}>
38-
<AnimatePresence mode="popLayout" initial={false}>
39-
<motion.main
40-
key={location.pathname}
41-
initial={{ opacity: 0, y: 15 }}
42-
animate={{ opacity: 1, y: 0 }}
43-
exit={{ opacity: 0, y: -15 }}
44-
transition={{ duration: 0.25, ease: "easeOut" }}
45-
className="w-full mx-auto flex-1 border-x border-border bg-bg-soft"
46-
>
47-
<Outlet />
48-
</motion.main>
49-
</AnimatePresence>
36+
<main className="w-full mx-auto flex-1 border-x border-border bg-bg-soft">
37+
<Outlet />
38+
</main>
5039
</Suspense>
5140

5241
<Footer layout={layout} onFooterClick={handleFooterClick} />

‎Frontend/src/pages/admin/DashboardLayout.jsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ export default function DashboardLayout() {
2929
const location = useLocation();
3030
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
3131

32-
// Close sidebar on route change (mobile)
32+
const contentRef = React.useRef(null);
33+
34+
// Close sidebar and reset scroll to top on route change
3335
useEffect(() => {
3436
setIsSidebarOpen(false);
37+
if (contentRef.current) {
38+
contentRef.current.scrollTop = 0;
39+
}
3540
}, [location.pathname]);
3641

3742
const navItems = [
@@ -142,7 +147,7 @@ export default function DashboardLayout() {
142147
</div>
143148
</header>
144149

145-
<div className="relative z-10 flex-1 overflow-y-auto">
150+
<div ref={contentRef} className="relative z-10 flex-1 overflow-y-auto">
146151
<Outlet />
147152
</div>
148153
</main>

‎Frontend/vite.config.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export default defineConfig({
1212
"react",
1313
"react-dom",
1414
"react-router-dom",
15-
"framer-motion",
1615
"lucide-react",
1716
"@reduxjs/toolkit",
1817
"react-redux",

0 commit comments

Comments
 (0)