Skip to content

Commit 1dd7c8f

Browse files
committed
fix: main 로깅 충돌 해결
2 parents 9a33995 + f5494ea commit 1dd7c8f

File tree

8 files changed

+33
-4
lines changed

8 files changed

+33
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dist-ssr
2929

3030
.next
3131
next-env.d.ts
32+
3233
dist
3334

3435
CLAUDE.md

src/components/card/popularCard/PopularCard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface PopularCardProps {
1616
onLikeToggle: (templestayId: number) => void;
1717
templestayId: number;
1818
link: string;
19+
onClick: () => void;
1920
}
2021

2122
const PopularCard = ({
@@ -28,6 +29,7 @@ const PopularCard = ({
2829
onLikeToggle,
2930
templestayId,
3031
link,
32+
onClick,
3133
}: PopularCardProps) => {
3234
const handleLikeClick = (e: React.MouseEvent) => {
3335
e.stopPropagation();
@@ -41,7 +43,8 @@ const PopularCard = ({
4143
href={link}
4244
className={styles.cardWrapper}
4345
draggable={false}
44-
onDragStart={(e) => e.preventDefault()}>
46+
onDragStart={(e) => e.preventDefault()}
47+
onClick={onClick}>
4548
<div>
4649
<div className={styles.imgBox}>
4750
<Image

src/components/card/templeStayCard/TempleStayCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ const TempleStayCard = ({
5555
<a
5656
href={link}
5757
className={isHorizontal ? styles.horizontalContainer : styles.verticalContainer}
58-
onClick={() => logClickEvent('click_card_detail')}>
58+
onClick={() =>
59+
logClickEvent('click_card_detail', {
60+
label: String(item.templestayId),
61+
})
62+
}>
5963
{item.imgUrl ? (
6064
<section className={isHorizontal ? styles.horizontalImgSection : styles.verticalImgSection}>
6165
<img

src/components/carousel/curationCarousel/CurationCarousel.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import CurationCard from '@components/curation/curationCard/CurationCard';
44
import { CURATION_INFO } from '@constants/curationInfo';
55
import useCarousel from '@hooks/useCarousel';
66
import registDragEvent from '@utils/registDragEvent';
7+
import useEventLogger from 'src/gtm/hooks/useEventLogger';
78

89
import * as styles from './curationCarousel.css';
910

@@ -13,6 +14,8 @@ const CurationCarousel = () => {
1314
moveDistance: 295,
1415
});
1516

17+
const { logClickEvent } = useEventLogger('home_pick');
18+
1619
return (
1720
<section ref={carouselRef} className={styles.carouselWrapper}>
1821
<div className={styles.emptyBox} />
@@ -30,6 +33,11 @@ const CurationCarousel = () => {
3033
title={data.title}
3134
subtitle={data.subtitle}
3235
link={`/curation/${index + 1}`}
36+
onClick={() => {
37+
logClickEvent('click_curation_card', {
38+
label: index + 1,
39+
});
40+
}}
3341
/>
3442
))}
3543
</div>

src/components/carousel/popularCarousel/PopularCarousel.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import useCarousel from '@hooks/useCarousel';
77
import { useQueryClient } from '@tanstack/react-query';
88
import registDragEvent from '@utils/registDragEvent';
99
import { getCookie } from 'cookies-next';
10+
import useEventLogger from 'src/gtm/hooks/useEventLogger';
1011

1112
import * as styles from './popularCarousel.css';
1213

@@ -27,6 +28,8 @@ const PopularCarousel = ({ onRequireLogin }: PopularCarouselProps) => {
2728
moveDistance: 355,
2829
});
2930

31+
const { logClickEvent } = useEventLogger('home_popularity_component');
32+
3033
if (isLoading) {
3134
return <ExceptLayout type="loading" />;
3235
}
@@ -78,6 +81,11 @@ const PopularCarousel = ({ onRequireLogin }: PopularCarouselProps) => {
7881
templestayId={temple.id}
7982
onLikeToggle={handleLikeToggle}
8083
link={`/detail/${temple.id}`}
84+
onClick={() => {
85+
logClickEvent('click_popularity_card', {
86+
label: temple.id,
87+
});
88+
}}
8189
/>
8290
))}
8391
</div>

src/components/curation/curationCard/CurationCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ interface CurationCardProps {
77
title: string;
88
subtitle: string;
99
link: string;
10+
onClick: () => void;
1011
}
1112

12-
const CurationCard = ({ bgImage, title, subtitle, link }: CurationCardProps) => {
13+
const CurationCard = ({ bgImage, title, subtitle, link, onClick }: CurationCardProps) => {
1314
return (
1415
<a
1516
href={link}
1617
className={styles.cardContainer}
1718
draggable={false}
18-
onDragStart={(e) => e.preventDefault()}>
19+
onDragStart={(e) => e.preventDefault()}
20+
onClick={onClick}>
21+
1922
<Image src={bgImage} alt={title} fill style={{ objectFit: 'cover' }} />
2023
<div className={styles.textbox}>
2124
<p className={styles.title}>{title}</p>

src/stories/CurationCard.stories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const meta = {
2424
title: '고양이 있는 절 봤어?',
2525
subtitle: '용문사에 있는 고양이 좀 봐. 귀엽지?',
2626
link: 'https://www.gototemplestay.com/',
27+
onClick: () => {},
2728
},
2829
} satisfies Meta<typeof CurationCard>;
2930

src/stories/PopularCard.stories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const meta = {
4343
isLiked: false,
4444
templestayId: 123,
4545
onLikeToggle: (id) => alert(`Toggled like for ID: ${id}`),
46+
onClick: () => alert('Card clicked!'),
4647
},
4748
} satisfies Meta<typeof PopularCard>;
4849

0 commit comments

Comments
 (0)