Files
frontend/apps/wr/app/base.tsx
T

41 lines
1.4 KiB
TypeScript

"use client";
import { BaseLayout } from "@common/components/ui";
import { useWrStore } from "./store";
import { MainDiv } from "@common/business_components/ui";
import type { MenuItem } from "./store/common/type/menu";
import { usePathname, useRouter } from "next/navigation";
import { useMenuStore } from "@/src/shared/lib";
import { PageLayout } from "@/src/shared/ui/page-layout";
export default function Base({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const { getMenuAuthrts } = useWrStore((state) => state);
const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo);
const router = useRouter();
const pathname = usePathname();
const changeMenu = (path: MenuItem) => {
setCurrentMenuInfo(path);
getMenuAuthrts(path.menuCd);
if (path.menuKornNm === "하수재이용통계") {
// console.log("외부 페이지로 이동합니다. " ,path);
// const popupOptions = `width=${window.screen.availWidth},height=${window.screen.availHeight},left=0,top=0,resizable=yes,scrollbars=yes`;
// path.newWndwYn ='N'
// window.open(path.urlPath, "candidatePopup", popupOptions);
return null;
} else {
router.push(path.urlPath);
}
};
return (
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
<PageLayout>
<MainDiv>{children}</MainDiv>
</PageLayout>
</BaseLayout>
);
}