Merge branch 'jskim-node' of origin into jskim-node
Resolve conflict in AppLayout.tsx - keep both sidebar collapse and hasPopMenus state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,11 +109,14 @@ const convertMenuToUI = (menus: MenuItem[], userInfo: ExtendedUserInfo | null, p
|
||||
.filter((menu) => (menu.parent_obj_id || menu.PARENT_OBJ_ID) === parentId)
|
||||
.filter((menu) => (menu.status || menu.STATUS) === "active")
|
||||
.filter((menu) => {
|
||||
// 회사관리 메뉴는 최고관리자만 표시
|
||||
// 최고관리자 전용 메뉴 필터링
|
||||
const url = (menu.menu_url || menu.MENU_URL || "").toLowerCase();
|
||||
if (url.includes("companylist") || url.includes("company-list")) {
|
||||
return isSuperAdmin;
|
||||
}
|
||||
if (url.includes("smart-factory-log")) {
|
||||
return isSuperAdmin;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.sort((a, b) => (a.seq || a.SEQ || 0) - (b.seq || b.SEQ || 0));
|
||||
@@ -260,6 +263,7 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
});
|
||||
const [collapsedHover, setCollapsedHover] = useState(false);
|
||||
const collapsedHoverTimer = useRef<NodeJS.Timeout | null>(null);
|
||||
const [hasPopMenus, setHasPopMenus] = useState(false);
|
||||
|
||||
const toggleSidebarCollapse = () => {
|
||||
setSidebarCollapsed((prev) => {
|
||||
@@ -344,6 +348,26 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
return () => window.removeEventListener("resize", checkIsMobile);
|
||||
}, []);
|
||||
|
||||
// POP 메뉴 존재 여부 확인
|
||||
useEffect(() => {
|
||||
const checkPopMenus = async () => {
|
||||
try {
|
||||
const response = await menuApi.getPopMenus();
|
||||
if (response.success && response.data) {
|
||||
const { childMenus, landingMenu } = response.data;
|
||||
setHasPopMenus(!!(landingMenu?.menu_url || childMenus.length > 0));
|
||||
} else {
|
||||
setHasPopMenus(false);
|
||||
}
|
||||
} catch {
|
||||
setHasPopMenus(false);
|
||||
}
|
||||
};
|
||||
if (user) {
|
||||
checkPopMenus();
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
// 프로필 관련 로직
|
||||
const {
|
||||
isModalOpen,
|
||||
@@ -718,10 +742,12 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
<FileCheck className="mr-2 h-4 w-4" />
|
||||
<span>결재함</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={handlePopModeClick}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
<span>POP 모드</span>
|
||||
</DropdownMenuItem>
|
||||
{hasPopMenus && (
|
||||
<DropdownMenuItem onClick={handlePopModeClick}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
<span>POP 모드</span>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<div className="px-1 py-0.5">
|
||||
<ThemeToggle />
|
||||
@@ -978,10 +1004,12 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
<FileCheck className="mr-2 h-4 w-4" />
|
||||
<span>결재함</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={handlePopModeClick}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
<span>POP 모드</span>
|
||||
</DropdownMenuItem>
|
||||
{hasPopMenus && (
|
||||
<DropdownMenuItem onClick={handlePopModeClick}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
<span>POP 모드</span>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={handleLogout}>
|
||||
<LogOut className="mr-2 h-4 w-4" />
|
||||
|
||||
Reference in New Issue
Block a user