From b74ad4f71a6f9f75d5f070b510f0e29176f72551 Mon Sep 17 00:00:00 2001 From: Yoo TaeSeung Date: Mon, 31 Mar 2025 23:10:51 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix(service):=20=EC=A7=84=EB=8B=A8=20?= =?UTF-8?q?=EB=B0=8F=20=EC=B2=98=EB=B0=A9=20->=20=ED=8F=AC=EC=9D=B8?= =?UTF-8?q?=ED=8C=85=20=EB=9D=BC=EC=9D=B4=ED=8C=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/[publishId]/[problemId]/prescription/detail/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/service/src/app/report/[publishId]/[problemId]/prescription/detail/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/prescription/detail/page.tsx index 781a025a..d35d9569 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/prescription/detail/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/prescription/detail/page.tsx @@ -34,7 +34,7 @@ const Page = () => { return ( <> -
+

{title}

From 8a38d559766408fc6eff47e1f99c56e0b220bf4b Mon Sep 17 00:00:00 2001 From: Yoo TaeSeung Date: Mon, 31 Mar 2025 23:58:26 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix(service):=20=ED=95=9C=EA=B1=B8=EC=9D=8C?= =?UTF-8?q?=EB=8D=94=20<->=20=ED=8F=AC=EC=9D=B8=ED=8C=85=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[publishId]/[problemId]/advanced/page.tsx | 14 +++++++------- .../[publishId]/[problemId]/analysis/page.tsx | 6 +++--- .../[publishId]/[problemId]/prescription/page.tsx | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx index 409a050b..0973bcc7 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx @@ -22,16 +22,16 @@ const Page = () => { const handleClickPrev = () => { trackEvent('report_advanced_prev_button_click', { - buttonLabel: '해설', + buttonLabel: '포인팅', }); - router.push(`/report/${publishId}/${problemId}/analysis`); + router.push(`/report/${publishId}/${problemId}/prescription`); }; const handleClickNext = () => { trackEvent('report_advanced_next_button_click', { - buttonLabel: '포인팅', + buttonLabel: '리스트로', }); - router.push(`/report/${publishId}/${problemId}/prescription`); + router.push(`/problem/list/${publishId}`); }; if (!seniorTipImageUrl) { @@ -40,7 +40,7 @@ const Page = () => { return ( <> - +

한 걸음 더

@@ -65,8 +65,8 @@ const Page = () => {
diff --git a/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx index f3d7619e..3ef01cbd 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx @@ -36,9 +36,9 @@ const Page = () => { const handleClickNext = () => { trackEvent('report_analysis_next_button_click', { - buttonLabel: '한 걸음 더', + buttonLabel: '포인팅', }); - router.push(`/report/${publishId}/${problemId}/advanced`); + router.push(`/report/${publishId}/${problemId}/prescription`); }; if (!mainAnalysisImageUrl || !mainHandwritingExplanationImageUrl) { @@ -102,7 +102,7 @@ const Page = () => {
- +
); diff --git a/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx index 067b11e5..2b0aa403 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx @@ -33,21 +33,21 @@ const Page = () => { const handleClickPrev = () => { trackEvent('report_prescription_prev_button_click', { - buttonLabel: '한 걸음 더', + buttonLabel: '해설', }); - router.push(`/report/${publishId}/${problemId}/advanced`); + router.push(`/report/${publishId}/${problemId}/analysis`); }; const handleClickNext = () => { trackEvent('report_prescription_next_button_click', { - buttonLabel: '리스트로', + buttonLabel: '한 걸음 더', }); - router.push(`/problem/list/${publishId}`); + router.push(`/report/${publishId}/${problemId}/advanced`); }; return ( <> - +

포인팅

@@ -71,8 +71,8 @@ const Page = () => { From b8d7688987913188f71f2d9c7c2bb3bdd101100b Mon Sep 17 00:00:00 2001 From: Yoo TaeSeung Date: Tue, 1 Apr 2025 00:16:38 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix(service):=20=EC=A7=84=EB=8B=A8=20?= =?UTF-8?q?=EB=B0=8F=20=EC=B2=98=EB=B0=A9=20->=20=EC=A7=84=EB=8B=A8=20?= =?UTF-8?q?=EB=B0=9B=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/service/src/components/report/PrescriptionCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/service/src/components/report/PrescriptionCard.tsx b/apps/service/src/components/report/PrescriptionCard.tsx index 244bb6d5..daf83a57 100644 --- a/apps/service/src/components/report/PrescriptionCard.tsx +++ b/apps/service/src/components/report/PrescriptionCard.tsx @@ -28,7 +28,7 @@ const PrescriptionCard = ({ status = 'NOT_STARTED', title, onClick }: Prescripti {statusIcon(status)}

{title}

- 진단 및 처방 + 진단 받기 ); }; From 371267b68f80ee1524688fbf21a407447658ca6a Mon Sep 17 00:00:00 2001 From: Yoo TaeSeung Date: Tue, 1 Apr 2025 00:29:34 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix(service):=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20border=20radius=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/report/[publishId]/[problemId]/advanced/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx index 0973bcc7..9198208d 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx @@ -57,7 +57,7 @@ const Page = () => { advanced Date: Wed, 2 Apr 2025 19:07:11 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor(service):=20ga=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=20(hooks=20->=20utils)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/service/src/app/(home)/page.tsx | 3 +-- apps/service/src/app/login/page.tsx | 4 +--- .../[problemId]/SolveButtonsClient.tsx | 4 ++-- .../child-problem/[childProblemId]/page.tsx | 4 ++-- .../[problemId]/main-problem/page.tsx | 4 ++-- .../[publishId]/[problemId]/advanced/page.tsx | 11 +++-------- .../[publishId]/[problemId]/analysis/page.tsx | 7 ++----- .../[problemId]/prescription/page.tsx | 11 +++-------- apps/service/src/components/common/Header.tsx | 3 +-- .../src/components/common/ProgressHeader.tsx | 3 +-- .../home/ProblemCard/ProblemCard.tsx | 3 +-- .../src/components/my-page/SettingList.tsx | 3 +-- .../src/components/problem/ProblemCalandar.tsx | 3 +-- .../components/problem/ProblemStatusCard.tsx | 3 +-- apps/service/src/hooks/common/index.ts | 3 +-- apps/service/src/hooks/common/useTrackEvent.ts | 18 ------------------ apps/service/src/utils/common/index.ts | 1 + apps/service/src/utils/common/trackEvent.ts | 9 +++++++++ 18 files changed, 33 insertions(+), 64 deletions(-) delete mode 100644 apps/service/src/hooks/common/useTrackEvent.ts create mode 100644 apps/service/src/utils/common/trackEvent.ts diff --git a/apps/service/src/app/(home)/page.tsx b/apps/service/src/app/(home)/page.tsx index 81864b0d..957e99ff 100644 --- a/apps/service/src/app/(home)/page.tsx +++ b/apps/service/src/app/(home)/page.tsx @@ -6,7 +6,7 @@ import { Button } from '@components'; import { IcCalendar } from '@svg'; import { useGetHomeFeed } from '@apis'; import { DailyProgress } from '@types'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { GuideButton, HomeHeader, @@ -17,7 +17,6 @@ import { const Page = () => { const router = useRouter(); - const { trackEvent } = useTrackEvent(); const { data } = useGetHomeFeed(); const homeFeedData = data?.data; diff --git a/apps/service/src/app/login/page.tsx b/apps/service/src/app/login/page.tsx index 16cd3c6f..9f04fe5a 100644 --- a/apps/service/src/app/login/page.tsx +++ b/apps/service/src/app/login/page.tsx @@ -2,13 +2,11 @@ import { useEffect } from 'react'; import { useRouter } from 'next/navigation'; -import { useTrackEvent } from '@hooks'; -import { getAccessToken } from '@utils'; +import { getAccessToken, trackEvent } from '@utils'; import { LogoLogin } from '@/assets/svg/logo'; import { KakaoButton } from '@/components/login'; const Page = () => { - const { trackEvent } = useTrackEvent(); const router = useRouter(); const kakaoLoginUrl = `https://kauth.kakao.com/oauth/authorize?client_id=${ process.env.NEXT_PUBLIC_REST_API_KEY diff --git a/apps/service/src/app/problem/solve/[publishId]/[problemId]/SolveButtonsClient.tsx b/apps/service/src/app/problem/solve/[publishId]/[problemId]/SolveButtonsClient.tsx index 29904a47..b68c8ec6 100644 --- a/apps/service/src/app/problem/solve/[publishId]/[problemId]/SolveButtonsClient.tsx +++ b/apps/service/src/app/problem/solve/[publishId]/[problemId]/SolveButtonsClient.tsx @@ -3,7 +3,8 @@ import { useRouter } from 'next/navigation'; import { SolveButton } from '@components'; import { useGetChildData, postChildProblemSubmit, postProblemSubmit } from '@apis'; -import { useInvalidate, useTrackEvent } from '@hooks'; +import { useInvalidate } from '@hooks'; +import { trackEvent } from '@utils'; interface SolveButtonsClientProps { publishId: string; @@ -13,7 +14,6 @@ interface SolveButtonsClientProps { const SolveButtonsClient = ({ publishId, problemId }: SolveButtonsClientProps) => { const router = useRouter(); const { invalidateAll } = useInvalidate(); - const { trackEvent } = useTrackEvent(); const { data } = useGetChildData(publishId, problemId); const childProblemId = data?.data?.childProblemIds[0]; diff --git a/apps/service/src/app/problem/solve/[publishId]/[problemId]/child-problem/[childProblemId]/page.tsx b/apps/service/src/app/problem/solve/[publishId]/[problemId]/child-problem/[childProblemId]/page.tsx index b6e37f1f..644b2246 100644 --- a/apps/service/src/app/problem/solve/[publishId]/[problemId]/child-problem/[childProblemId]/page.tsx +++ b/apps/service/src/app/problem/solve/[publishId]/[problemId]/child-problem/[childProblemId]/page.tsx @@ -19,9 +19,10 @@ import { Tag, ImageContainer, } from '@components'; -import { useInvalidate, useModal, useTrackEvent } from '@hooks'; +import { useInvalidate, useModal } from '@hooks'; import { components } from '@schema'; import { useChildProblemContext } from '@/hooks/problem'; +import { trackEvent } from '@utils'; type ChildProblemSubmitUpdateResponse = components['schemas']['ChildProblemSubmitUpdateResponse']; @@ -32,7 +33,6 @@ const Page = () => { childProblemId: string; }>(); const router = useRouter(); - const { trackEvent } = useTrackEvent(); const { childProblemLength, mainProblemImageUrl, onPrev, onNext } = useChildProblemContext(); const { invalidateAll } = useInvalidate(); diff --git a/apps/service/src/app/problem/solve/[publishId]/[problemId]/main-problem/page.tsx b/apps/service/src/app/problem/solve/[publishId]/[problemId]/main-problem/page.tsx index 5e0b450d..a82d2c0e 100644 --- a/apps/service/src/app/problem/solve/[publishId]/[problemId]/main-problem/page.tsx +++ b/apps/service/src/app/problem/solve/[publishId]/[problemId]/main-problem/page.tsx @@ -17,9 +17,10 @@ import { TimeTag, ImageContainer, } from '@components'; -import { useInvalidate, useModal, useTrackEvent } from '@hooks'; +import { useInvalidate, useModal } from '@hooks'; import { ProblemStatus } from '@types'; import { useChildProblemContext } from '@/hooks/problem'; +import { trackEvent } from '@utils'; const statusLabel: Record = { CORRECT: '정답', @@ -38,7 +39,6 @@ const statusColor: Record = { const Page = () => { const { publishId, problemId } = useParams<{ publishId: string; problemId: string }>(); const router = useRouter(); - const { trackEvent } = useTrackEvent(); const { childProblemLength } = useChildProblemContext(); const { invalidateAll } = useInvalidate(); diff --git a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx index 9198208d..a3f7d4b9 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/advanced/page.tsx @@ -3,13 +3,12 @@ import { useParams, useRouter } from 'next/navigation'; import Image from 'next/image'; import { NavigationFooter, SmallButton, ProgressHeader, ImageContainer } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { useReportContext } from '@/hooks/report'; const Page = () => { const { publishId, problemId } = useParams(); const router = useRouter(); - const { trackEvent } = useTrackEvent(); const { problemNumber, seniorTipImageUrl, prescription } = useReportContext(); @@ -21,16 +20,12 @@ const Page = () => { }; const handleClickPrev = () => { - trackEvent('report_advanced_prev_button_click', { - buttonLabel: '포인팅', - }); + trackEvent('report_advanced_prev_button_click_to_prescription'); router.push(`/report/${publishId}/${problemId}/prescription`); }; const handleClickNext = () => { - trackEvent('report_advanced_next_button_click', { - buttonLabel: '리스트로', - }); + trackEvent('report_advanced_next_button_click_to_list'); router.push(`/problem/list/${publishId}`); }; diff --git a/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx index 3ef01cbd..eef653c9 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/analysis/page.tsx @@ -5,14 +5,13 @@ import Image from 'next/image'; import { IcRight, IcThumbtack } from '@svg'; import { ImageContainer, NavigationFooter, ProgressHeader } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { useReportContext } from '@/hooks/report'; import { TabMenu } from '@/components/report'; const Page = () => { const router = useRouter(); const { publishId, problemId } = useParams(); - const { trackEvent } = useTrackEvent(); const { problemNumber, answerType, @@ -35,9 +34,7 @@ const Page = () => { }; const handleClickNext = () => { - trackEvent('report_analysis_next_button_click', { - buttonLabel: '포인팅', - }); + trackEvent('report_analysis_next_button_click_to_prescription'); router.push(`/report/${publishId}/${problemId}/prescription`); }; diff --git a/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx b/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx index 2b0aa403..ef4bc49e 100644 --- a/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx +++ b/apps/service/src/app/report/[publishId]/[problemId]/prescription/page.tsx @@ -2,14 +2,13 @@ import { useParams, useRouter } from 'next/navigation'; import { Divider, NavigationFooter, ProgressHeader } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { PrescriptionCard } from '@/components/report'; import { useReportContext } from '@/hooks/report'; const Page = () => { const router = useRouter(); const { publishId, problemId } = useParams(); - const { trackEvent } = useTrackEvent(); const { problemNumber, prescription } = useReportContext(); const childProblems = prescription?.childProblem ?? []; @@ -32,16 +31,12 @@ const Page = () => { }; const handleClickPrev = () => { - trackEvent('report_prescription_prev_button_click', { - buttonLabel: '해설', - }); + trackEvent('report_prescription_prev_button_click_to_analysis'); router.push(`/report/${publishId}/${problemId}/analysis`); }; const handleClickNext = () => { - trackEvent('report_prescription_next_button_click', { - buttonLabel: '한 걸음 더', - }); + trackEvent('report_prescription_next_button_click_to_advanced'); router.push(`/report/${publishId}/${problemId}/advanced`); }; diff --git a/apps/service/src/components/common/Header.tsx b/apps/service/src/components/common/Header.tsx index 4b045b1e..d6a43b91 100644 --- a/apps/service/src/components/common/Header.tsx +++ b/apps/service/src/components/common/Header.tsx @@ -1,7 +1,7 @@ 'use client'; import { useRouter } from 'next/navigation'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { IcHome, IcLeft } from '@svg'; interface HeaderProps { @@ -11,7 +11,6 @@ interface HeaderProps { const Header = ({ title, iconType = 'home' }: HeaderProps) => { const router = useRouter(); - const { trackEvent } = useTrackEvent(); const handleClickHome = () => { trackEvent('header_home_button_click'); diff --git a/apps/service/src/components/common/ProgressHeader.tsx b/apps/service/src/components/common/ProgressHeader.tsx index 7966333e..563cd542 100644 --- a/apps/service/src/components/common/ProgressHeader.tsx +++ b/apps/service/src/components/common/ProgressHeader.tsx @@ -3,7 +3,7 @@ import { useParams, useRouter } from 'next/navigation'; import { ProgressBar } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { IcList } from '@svg'; interface ProgressHeaderProps { @@ -13,7 +13,6 @@ interface ProgressHeaderProps { const ProgressHeader = ({ progress }: ProgressHeaderProps) => { const router = useRouter(); const { publishId } = useParams(); - const { trackEvent } = useTrackEvent(); const handleClickProblemList = () => { trackEvent('progress_header_problem_list_button_click'); diff --git a/apps/service/src/components/home/ProblemCard/ProblemCard.tsx b/apps/service/src/components/home/ProblemCard/ProblemCard.tsx index cdbe041c..ad39b6e7 100644 --- a/apps/service/src/components/home/ProblemCard/ProblemCard.tsx +++ b/apps/service/src/components/home/ProblemCard/ProblemCard.tsx @@ -2,7 +2,7 @@ import Image from 'next/image'; import { useRouter } from 'next/navigation'; import { Button } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { IcSolve } from '@svg'; interface Props { @@ -15,7 +15,6 @@ interface Props { const ProblemCard = ({ publishId, dateString, title, image, solvedCount }: Props) => { const router = useRouter(); - const { trackEvent } = useTrackEvent(); const handleClickProblem = () => { trackEvent('home_carousel_problem_card_click', { diff --git a/apps/service/src/components/my-page/SettingList.tsx b/apps/service/src/components/my-page/SettingList.tsx index 8502892e..22620ab3 100644 --- a/apps/service/src/components/my-page/SettingList.tsx +++ b/apps/service/src/components/my-page/SettingList.tsx @@ -4,10 +4,9 @@ import Link from 'next/link'; import { useRouter } from 'next/navigation'; import React from 'react'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; const SettingList = () => { - const { trackEvent } = useTrackEvent(); const router = useRouter(); const handleClickLogout = () => { diff --git a/apps/service/src/components/problem/ProblemCalandar.tsx b/apps/service/src/components/problem/ProblemCalandar.tsx index 0a8abff8..43ba0a5d 100644 --- a/apps/service/src/components/problem/ProblemCalandar.tsx +++ b/apps/service/src/components/problem/ProblemCalandar.tsx @@ -5,7 +5,7 @@ import { useState } from 'react'; import { IcMinus, IcMinusSmall, IcNextBlack, IcPrevBlack } from '@svg'; import { components } from '@schema'; import { useGetProblemAll } from '@apis'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import DayProblemCard from './DayProblemCard'; @@ -14,7 +14,6 @@ type AllProblemGetResponse = components['schemas']['AllProblemGetResponse']; const ProblemCalandar = () => { const [currentDay, setCurrentDay] = useState(dayjs()); const [selectedDay, setSelectedDay] = useState(null); - const { trackEvent } = useTrackEvent(); const year = currentDay.year(); const month = currentDay.month() + 1; diff --git a/apps/service/src/components/problem/ProblemStatusCard.tsx b/apps/service/src/components/problem/ProblemStatusCard.tsx index 5870aaed..c649d498 100644 --- a/apps/service/src/components/problem/ProblemStatusCard.tsx +++ b/apps/service/src/components/problem/ProblemStatusCard.tsx @@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation'; import React, { useState } from 'react'; import { Button, StatusIcon, StatusTag } from '@components'; -import { useTrackEvent } from '@hooks'; +import { trackEvent } from '@utils'; import { components } from '@schema'; import { IcDown, IcUp } from '@svg'; @@ -23,7 +23,6 @@ const ProblemStatusCard = ({ }: ProblemStatusCardProps) => { const { problemId, status, childProblemStatuses } = problemData; const router = useRouter(); - const { trackEvent } = useTrackEvent(); const [isOpen, setIsOpen] = useState( !childProblemStatuses?.every((childStatus) => childStatus === 'NOT_STARTED') ); diff --git a/apps/service/src/hooks/common/index.ts b/apps/service/src/hooks/common/index.ts index b50b29cc..6f25f49e 100644 --- a/apps/service/src/hooks/common/index.ts +++ b/apps/service/src/hooks/common/index.ts @@ -1,5 +1,4 @@ import useModal from './useModal'; import useInvalidate from './useInvalidate'; -import useTrackEvent from './useTrackEvent'; -export { useModal, useInvalidate, useTrackEvent }; +export { useModal, useInvalidate }; diff --git a/apps/service/src/hooks/common/useTrackEvent.ts b/apps/service/src/hooks/common/useTrackEvent.ts deleted file mode 100644 index b1af6465..00000000 --- a/apps/service/src/hooks/common/useTrackEvent.ts +++ /dev/null @@ -1,18 +0,0 @@ -'use client'; - -import { sendGAEvent } from '@next/third-parties/google'; -import { usePathname } from 'next/navigation'; - -const useTrackEvent = () => { - const pathname = usePathname(); - const trackEvent = (name: string, params?: Record) => { - sendGAEvent('event', name, { - pathname, - ...params, - }); - }; - - return { trackEvent }; -}; - -export default useTrackEvent; diff --git a/apps/service/src/utils/common/index.ts b/apps/service/src/utils/common/index.ts index 269586ee..884efe34 100644 --- a/apps/service/src/utils/common/index.ts +++ b/apps/service/src/utils/common/index.ts @@ -1 +1,2 @@ export * from './auth'; +export * from './trackEvent'; diff --git a/apps/service/src/utils/common/trackEvent.ts b/apps/service/src/utils/common/trackEvent.ts new file mode 100644 index 00000000..6bbebe73 --- /dev/null +++ b/apps/service/src/utils/common/trackEvent.ts @@ -0,0 +1,9 @@ +'use client'; + +import { sendGAEvent } from '@next/third-parties/google'; + +export const trackEvent = (name: string, params?: Record) => { + sendGAEvent('event', name, { + ...params, + }); +};