6af863199f
- fito-nextjs 기반으로 재구성 - 로그인: MOMO 로고 + 모모유통 + 유통관리 ERP, 하단에 본사/지사 주소 표시 - 사이드바 상단: MOMO 아이콘 + 모모유통 + 유통관리 ERP - 파비콘: /src/app/icon.svg (MOMO 그린 배지) - layout.tsx title: 모모유통 | 유통관리 ERP - DB: 183.99.177.40:5432/distribution (fito 스키마 import 완료) - Traefik: Host(momo.junggomoa.com), 컨테이너 momo-erp
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { useAuthStore } from "@/store/auth-store";
|
|
import { Sidebar } from "@/components/layout/sidebar";
|
|
import { Header } from "@/components/layout/header";
|
|
import { Loading } from "@/components/ui/loading";
|
|
|
|
// mainFS.jsp 대응 - 프레임셋 → Sidebar + Header + Content 레이아웃
|
|
export default function MainLayout({ children }: { children: React.ReactNode }) {
|
|
const router = useRouter();
|
|
const { user, isLoading, fetchUser } = useAuthStore();
|
|
|
|
useEffect(() => {
|
|
fetchUser();
|
|
}, [fetchUser]);
|
|
|
|
useEffect(() => {
|
|
if (!isLoading && !user) {
|
|
router.push("/login");
|
|
}
|
|
}, [isLoading, user, router]);
|
|
|
|
if (isLoading) {
|
|
return <Loading message="로딩 중..." />;
|
|
}
|
|
|
|
if (!user) return null;
|
|
|
|
return (
|
|
<div className="flex h-screen overflow-hidden">
|
|
{/* 사이드바 (menu.jsp 대응) */}
|
|
<Sidebar />
|
|
|
|
{/* 메인 영역 */}
|
|
<div className="flex-1 flex flex-col overflow-hidden">
|
|
{/* 헤더 (header.jsp 대응) */}
|
|
<Header />
|
|
|
|
{/* 콘텐츠 (contents_page iframe 대응) */}
|
|
<main className="flex-1 overflow-hidden p-4 flex flex-col min-h-0">
|
|
{children}
|
|
</main>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|