feat: 앱 GA4 이벤트 틀(track, 웹과 같은 이벤트 목록을 shared로) — 기존 앱 기능에 창_열기·각_보기·글_열기·로그인·지역_변경·좋아요·댓글·신고·차단·약관_동의·공유, 전송은 Firebase 연결 뒤. 탭 밖 화면용 루트 스택
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
fcc7ed804c
commit
cab3336859
20 files changed
+201
-110
No files matched your search
@@ -21,6 +21,7 @@ import { Text } from '@/components/text';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
import { Avatar, Skel, StateBox } from '@/components/ui';
|
||||
import { track } from '@/lib/analytics';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
@@ -59,9 +60,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 });
|
||||
@@ -90,12 +92,12 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
)}
|
||||
{step === 'report' &&
|
||||
REPORT_REASONS.map(([reason, label]) => (
|
||||
<Chip key={reason} label={label} disabled={pending} onPress={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.'))} />
|
||||
<Chip key={reason} label={label} disabled={pending} onPress={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.', () => track('report', { content_type: 'comment', reason })))} />
|
||||
))}
|
||||
{step === 'block' && (
|
||||
<>
|
||||
<Text className="w-full text-[13px] font-bold text-ink">{c.nickname}님 댓글을 더는 안 볼까요?</Text>
|
||||
<Chip label="차단하기" danger disabled={pending} onPress={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.'))} />
|
||||
<Chip label="차단하기" danger disabled={pending} onPress={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.', () => track('block', { content_type: 'comment' })))} />
|
||||
<Chip label="취소" disabled={pending} onPress={() => go('closed')} />
|
||||
</>
|
||||
)}
|
||||
@@ -158,6 +160,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();
|
||||
@@ -267,6 +270,7 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin
|
||||
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 } }) });
|
||||
@@ -290,6 +294,7 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin
|
||||
onSuccess: (res) => {
|
||||
if (!res.result?.success) return setAddFailed(true);
|
||||
queryClient.setQueryData(meQueryKey(), res);
|
||||
track('terms_agree', {});
|
||||
setAskTerms(false);
|
||||
send();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user