update: layout
Build and Release / release (push) Successful in 27s

This commit is contained in:
2026-04-29 16:32:46 +07:00
parent 65806d197f
commit 41af501b51
5 changed files with 128 additions and 87 deletions
+6 -11
View File
@@ -8,7 +8,6 @@ import { apiGetCurrentUser } from "@/service/auth";
import { setUserData } from "@/store/features/userSlice";
import React, { useEffect } from "react";
import { useDispatch } from "react-redux";
import { usePathname } from "next/navigation";
export default function AdminLayout({
children,
@@ -17,8 +16,6 @@ export default function AdminLayout({
}) {
const { isExpanded, isHovered, isMobileOpen } = useSidebar();
const dispatch = useDispatch()
const pathname = usePathname();
const isHomePage = pathname === "/";
useEffect(() => {
const fetchUser = async () => {
@@ -34,19 +31,17 @@ export default function AdminLayout({
// Dynamic class for main content margin based on sidebar state
const mainContentMargin = isHomePage
const mainContentMargin = isMobileOpen
? "ml-0"
: isMobileOpen
? "ml-0"
: isExpanded || isHovered
? "lg:ml-[290px]"
: "lg:ml-[90px]";
: isExpanded || isHovered
? "lg:ml-[290px]"
: "lg:ml-[0px]";
return (
<div className="min-h-screen xl:flex">
{/* Sidebar and Backdrop */}
{!isHomePage && <AppSidebar />}
{!isHomePage && <Backdrop />}
<AppSidebar />
<Backdrop />
{/* Main Content Area */}
<div
className={`flex-1 transition-all duration-300 ease-in-out ${mainContentMargin}`}