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
@@ -3,12 +3,13 @@ import type { Factor, ResIndexDetail } from '@nalssigak/shared/api/client/types.
|
||||
import { loadOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Circle, Line, Polygon, Text as SvgText, TSpan } from 'react-native-svg';
|
||||
|
||||
import { Ic, Skel, StateBox } from '@/components/ui';
|
||||
import { track } from '@/lib/analytics';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
@@ -110,6 +111,14 @@ export function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: s
|
||||
onTitle(g ? `${g.rank}위 ${g.name}` : '계산 근거');
|
||||
}, [g, onTitle]);
|
||||
|
||||
// 지역이 바뀌어 다시 받아도 한 번만 보낸다
|
||||
const tracked = useRef(0);
|
||||
useEffect(() => {
|
||||
if (!g || tracked.current === g.index_id) return;
|
||||
tracked.current = g.index_id;
|
||||
track('view_gak', { index_id: g.index_id, gak_name: g.name, score: g.score, rank: g.rank });
|
||||
}, [g]);
|
||||
|
||||
const load = loadOf(q);
|
||||
if (!g) return <Body>{load === 'loading' ? <GakSkel /> : <StateBox load={load} onRetry={() => q.refetch()} empty="이 각의 계산 근거가 아직 없어요." hold={<GakSkel />} boxClassName="inset-0" />}</Body>;
|
||||
const factors = d.factors ?? [];
|
||||
|
||||
Reference in new issue
Block a user