MCPcopy
hub / github.com/stackryze/FreeDomains / DashboardLayout

Function DashboardLayout

src/layouts/DashboardLayout.jsx:37–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35);
36
37export default function DashboardLayout() {
38 const location = useLocation();
39 const { logout } = useAuth();
40 const [sidebarOpen, setSidebarOpen] = useState(false);
41
42 const isActive = (path) => location.pathname === path;
43
44 // Close sidebar when route changes (mobile)
45 useEffect(() => {
46 setSidebarOpen(false);
47 }, [location.pathname]);
48
49 // Prevent body scroll when mobile menu is open
50 useEffect(() => {
51 if (sidebarOpen) {
52 document.body.style.overflow = 'hidden';
53 } else {
54 document.body.style.overflow = 'unset';
55 }
56 return () => {
57 document.body.style.overflow = 'unset';
58 };
59 }, [sidebarOpen]);
60
61 const SidebarContent = () => (
62 <>
63 <div className="p-6 space-y-2 overflow-y-auto flex-1">
64 <SidebarItem
65 to="/dashboard"
66 icon={LayoutDashboard}
67 label="Overview"
68 active={isActive("/dashboard")}
69 onClick={() => setSidebarOpen(false)}
70 />
71 <SidebarItem
72 to="/my-domains"
73 icon={Globe}
74 label="My Domains"
75 active={isActive("/my-domains")}
76 onClick={() => setSidebarOpen(false)}
77 />
78 <SidebarItem
79 to="/dns"
80 icon={Server}
81 label="DNS Records"
82 active={isActive("/dns")}
83 onClick={() => setSidebarOpen(false)}
84 />
85 <SidebarItem
86 to="/register"
87 icon={Plus}
88 label="Register Domain"
89 active={isActive("/register")}
90 onClick={() => setSidebarOpen(false)}
91 />
92 <SidebarItem
93 to="/history"
94 icon={Clock}

Callers

nothing calls this directly

Calls 1

useAuthFunction · 0.90

Tested by

no test coverage detected