Skip to content

Commit d235bac

Browse files
committed
Merge branch 'dev' of https://github.com/MBTips/FE-MBTips into feat/친구-채팅-제목에-이름-띄우기
2 parents 42e8c9b + f15b3f5 commit d235bac

File tree

14 files changed

+100
-39
lines changed

14 files changed

+100
-39
lines changed

src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ const PageTracker = () => {
3333
{ path: "/my-info", page: "내 정보" },
3434
{ path: "/chat", page: "채팅방" },
3535
{ path: "/select-info", page: "빠른 대화 설정" },
36-
{ path: "/select-info", page: "친구 저장" }
36+
{ path: "/mbti-test", page: "바이럴 콘텐츠 소개" },
37+
{ path: "/mbti-result", page: "바이럴 콘텐츠 결과" },
38+
{ path: "/chat-recommend", page: "대화주제추천" },
39+
{ path: "/chat-tips", page: "대화 꿀팁" },
40+
{ path: "/chat-temporature", page: "대화 온도" }
3741
];
3842

3943
useEffect(() => {

src/components/Profile.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { SetStateAction } from "react";
22
import { useNavigate } from "react-router-dom";
33
import { authInstance } from "@/api/axios";
44
import { VirtualFriend } from "@/types/virtualFreind";
5+
import trackClickEvent from "@/utils/trackClickEvent";
56

67
interface ProfileProps {
78
info: VirtualFriend;
@@ -12,6 +13,7 @@ const Profile = ({ info, deleteIndex, setVirtualFriendList }: ProfileProps) => {
1213
const navigate = useNavigate();
1314

1415
const handleDelete = async () => {
16+
trackClickEvent("홈", "친구 - 삭제");
1517
const res = await authInstance.delete(
1618
`/api/virtual-friend/${info.virtualFriendId}`
1719
);
@@ -23,6 +25,7 @@ const Profile = ({ info, deleteIndex, setVirtualFriendList }: ProfileProps) => {
2325
};
2426

2527
const handleNavigate = () => {
28+
trackClickEvent("홈", "친구 - 바로 대화하기");
2629
navigate("/chat", {
2730
state: {
2831
mode: "virtualFriend",

src/components/SubTitle.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from "react";
22
import { useNavigate } from "react-router-dom";
3+
import trackClickEvent from "@/utils/trackClickEvent";
34
import ActionConfirmModal from "@/components/modal/ActionConfirmModal";
45
import useAuthStore from "@/store/useAuthStore";
56

@@ -20,6 +21,7 @@ const SubTitle = ({ mode }: { mode: "빠른대화" | "친구목록" }) => {
2021
};
2122

2223
const handleNavigate = () => {
24+
trackClickEvent("홈", "친구 - 추가");
2325
if (isLoggedIn) {
2426
const type = mode === "빠른대화" ? "fastFriend" : "virtualFriend";
2527
navigate("/select-info", { state: { type: type } });

src/components/button/ChatStartButton.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useNavigate } from "react-router-dom";
1+
import { useLocation, useNavigate } from "react-router-dom";
22
import { trackEvent } from "@/libs/analytics";
33

44
type ChatStartButtonProps = {
@@ -8,13 +8,17 @@ type ChatStartButtonProps = {
88

99
const ChatStartButton = ({ mode, mbti }: ChatStartButtonProps) => {
1010
const navigate = useNavigate();
11+
const pathname = useLocation().pathname;
1112

1213
const handleNavigate = () => {
1314
switch (mode) {
1415
case "go-fast":
1516
trackEvent("Click", {
16-
page: "홈",
17-
element: "빠른 대화 시작"
17+
page: pathname === "/mbti-test-result" ? "바이럴 콘텐츠 결과" : "홈",
18+
element:
19+
pathname === "/mbti-test-result"
20+
? "대화 시작하기"
21+
: "빠른 대화 시작"
1822
});
1923
navigate("/select-info", { state: { type: "fastFriend", mbti } });
2024
break;

src/components/button/KakaoLoginButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import trackClickEvent from "@/utils/trackClickEvent";
2+
13
const KakaoLoginButton = () => {
24
const kakaoRestApiKey = import.meta.env.VITE_KAKAO_REST_API_KEY;
35
const kakaoRedirectUrl =
@@ -8,6 +10,7 @@ const KakaoLoginButton = () => {
810
const kakaoURL = `https://kauth.kakao.com/oauth/authorize?client_id=${kakaoRestApiKey}&redirect_uri=${kakaoRedirectUrl}&response_type=code`;
911

1012
const handleClick = () => {
13+
trackClickEvent("로그인/회원가입", "로그인");
1114
window.location.href = kakaoURL;
1215
};
1316

src/components/button/LoginButton.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import trackClickEvent from "@/utils/trackClickEvent";
2+
13
const LoginButton = () => {
4+
const handleClick = () => {
5+
trackClickEvent("홈", "로그인");
6+
};
7+
28
return (
3-
<a href="/login">
4-
<button className="w-[69px] h-[36px] border-[0.8px] border-gray-300 rounded-lg font-bold text-gray-600 text-md">
5-
로그인
9+
<a href="/login" onClick={handleClick}>
10+
<button className="h-[36px] w-[69px] rounded-lg border-[0.8px] border-gray-300 text-md font-bold text-gray-600">
11+
로그인
612
</button>
713
</a>
814
);
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { useNavigate } from "react-router-dom";
22

33
const RestartButton = () => {
4-
const navigate = useNavigate();
4+
const navigate = useNavigate();
55

6-
const goFirstStep = () => {
7-
navigate("/mbti-test");
8-
}
6+
const goFirstStep = () => {
7+
navigate("/mbti-test");
8+
};
99

10-
return (
11-
<button className="flex justify-center items-center bg-gray-100 rounded-lg w-[72px] h-[60px]" onClick={goFirstStep}>
12-
<img src="/icon/restart.svg" alt="다시하기 버튼" width={24} height={24} />
13-
</button>
14-
)
15-
}
10+
return (
11+
<button
12+
className="flex h-[60px] w-[72px] items-center justify-center rounded-lg bg-gray-100"
13+
onClick={goFirstStep}
14+
>
15+
<img src="/icon/restart.svg" alt="다시하기 버튼" width={24} height={24} />
16+
</button>
17+
);
18+
};
1619

17-
export default RestartButton;
20+
export default RestartButton;

src/components/button/ShareButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ import ShareModal from "@/components/modal/ShareModal";
44
const ShareButton = () => {
55
const [shareModalIsOpen, setShareModalIsOpen] = useState(false);
66

7+
const handleClick = () => {
8+
setShareModalIsOpen(true);
9+
};
710
return (
811
<>
9-
<button onClick={()=>setShareModalIsOpen(true)} className="flex h-[60px] w-full items-center justify-center rounded-lg border border-primary-light bg-primary-pale font-bold text-primary-normal">
12+
<button
13+
onClick={handleClick}
14+
className="flex h-[60px] w-full items-center justify-center rounded-lg border border-primary-light bg-primary-pale font-bold text-primary-normal"
15+
>
1016
공유하기
1117
</button>
1218
{shareModalIsOpen && (

src/components/header/MainHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { Link, useNavigate } from "react-router-dom";
22
import LoginButton from "@/components/button/LoginButton";
3+
import trackClickEvent from "@/utils/trackClickEvent";
34

45
const MainHeader = ({ isLoggedIn }: { isLoggedIn: boolean }) => {
56
const navigate = useNavigate();
67

78
const handleNavigate = () => {
9+
trackClickEvent("홈", "내정보");
810
navigate("/my-info");
911
};
1012

src/components/tips/TipsMenu.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import trackClickEvent from "@/utils/trackClickEvent";
12
import { Link } from "react-router-dom";
23

34
const TipsMenu = ({
@@ -6,31 +7,39 @@ const TipsMenu = ({
67
mode: "topic" | "conversation" | "temporature";
78
}) => {
89
let text = "";
10+
let tagElement = "";
911
let imageUrl = "";
1012
let href = "";
1113

1214
switch (mode) {
1315
case "topic":
1416
text = "대화 주제 추천";
17+
tagElement = "대화 주제 추천";
1518
imageUrl = "/icon/starbubble.svg";
1619
href = "/chat-recommend";
1720
break;
1821
case "conversation":
1922
text = "대화 꿀팁";
23+
tagElement = "대화 꿀팁";
2024
imageUrl = "/icon/lightbulb.svg";
2125
href = "/chat-tips";
2226
break;
2327
case "temporature":
2428
text = "현재 대화의 온도 측정하기";
29+
tagElement = "대화의 온도";
2530
imageUrl = "/icon/thermometer.svg";
2631
href = "/chat-temporature";
2732
break;
2833
default:
2934
return;
3035
}
3136

37+
const handleClick = () => {
38+
trackClickEvent("채팅방", tagElement);
39+
};
40+
3241
return (
33-
<Link to={href}>
42+
<Link to={href} onClick={handleClick}>
3443
<div className="flex h-[56px] w-full border-t border-gray-100 bg-white px-4 py-4 hover:bg-primary-pale">
3544
<img src={imageUrl} alt={text} width={20} height={20} />
3645
<h2 className="text-2lg ml-[22px] font-medium text-gray-800">{text}</h2>

0 commit comments

Comments
 (0)