From c342db0890d3194c4886bde3fd63dc0da104dd9c Mon Sep 17 00:00:00 2001 From: pragya0129 Date: Tue, 19 May 2026 13:12:12 +0530 Subject: [PATCH 1/2] feat(mobile): add responsive dashboard navigation menu --- web/src/components/layout/MainLayout.tsx | 109 ++++++++++++++++++----- 1 file changed, 86 insertions(+), 23 deletions(-) diff --git a/web/src/components/layout/MainLayout.tsx b/web/src/components/layout/MainLayout.tsx index 7011bef..9fdd246 100644 --- a/web/src/components/layout/MainLayout.tsx +++ b/web/src/components/layout/MainLayout.tsx @@ -1,8 +1,8 @@ "use client"; import { useEffect, useState } from "react"; -import { motion } from "framer-motion"; -import { PenTool, Search, Briefcase, Bell, User, Trophy } from "lucide-react"; +import { motion, AnimatePresence } from "framer-motion"; +import { PenTool, Search, Briefcase, Bell, User, Trophy, Menu, X, } from "lucide-react"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { cn } from "@/lib/utils"; @@ -22,6 +22,7 @@ export function MainLayout({ children }: { children: React.ReactNode }) { const role = useUserRole(); const isEditor = role === "editor" || role === "admin"; const [isMounted, setIsMounted] = useState(false); + const [mobileMenuOpen, setMobileMenuOpen] = useState(false); useEffect(() => { setIsMounted(true); @@ -32,7 +33,11 @@ export function MainLayout({ children }: { children: React.ReactNode }) { }, [authenticated, router, isMounted]); if (!isMounted || !authenticated) { - return
Preparing workspace...
; + return ( +
+ Preparing workspace... +
+ ); } const items = isEditor @@ -52,13 +57,13 @@ export function MainLayout({ children }: { children: React.ReactNode }) { animate={{ y: 0 }} className="fixed top-0 inset-x-0 z-50 p-6 flex justify-center pointer-events-none" > -
+
{/* Logo */} -
- -
- Pub +
+ +
+ Pub {/* Nav Links */} @@ -78,23 +83,81 @@ export function MainLayout({ children }: { children: React.ReactNode }) { ))} + + {/* User Section */} -
- - - - - - - +
+ + + + + + +
+ + {mobileMenuOpen && ( + +
+ {items.map((item) => ( + setMobileMenuOpen(false)} + className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" + > + + {item.label} + + ))} + + setMobileMenuOpen(false)} + className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" + > + + Notifications + + + setMobileMenuOpen(false)} + className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" + > + + Profile + + + +
+
+ )} +
{/* Page Content */} @@ -109,7 +172,7 @@ export function MainLayout({ children }: { children: React.ReactNode }) { {/* Footer */}
- © 2026 Writers' Pub • The Digital Atelier • Premium Creative Ecosystem + © 2026 Writers' Pub • The Digital Atelier • Premium Creative Ecosystem
); From db387fdc96cf51efe968667e3aeb8191ac7590eb Mon Sep 17 00:00:00 2001 From: pragya0129 Date: Tue, 19 May 2026 21:14:21 +0530 Subject: [PATCH 2/2] fix: improve mobile navigation drawer responsiveness --- web/src/components/layout/MainLayout.tsx | 104 +++++++++++++---------- 1 file changed, 61 insertions(+), 43 deletions(-) diff --git a/web/src/components/layout/MainLayout.tsx b/web/src/components/layout/MainLayout.tsx index 9fdd246..a79fd85 100644 --- a/web/src/components/layout/MainLayout.tsx +++ b/web/src/components/layout/MainLayout.tsx @@ -28,6 +28,18 @@ export function MainLayout({ children }: { children: React.ReactNode }) { setIsMounted(true); }, []); + useEffect(() => { + if (mobileMenuOpen) { + document.body.style.overflow = "hidden"; + } else { + document.body.style.overflow = ""; + } + + return () => { + document.body.style.overflow = ""; + }; + }, [mobileMenuOpen]); + useEffect(() => { if (isMounted && !authenticated) router.replace("/login"); }, [authenticated, router, isMounted]); @@ -55,7 +67,7 @@ export function MainLayout({ children }: { children: React.ReactNode }) {
{/* Logo */} @@ -109,53 +121,59 @@ export function MainLayout({ children }: { children: React.ReactNode }) {
{mobileMenuOpen && ( - -
- {items.map((item) => ( + <> +
setMobileMenuOpen(false)} + /> + +
+ {items.map((item) => ( + setMobileMenuOpen(false)} + className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" + > + + {item.label} + + ))} + + setMobileMenuOpen(false)} + className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" + > + + Notifications + + setMobileMenuOpen(false)} className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" > - - {item.label} + + Profile - ))} - - setMobileMenuOpen(false)} - className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" - > - - Notifications - - - setMobileMenuOpen(false)} - className="flex items-center gap-3 border-b border-[#4a5033]/10 pb-3" - > - - Profile - - - -
-
+ + +
+ + )}