diff --git a/src/common/CheckList.tsx b/src/common/CheckList.tsx index 1ab3ac2c..85bfa4c2 100644 --- a/src/common/CheckList.tsx +++ b/src/common/CheckList.tsx @@ -10,7 +10,6 @@ import { useDeleteTodoMutation } from '@hook/todo/useDeleteTodoMutation'; import { ReactTagManager } from 'react-gtm-ts'; import { useAddTodoMutation } from '@hook/todo/useAddTodoMutation.ts'; import Plus from '@assets/icons/plus.svg?react'; -import AddIcon from '@assets/icons/AddIcon.svg?react'; import BookMarkIcon from '@assets/icons/bookmark.svg?react'; import { useUpdateTodoMutation } from '@hook/todo/useUpdateTodoMutation.ts'; @@ -84,7 +83,7 @@ const CheckList = ({ }); console.log('Amplitude event sent: todo_create_attempt (inpage)'); } - + mutate( { todoTitle: trimmedText }, { @@ -263,10 +262,6 @@ const CheckList = ({ ) : ( <> -
- - 3 -
999 diff --git a/src/hook/community/query/useGetHotPopularQuery.ts b/src/hook/community/query/useGetHotPopularQuery.ts index 3bd2f4b1..f7fae867 100644 --- a/src/hook/community/query/useGetHotPopularQuery.ts +++ b/src/hook/community/query/useGetHotPopularQuery.ts @@ -11,6 +11,7 @@ export interface HotPopularItem { description: string; saveCount: number; isSaved: boolean; + todoGroupId: number; } interface HotPopularApiResponse { @@ -29,7 +30,6 @@ export const useGetHotPopularQuery = () => { const res = await api.get('/v1/community/todos/popular', { params: { jobName: selectedJobName }, }); - console.log(res.data); const body = res.data as HotPopularApiResponse; return Array.isArray(body?.data) ? body.data : []; }, diff --git a/src/hook/useHomeQuery.ts b/src/hook/useHomeQuery.ts index b59bc5ea..a4912374 100644 --- a/src/hook/useHomeQuery.ts +++ b/src/hook/useHomeQuery.ts @@ -55,6 +55,7 @@ interface RecruitProps { active: number; jobName: string; postDate: string; + url: string; } const NewRecruit = async (pageNum: number, postDate: string) => { const token = localStorage.getItem('accessToken'); diff --git a/src/pages/community/components/CommunityContents.tsx b/src/pages/community/components/CommunityContents.tsx index 37bf8822..70fce4aa 100644 --- a/src/pages/community/components/CommunityContents.tsx +++ b/src/pages/community/components/CommunityContents.tsx @@ -5,6 +5,7 @@ import { useCommunityAddTodoMutation } from '@hook/community/useCommunityAddTodo import { useDeleteCommunityTodosMutation } from '@hook/community/useDeleteCommunityTodos'; import ToastModal from '@common/modal/ToastModal'; import Info from '@assets/icons/info.svg?react'; +import { trackTodoImport } from '@utils/amplitude'; type CommunityItem = { id: number; @@ -48,7 +49,7 @@ const CommunityContents = ({ return base; }, [filtered, sort]); - const toggleAdd = (id: number, isAdded: boolean) => { + const toggleAdd = (id: number, isAdded: boolean, todoTitle: string) => { if (isAdded) { deleteTodoMutation.mutate( { id }, @@ -65,6 +66,7 @@ const CommunityContents = ({ } ); } else { + trackTodoImport(todoTitle); // Amplitude 이벤트 트래킹 addTodoMutation.mutate( { id }, { @@ -131,7 +133,7 @@ const CommunityContents = ({ +
+ + ); + })} + + {showToast && ( +
+ } + text={toastMessage} + width="w-[274px]" + /> +
+ )} ); }; diff --git a/src/utils/amplitude.ts b/src/utils/amplitude.ts new file mode 100644 index 00000000..8a4fc7bf --- /dev/null +++ b/src/utils/amplitude.ts @@ -0,0 +1,31 @@ +// Amplitude 이벤트 트래킹 유틸리티 함수 + +export const trackTodoImport = (todoTitle: string) => { + if ( + typeof window !== 'undefined' && + 'amplitude' in window && + window.amplitude + ) { + const currentPath = location.pathname; + let sourcePage = ''; + + // source_page 설정 + if (currentPath.includes('/community')) { + sourcePage = 'community/'; + } else if (currentPath.includes('/jobinfo')) { + sourcePage = 'jobinfo/'; + } else if (currentPath.includes('/otherslist')) { + sourcePage = 'otherslist/'; + } else { + sourcePage = currentPath; + } + + window.amplitude.track('todo_import', { + source_method: 'copy_btn', + source_page: sourcePage, + todo_length: todoTitle.length, + timestamp: new Date().toISOString(), + }); + console.log('Amplitude event sent: todo_import'); + } +}; diff --git a/src/validation/home/popularSchema.ts b/src/validation/home/popularSchema.ts index be7b2913..2d43a819 100644 --- a/src/validation/home/popularSchema.ts +++ b/src/validation/home/popularSchema.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; export const PopularTodoSchema = z.object({ todoId: z.number(), title: z.string(), - profileImage: z.string().url(), + profileImage: z.string().url().nullable(), memberNickname: z.string(), memberLevel: z.string().nullable(), jobName: z.string(),