feat: 새 기능 GA4 이벤트 — 창 열기·좋아요·댓글·신고·차단·약관 동의·이야기 글쓰기·히어로 오늘/내일·쇼츠·단풍 지도·내 각·토스 인트로·설치 띠 닫기
This commit is contained in:
1 parent
1489030c5f
commit
728b24a0c9
13 files changed
+110
-18
No files matched your search
@@ -54,6 +54,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
|
||||
window.history.pushState({ ...window.history.state, sheet: true }, '')
|
||||
pushed.current = true
|
||||
}
|
||||
track('sheet_open', { sheet: s.type })
|
||||
setState(s)
|
||||
}, [])
|
||||
const close = useCallback(() => {
|
||||
@@ -692,9 +693,10 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
const block = useMutation(blockAuthorMutation())
|
||||
const pending = report.isPending || block.isPending
|
||||
|
||||
const finish = (notice: string) => ({
|
||||
const finish = (notice: string, done: () => void) => ({
|
||||
onSuccess: (res: { result?: { success?: boolean } }) => {
|
||||
if (!res.result?.success) return setFailed(true)
|
||||
done()
|
||||
setStep('closed')
|
||||
onNotice(notice)
|
||||
queryClient.invalidateQueries({ predicate: isCommentList })
|
||||
@@ -728,14 +730,14 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
)}
|
||||
{step === 'report' &&
|
||||
REPORT_REASONS.map(([reason, label]) => (
|
||||
<button key={reason} type="button" disabled={pending} className={btn} onClick={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.'))}>
|
||||
<button key={reason} type="button" disabled={pending} className={btn} onClick={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.', () => track('report', { content_type: 'comment', reason })))}>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
{step === 'block' && (
|
||||
<>
|
||||
<span className="w-full text-[13px] font-bold text-(--ink)">{c.nickname}님 댓글을 더는 안 볼까요?</span>
|
||||
<button type="button" disabled={pending} className={cx(btn, 'bg-(--heart) text-white')} onClick={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.'))}>
|
||||
<button type="button" disabled={pending} className={cx(btn, 'bg-(--heart) text-white')} onClick={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.', () => track('block', { content_type: 'comment' })))}>
|
||||
차단하기
|
||||
</button>
|
||||
<button type="button" disabled={pending} className={btn} onClick={() => go('closed')}>
|
||||
@@ -782,6 +784,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
if (res.result?.success) {
|
||||
setLiked(!!res.liked)
|
||||
if (res.like_count != null) setCount(res.like_count)
|
||||
if (next) track('like', { content_type: 'comment', item_id: c.comment_id })
|
||||
return
|
||||
}
|
||||
revert()
|
||||
@@ -883,6 +886,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true)
|
||||
setAddFailed(!res.result?.success)
|
||||
if (!res.result?.success) return
|
||||
track('comment', { post_id: postId })
|
||||
setText('')
|
||||
queryClient.invalidateQueries({ queryKey: listCommentsInfiniteQueryKey({ path: { post_id: postId } }) })
|
||||
queryClient.invalidateQueries({ queryKey: getFeedQueryKey({ query: { region: region.code } }) })
|
||||
@@ -905,6 +909,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (!res.result?.success) return setAddFailed(true)
|
||||
track('terms_agree', {})
|
||||
queryClient.setQueryData(meQueryKey(), res)
|
||||
setAskTerms(false)
|
||||
send()
|
||||
|
||||
Reference in new issue
Block a user