임동욱 임동욱 07-27
refactor: 레이아웃 3종 라우트 그룹 구조 재편
Co-Authored-By: Claude Opus 5 
@58026b1918653b49630bd52e3cd488d4b306847a
app/(protected)/(basic)/_components/admin-header.tsx (Renamed from app/(protected)/_components/admin-header.tsx)
--- app/(protected)/_components/admin-header.tsx
+++ app/(protected)/(basic)/_components/admin-header.tsx
@@ -1,4 +1,4 @@
-import { logout } from '../_actions';
+import { logout } from '@/app/(protected)/_actions';
 
 export function AdminHeader() {
   return (
 
app/(protected)/(basic)/layout.tsx (added)
+++ app/(protected)/(basic)/layout.tsx
@@ -0,0 +1,16 @@
+import { AdminHeader } from './_components/admin-header';
+
+// Basic 레이아웃 — 헤더가 있는 일반 관리자 화면 진입점. 보안 강제는 상위 `(protected)/layout.tsx`가
+// 담당하므로 여기서는 크롬 조립만 책임진다.
+export default function Layout({
+  children,
+}: Readonly<{
+  children: React.ReactNode;
+}>) {
+  return (
+    <div className="flex min-h-screen flex-col">
+      <AdminHeader />
+      <main className="flex flex-1 flex-col">{children}</main>
+    </div>
+  );
+}
app/(protected)/(basic)/page.tsx (Renamed from app/(protected)/page.tsx)
--- app/(protected)/page.tsx
+++ app/(protected)/(basic)/page.tsx
No changes
 
app/(protected)/(empty)/layout.tsx (added)
+++ app/(protected)/(empty)/layout.tsx
@@ -0,0 +1,10 @@
+// Empty 레이아웃 — 헤더·사이드바 없이 전체 화면을 쓰는 보호 화면 진입점. 보안 강제는 상위
+// `(protected)/layout.tsx`가 담당하므로(세션 재검증·bfcache 방어 상속) 여기서는 크롬을 두지 않는다.
+// 이 그룹에는 아직 화면(page.tsx)이 없다 — 최초 Empty 화면 작업 시 이 레이아웃 아래에 추가한다.
+export default function Layout({
+  children,
+}: Readonly<{
+  children: React.ReactNode;
+}>) {
+  return <div className="flex min-h-screen flex-col">{children}</div>;
+}
app/(protected)/layout.tsx
--- app/(protected)/layout.tsx
+++ app/(protected)/layout.tsx
@@ -1,8 +1,10 @@
-import { AdminHeader } from './_components/admin-header';
 import { BfcacheGuard } from './_components/bfcache-guard';
 
 // 인증 최종 판단은 하지 않는다(Partial Rendering 때문에 레이아웃은 인증 체크 지점으로 부적합 —
 // Next.js 공식 authentication 가이드 지침). 대신 캐시 차단만 명시적으로 강제한다.
+//
+// 이 레이어는 보호 영역 전체의 공통 보안층으로 축소되어 있다 — 크롬(헤더·사이드바 등)은
+// 하위 레이아웃((basic)/(empty))의 책임이며, 여기서는 세션 재검증 강제와 bfcache 방어만 담당한다.
 export const dynamic = 'force-dynamic';
 
 export default function Layout({
@@ -11,10 +13,9 @@
   children: React.ReactNode;
 }>) {
   return (
-    <div className="flex min-h-screen flex-col">
+    <>
       <BfcacheGuard />
-      <AdminHeader />
-      <main className="flex flex-1 flex-col">{children}</main>
-    </div>
+      {children}
+    </>
   );
 }
 
app/(public)/layout.tsx (added)
+++ app/(public)/layout.tsx
@@ -0,0 +1,13 @@
+// Auth 레이아웃 — 배경 위 카드를 화면 중앙에 배치하는 공용 래퍼. `(public)` 하위 화면(로그인 등)이
+// 공유한다.
+export default function Layout({
+  children,
+}: Readonly<{
+  children: React.ReactNode;
+}>) {
+  return (
+    <main className="flex min-h-screen flex-1 items-center justify-center bg-background p-6">
+      {children}
+    </main>
+  );
+}
app/(public)/login/page.tsx
--- app/(public)/login/page.tsx
+++ app/(public)/login/page.tsx
@@ -12,9 +12,5 @@
     redirect('/');
   }
 
-  return (
-    <main className="flex min-h-screen flex-1 items-center justify-center bg-background p-6">
-      <LoginForm />
-    </main>
-  );
+  return <LoginForm />;
 }
Add a comment
List