@@ -80,7 +102,11 @@ export default function Sidebar({
const isActive = activeMenu === item.id;
return (
-
+
{/* 메인 메뉴 버튼 */}
diff --git a/src/layouts/DashboardLayout.tsx b/src/layouts/DashboardLayout.tsx
index f619e519..2cb0f591 100644
--- a/src/layouts/DashboardLayout.tsx
+++ b/src/layouts/DashboardLayout.tsx
@@ -89,12 +89,7 @@ export default function DashboardLayout({ children }: DashboardLayoutProps) {
// 메뉴 탐색 함수: 메인 메뉴와 서브메뉴 모두 탐색
const findActiveMenu = (items: MenuItem[]): { menuId: string; parentId?: string } | null => {
for (const item of items) {
- // 현재 메뉴의 경로와 일치하는지 확인
- if (item.path && normalizedPath.startsWith(item.path)) {
- return { menuId: item.id };
- }
-
- // 서브메뉴가 있으면 재귀적으로 탐색
+ // 서브메뉴가 있으면 먼저 확인 (더 구체적인 경로 우선)
if (item.children && item.children.length > 0) {
for (const child of item.children) {
if (child.path && normalizedPath.startsWith(child.path)) {
@@ -102,6 +97,11 @@ export default function DashboardLayout({ children }: DashboardLayoutProps) {
}
}
}
+
+ // 서브메뉴에서 매칭되지 않으면 현재 메뉴 확인
+ if (item.path && normalizedPath.startsWith(item.path)) {
+ return { menuId: item.id };
+ }
}
return null;
};
@@ -163,7 +163,7 @@ export default function DashboardLayout({ children }: DashboardLayoutProps) {
{/* 데스크톱 사이드바 (모바일에서 숨김) */}
diff --git a/src/middleware.ts b/src/middleware.ts
index 622d8119..d32936da 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -92,6 +92,17 @@ function isBot(userAgent: string): boolean {
return BOT_PATTERNS.some(pattern => pattern.test(userAgent));
}
+/**
+ * Check if user-agent is Internet Explorer
+ * IE 11: Contains "Trident" in user-agent
+ * IE 10 and below: Contains "MSIE" in user-agent
+ */
+function isInternetExplorer(userAgent: string): boolean {
+ if (!userAgent) return false;
+
+ return /MSIE|Trident/.test(userAgent);
+}
+
/**
* Check if the path should be protected from bots
*/
@@ -180,6 +191,16 @@ export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
const userAgent = request.headers.get('user-agent') || '';
+ // 🚨 0️⃣ Internet Explorer Detection (최우선 처리)
+ // IE 사용자는 지원 안내 페이지로 리다이렉트
+ if (isInternetExplorer(userAgent)) {
+ // unsupported-browser.html 페이지 자체는 제외 (무한 리다이렉트 방지)
+ if (!pathname.includes('unsupported-browser')) {
+ console.log(`[IE Blocked] ${userAgent} attempted to access ${pathname}`);
+ return NextResponse.redirect(new URL('/unsupported-browser.html', request.url));
+ }
+ }
+
// 1️⃣ 로케일 제거
const pathnameWithoutLocale = getPathnameWithoutLocale(pathname);