diff --git a/src/app/toks-main/page.tsx b/src/app/toks-main/page.tsx index 6c791b1b..69da063f 100644 --- a/src/app/toks-main/page.tsx +++ b/src/app/toks-main/page.tsx @@ -33,9 +33,11 @@ function ToksMainPage() { /> )} + setIsOpenFloatingButtonBottomSheet(true)} /> + setIsOpenFloatingButtonBottomSheet(false)} isShow={isOpenFloatingButtonBottomSheet} diff --git a/src/common/components/Appbar/index.tsx b/src/common/components/Appbar/index.tsx index 1c6d9979..7e011787 100644 --- a/src/common/components/Appbar/index.tsx +++ b/src/common/components/Appbar/index.tsx @@ -9,6 +9,7 @@ import { GOOGLE_FORM_URL, ICON_URL, LOGIN_URL } from '@/common/constants'; import { useAuth } from '@/common/hooks'; import questionSvg from '../../../../public/img/icon/question.svg'; +import { LogClickEvent } from '../LogClickEvent'; import { SSRSuspense } from '../SSRSuspense'; import { Text } from '../Text'; @@ -62,7 +63,13 @@ export const Appbar = () => { )} - + + + + + ); diff --git a/src/common/components/CarouselCard.tsx b/src/common/components/CarouselCard.tsx index 4f579832..6ff50232 100644 --- a/src/common/components/CarouselCard.tsx +++ b/src/common/components/CarouselCard.tsx @@ -5,6 +5,7 @@ import React from 'react'; import { ICON_URL } from '@/common/constants'; import { Badge } from './Badge'; +import { LogClickEvent } from './LogClickEvent'; import { QuizCardProps } from './QuizCard/types'; import { Text } from './Text'; @@ -40,49 +41,57 @@ export const CarouselCard = ({ }; return ( -
-
-
- - - {categoryTitle} - -
-
- - {quizDescription} - -
-
-
- {isOX && images?.length === 0 ? ( - - ) : ( - images?.map((src, index) => ( -
1 ? 'h-1/2' : 'h-full'} - key={`${src}-${index}`} - > - {src} + +
+
+
+
+ + + {categoryTitle} + +
+
+ + {quizDescription} +
- )) - )} +
+
+ {isOX && images?.length === 0 ? ( + + ) : ( + images?.map((src, index) => ( +
1 ? 'h-1/2' : 'h-full'} + key={`${src}-${index}`} + > + {src} +
+ )) + )} +
+
-
+ ); }; diff --git a/src/common/components/FloatingButton/index.tsx b/src/common/components/FloatingButton/index.tsx index 4efa9512..abfa1e37 100644 --- a/src/common/components/FloatingButton/index.tsx +++ b/src/common/components/FloatingButton/index.tsx @@ -1,6 +1,7 @@ import clsx from 'clsx'; import Image from 'next/image'; +import { LogClickEvent } from '@/common'; import { ICON_URL } from '@/common/constants'; export function FloatingButton({ @@ -8,21 +9,25 @@ export function FloatingButton({ ...rest }: React.ButtonHTMLAttributes) { return ( -
- -
+ +
+ +
+
); } diff --git a/src/common/components/LogClickEvent/index.ts b/src/common/components/LogClickEvent/index.ts index fb44f117..aafba2d6 100644 --- a/src/common/components/LogClickEvent/index.ts +++ b/src/common/components/LogClickEvent/index.ts @@ -22,7 +22,7 @@ export const LogClickEvent = ({ children, eventPath }: LogClickEventProps) => { return cloneElement(child, { onClick: () => { - logEvent(analytics, eventName); + analytics && logEvent(analytics, eventName); }, }); }; diff --git a/src/common/components/index.ts b/src/common/components/index.ts index 5f267d5b..d454e297 100644 --- a/src/common/components/index.ts +++ b/src/common/components/index.ts @@ -17,3 +17,4 @@ export * from './Toast'; export * from './BackHeader'; export * from './ToksCalendar'; export * from './NoticeSlider'; +export * from './LogClickEvent'; diff --git a/src/common/utils/firebase.ts b/src/common/utils/firebase.ts index c823f3ad..38dddc0b 100644 --- a/src/common/utils/firebase.ts +++ b/src/common/utils/firebase.ts @@ -1,7 +1,7 @@ import { getAnalytics } from 'firebase/analytics'; import { getApp, getApps, initializeApp } from 'firebase/app'; -export const firebaseConfig = { +const firebaseConfig = { apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID, @@ -13,6 +13,7 @@ export const firebaseConfig = { const app = !getApps().length ? initializeApp(firebaseConfig) : getApp(); -const analytics = getAnalytics(app); +const analytics = + app.name && typeof window !== 'undefined' ? getAnalytics(app) : null; -export { analytics }; +export { firebaseConfig, app, analytics };