diff --git a/layers/components/layouts/EventNavigation.vue b/layers/components/layouts/EventNavigation.vue index e7a2ff1..a23d757 100644 --- a/layers/components/layouts/EventNavigation.vue +++ b/layers/components/layouts/EventNavigation.vue @@ -27,10 +27,10 @@ const getEventNavigation = async (): Promise(null) @@ -48,45 +50,29 @@ const hasGnbMenus = computed(() => { return Object.keys(menus).length > 0 }) +const currentPath = computed(() => formatPathWithoutLocale(route.path)) const gnb1depthButtonData = computed( () => gnbData.value?.buttons[0]?.button_json as GameDataResourceGroup ) const gnb2depthButtonData = computed( () => gnbData.value?.buttons[1]?.button_json as GameDataResourceGroupSet ) -const currentPath = computed(() => formatPathWithoutLocale(route.path)) const supportedPlatforms = computed( () => - getSupportedPlatforms(gameData.value?.os_type, { - platformType: gameData.value?.platform_type, - }) as PlatformTransformType[] + getSupportedPlatforms( + gameData.value?.os_type, + gameData.value?.platform_type + ) as PlatformTransformType[] ) -const pathMatches = (base: string, current: string) => { - if (!base || base === '/') return current === '/' - return current === base -} - -/** 자식 중 활성 링크 존재 여부 */ +// 자식 중 활성 링크 존재 여부 확인 const hasActiveChild = (children?: GameDataMenuChildren) => { - const cur = currentPath.value return formatToArray(children).some(child => { - if (!child?.url_path || !isInternalUrl(child.url_path)) return false - return pathMatches(formatPathWithoutLocale(child.url_path), cur) + if (!child?.url_path || child.click_action_type === 2) return false + return formatPathWithoutLocale(child.url_path) === currentPath.value }) } -/** 1Depth 활성화 여부 */ -const isNavItemActive = (gnbItem: GameDataMenu): boolean => { - const cur = currentPath.value - const base = gnbItem?.url_path - const selfActive = - !!base && - isInternalUrl(base) && - pathMatches(formatPathWithoutLocale(base), cur) - return selfActive || hasActiveChild(gnbItem.children) -} - // navAreaRef의 넓이를 구하는 함수 const calculateNavWidth = () => { if (!import.meta.client) return @@ -158,7 +144,9 @@ const handleMenuOpen = () => { scrollStore.controlScrollLock(true) } -const handleMenuClose = () => { +const handleMenuClose = (isPassing: boolean = false) => { + if (isPassing) return + isMenuOpen.value = false scrollStore.controlScrollLock(false) } @@ -198,7 +186,7 @@ const showNotSupportedOSAlert = () => { } const handleStartClick = () => { - if (breakpoints.value.isDesktop) return + if (device.isDesktop) return const target = device.isAndroid ? 'google_play' @@ -259,7 +247,7 @@ onMounted(() => {