fix. 코드 경고 수정

This commit is contained in:
clkim
2025-12-29 15:42:46 +09:00
parent 98280c0139
commit 61e1438ac1
5 changed files with 24 additions and 73 deletions

View File

@@ -7,11 +7,11 @@ import type {
} from '#layers/types/api/gameData'
const nuxtApp = useNuxtApp()
const { locale } = useI18n()
const gameDataStore = useGameDataStore()
const modalStore = useModalStore()
const scrollStore = useScrollStore()
const { locale } = useI18n()
const { setGameData } = gameDataStore
const { gameData } = storeToRefs(gameDataStore)
@@ -111,24 +111,11 @@ if (serverGameData) {
setupMetaData(serverGameData)
}
// Google Analytics 설정 (클라이언트에서만 실행)
if (import.meta.client) {
const { gtag, initialize } = useGtag()
initialize(gameData.value?.ga_code)
gtag('event', 'screen_view', {
app_name: 'My App',
screen_name: 'Home',
})
}
let rafId: number | null = null
let stopWatch: (() => void) | null = null
onMounted(() => {
if (!import.meta.client) return
useEventListener('scroll', scrollStore.updateScrollValue, { passive: true })
stopWatch = watch(
scrollGnbPosition,
newValue => {
@@ -145,6 +132,13 @@ onMounted(() => {
},
{ immediate: true }
)
const { gtag, initialize } = useGtag()
initialize(gameData.value?.ga_code)
gtag('event', 'screen_view', {
app_name: 'My App',
screen_name: 'Home',
})
})
onBeforeUnmount(() => {

View File

@@ -2,30 +2,14 @@ import type { LocaleObject, NuxtI18nOptions } from '@nuxtjs/i18n'
// const LANG_DIR: string = './i18n/locales'
const DEFAULT_COVERAGES: string[] = [
'en',
'ja',
'ko',
'zh-tw',
'fr',
'de',
'es',
'pt',
'th',
'zh-cn',
]
const DEFAULT_COVERAGES: string[] = ['ko', 'en', 'ja', 'zh-tw', 'zh-cn', 'th']
const DEFAULT_LOCALES: Record<string, LocaleObject> = {
en: { code: 'en', name: 'English', iso: 'en', dir: 'ltr' },
'zh-tw': { code: 'zh-tw', name: '繁體中文', iso: 'zh-tw', dir: 'ltr' },
ja: { code: 'ja', name: '日本語', iso: 'ja', dir: 'ltr' },
ko: { code: 'ko', name: '한국어', iso: 'ko-KR', dir: 'ltr' },
fr: { code: 'fr', name: 'Français', iso: 'fr', dir: 'ltr' },
de: { code: 'de', name: 'Deutsch', iso: 'de', dir: 'ltr' },
es: { code: 'es', name: 'Español', iso: 'es', dir: 'ltr' },
pt: { code: 'pt', name: 'Português', iso: 'pt', dir: 'ltr' },
th: { code: 'th', name: 'ภาษาไทย', iso: 'th', dir: 'ltr' },
en: { code: 'en', name: 'English', iso: 'en', dir: 'ltr' },
ja: { code: 'ja', name: '日本語', iso: 'ja', dir: 'ltr' },
'zh-tw': { code: 'zh-tw', name: '繁體中文', iso: 'zh-tw', dir: 'ltr' },
'zh-cn': { code: 'zh-cn', name: '简体中文', iso: 'zh-cn', dir: 'ltr' },
th: { code: 'th', name: 'ภาษาไทย', iso: 'th', dir: 'ltr' },
}
const DEFAULT_LOCALE_CODE = 'ko'
@@ -41,7 +25,6 @@ const getI18n = (allowedLangCodes?: string[]): NuxtI18nOptions => {
code => ({
code: code as LocaleObject['code'],
file: `${code}.ts`,
// 아래의 옵셔널 체이닝(?.)은 해당 코드가 undefined일 경우를 안전하게 처리합니다.
name: DEFAULT_LOCALES[code]?.name ?? code,
iso: DEFAULT_LOCALES[code]?.iso ?? code,
// dir 속성은 모든 로케일 객체에 공통적으로 존재하므로, 여기서 추가할 수도 있습니다.
@@ -58,7 +41,7 @@ const getI18n = (allowedLangCodes?: string[]): NuxtI18nOptions => {
detectBrowserLanguage: {
fallbackLocale: DEFAULT_LOCALE_CODE,
useCookie: true,
cookieKey: 'LOCALE',
cookieKey: 'LOCALE',
cookieDomain: process.env.BASE_DOMAIN,
redirectOn: 'root',
},
@@ -68,31 +51,8 @@ const getI18n = (allowedLangCodes?: string[]): NuxtI18nOptions => {
escapeHtml: false,
},
debug: false,
// 동적으로 언어 제외 설정을 위한 pages 설정
// customRoutes: 'config',
// pages:
// allowedLangCodes && allowedLangCodes.length > 0
// ? generatePageExclusions(allowedLangCodes)
// : {},
// 추가적인 설정이 필요하다면 여기에 포함시킬 수 있습니다.
}
}
// gameData.lang_codes를 기반으로 언어 제외 설정을 생성하는 함수
// const generatePageExclusions = (
// allowedLangCodes: string[]
// ): Record<string, any> => {
// const exclusions: Record<string, any> = {}
// // 모든 기본 언어에 대해 제외 설정 생성
// DEFAULT_COVERAGES.forEach(langCode => {
// if (!allowedLangCodes.includes(langCode)) {
// // 해당 언어가 허용되지 않으면 모든 페이지에서 제외
// exclusions[langCode] = false
// }
// })
// return exclusions
// }
export { DEFAULT_LOCALE_CODE, DEFAULT_COVERAGES, getI18n }

View File

@@ -1,8 +1,9 @@
export default defineNuxtPlugin(() => {
const router = useRouter()
const modalStore = useModalStore()
router.beforeEach((to, from) => {
const modalStore = useModalStore()
if (to.path !== from.path) {
modalStore.handleResetModalAll()
}

View File

@@ -17,8 +17,6 @@ const createModalState = () => ({
})
export const useModalStore = defineStore('modalStore', () => {
const scrollStore = useScrollStore()
// dimmed ------------------
/**
* @description 모달을 바디에서 컨트롤 필요 시 사용하는 함수입니다.
@@ -97,6 +95,8 @@ export const useModalStore = defineStore('modalStore', () => {
isOutsideClose = false,
modalName = '',
}: YoutubeParams) => {
const scrollStore = useScrollStore()
youtube.storeIsOpen.value = true
youtube.storeYoutubeUrl.value = youtubeUrl
youtube.storeIsOutsideClose.value = isOutsideClose

View File

@@ -30,19 +30,15 @@ export default defineNuxtConfig({
noscript: [
// JavaScript 비활성화 시 폰트 CSS 로드
{
tag: 'link',
rel: 'stylesheet',
href: 'https://static-pubcomm.onstove.com/live/common/assets/fonts/Pretendard/pretendard.css',
innerHTML:
'<link rel="stylesheet" href="https://static-pubcomm.onstove.com/live/common/assets/fonts/Pretendard/pretendard.css">',
},
{
tag: 'link',
rel: 'stylesheet',
href: 'https://static-pubcomm.onstove.com/live/common/assets/fonts/Pretendard/pretendard-jp.css',
innerHTML:
'<link rel="stylesheet" href="https://static-pubcomm.onstove.com/live/common/assets/fonts/Pretendard/pretendard-jp.css">',
},
// {
// tag: 'link',
// rel: 'stylesheet',
// href: 'https://static-cdn.onstove.com/0.0.4/font-icon/StoveFont-Icon.css',
// innerHTML: '<link rel="stylesheet" href="https://static-cdn.onstove.com/0.0.4/font-icon/StoveFont-Icon.css">',
// },
],
script: [
@@ -66,8 +62,8 @@ export default defineNuxtConfig({
},
modules: [
'@vueuse/nuxt',
'@nuxtjs/i18n',
'@pinia/nuxt',
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'nuxt-gtag',
'@nuxtjs/device',