Compare commits

..

2 Commits

Author SHA1 Message Date
taekyoungc
5d733ac0d8 Revert "운영 메뉴에서 지정판매소 활성 상태가 중복되지 않도록 보정"
This reverts commit 48e5578611.
2026-04-14 00:41:14 +09:00
taekyoungc
2629644f90 Revert "운영 Whoops 방지를 위해 메뉴 활성 계산 의존성을 단순화"
This reverts commit c8d1612f0e.
2026-04-14 00:41:14 +09:00
2 changed files with 24 additions and 45 deletions

View File

@@ -16,23 +16,10 @@ $userNav = session_user_nav_display();
$currentPath = current_nav_request_path(); $currentPath = current_nav_request_path();
$adminNavTree = get_admin_nav_tree(); $adminNavTree = get_admin_nav_tree();
$activeAdminTopNav = null; /** DB 링크(mm_link)만 사용. 짧게 적은 항목(menus 등)은 실제 URI(admin/menus)와 맞춰 후보 비교 */
$activeAdminTopLen = -1; $adminNavItemIsCurrent = static function (?string $mmLink) use ($currentPath): bool {
$activeAdminTopNum = PHP_INT_MAX; return menu_link_matches_request($mmLink, $currentPath, []);
foreach ($adminNavTree as $topNode) { };
$nodeLen = -1;
$activeChild = site_nav_active_child_for_parent($topNode, $currentPath, []);
if ($activeChild !== null) {
$nodeLen = strlen(menu_link_preferred_href_path($activeChild->mm_link ?? null, $currentPath));
} elseif (menu_link_matches_request($topNode->mm_link ?? null, $currentPath, [])) {
$nodeLen = strlen(menu_link_preferred_href_path($topNode->mm_link ?? null, $currentPath));
}
if ($nodeLen > $activeAdminTopLen || ($nodeLen === $activeAdminTopLen && (int) ($topNode->mm_num ?? 0) < $activeAdminTopNum)) {
$activeAdminTopNav = $topNode;
$activeAdminTopLen = $nodeLen;
$activeAdminTopNum = (int) ($topNode->mm_num ?? 0);
}
}
/** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */ /** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */
$isActive = static function (string $path) use ($uri, $seg3) { $isActive = static function (string $path) use ($uri, $seg3) {
@@ -106,7 +93,15 @@ body { overflow: hidden; }
<?php <?php
$hasChildren = ! empty($navItem->children); $hasChildren = ! empty($navItem->children);
$parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath); $parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
$parentIsCurrent = ($activeAdminTopNav !== null && $navItem === $activeAdminTopNav); $parentIsCurrent = $adminNavItemIsCurrent($navItem->mm_link ?? null);
if (! $parentIsCurrent && $hasChildren) {
foreach ($navItem->children as $ch) {
if ($adminNavItemIsCurrent($ch->mm_link ?? null)) {
$parentIsCurrent = true;
break;
}
}
}
?> ?>
<div class="relative group"> <div class="relative group">
<a class="<?= $parentIsCurrent ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" <a class="<?= $parentIsCurrent ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
@@ -117,13 +112,10 @@ body { overflow: hidden; }
<?php /* 사이트 메뉴와 동일: 호버 끊김 방지 pt-1, 키보드 포커스, z-index */ ?> <?php /* 사이트 메뉴와 동일: 호버 끊김 방지 pt-1, 키보드 포커스, z-index */ ?>
<div class="absolute left-0 top-full z-50 hidden pt-1 min-w-[12rem] group-hover:block group-focus-within:block"> <div class="absolute left-0 top-full z-50 hidden pt-1 min-w-[12rem] group-hover:block group-focus-within:block">
<div class="bg-white border border-gray-200 rounded shadow-lg py-1"> <div class="bg-white border border-gray-200 rounded shadow-lg py-1">
<?php
$activeChild = site_nav_active_child_for_parent($navItem, $currentPath, []);
?>
<?php foreach ($navItem->children as $child): ?> <?php foreach ($navItem->children as $child): ?>
<?php <?php
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath); $childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
$childIsCurrent = $activeChild !== null && $child === $activeChild; $childIsCurrent = $adminNavItemIsCurrent($child->mm_link ?? null);
?> ?>
<?php if ($childLink !== ''): ?> <?php if ($childLink !== ''): ?>
<a href="<?= base_url($childLink) ?>" <a href="<?= base_url($childLink) ?>"

View File

@@ -13,24 +13,6 @@ if ($effectiveLgIdx) {
$effectiveLgName = $lgRow ? $lgRow->lg_name : null; $effectiveLgName = $lgRow ? $lgRow->lg_name : null;
} }
$userNav = session_user_nav_display(); $userNav = session_user_nav_display();
$activeTopNav = null;
$activeTopLen = -1;
$activeTopNum = PHP_INT_MAX;
foreach ($siteNavTree as $topNode) {
$nodeLen = -1;
$activeChild = site_nav_active_child_for_parent($topNode, $currentPath, $dashboardPathAliases);
if ($activeChild !== null) {
$nodeLen = strlen(menu_link_preferred_href_path($activeChild->mm_link ?? null, $currentPath));
} elseif (site_nav_link_matches_current($topNode->mm_link ?? null, $currentPath, $dashboardPathAliases)) {
$nodeLen = strlen(menu_link_preferred_href_path($topNode->mm_link ?? null, $currentPath));
}
if ($nodeLen > $activeTopLen || ($nodeLen === $activeTopLen && (int) ($topNode->mm_num ?? 0) < $activeTopNum)) {
$activeTop = $topNode;
$activeTopLen = $nodeLen;
$activeTopNum = (int) ($topNode->mm_num ?? 0);
}
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ko"> <html lang="ko">
@@ -89,7 +71,15 @@ body { overflow: hidden; }
<?php foreach ($siteNavTree as $navItem): ?> <?php foreach ($siteNavTree as $navItem): ?>
<?php <?php
$navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath); $navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
$isActive = ($activeTop !== null && $navItem === $activeTop); $isActive = site_nav_link_matches_current($navItem->mm_link ?? null, $currentPath, $dashboardPathAliases);
if (! $isActive && ! empty($navItem->children)) {
foreach ($navItem->children as $ch) {
if (site_nav_link_matches_current($ch->mm_link ?? null, $currentPath, $dashboardPathAliases)) {
$isActive = true;
break;
}
}
}
?> ?>
<div class="relative group"> <div class="relative group">
<a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>" <a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
@@ -100,13 +90,10 @@ body { overflow: hidden; }
<?php /* -mt-1 + pt-2: 부모 링크와 패널이 살짝 겹쳐 호버가 끊기지 않게 함. z-index: 드롭다운 클릭 우선 */ ?> <?php /* -mt-1 + pt-2: 부모 링크와 패널이 살짝 겹쳐 호버가 끊기지 않게 함. z-index: 드롭다운 클릭 우선 */ ?>
<div class="absolute left-0 top-full z-[200] -mt-1 pt-2 min-w-[12rem] hidden group-hover:block group-focus-within:block"> <div class="absolute left-0 top-full z-[200] -mt-1 pt-2 min-w-[12rem] hidden group-hover:block group-focus-within:block">
<div class="bg-white border border-gray-200 rounded shadow-lg py-1"> <div class="bg-white border border-gray-200 rounded shadow-lg py-1">
<?php
$activeChild = site_nav_active_child_for_parent($navItem, $currentPath, $dashboardPathAliases);
?>
<?php foreach ($navItem->children as $child): ?> <?php foreach ($navItem->children as $child): ?>
<?php <?php
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath); $childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
$childCurrent = $activeChild !== null && $child === $activeChild; $childCurrent = menu_link_matches_request($child->mm_link ?? null, $currentPath, $dashboardPathAliases);
?> ?>
<?php if ($childLink !== ''): ?> <?php if ($childLink !== ''): ?>
<a href="<?= base_url($childLink) ?>" <a href="<?= base_url($childLink) ?>"