From 6daa2f4d2aeda21f1296d39e85f6570116cd264f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?= Date: Wed, 4 Nov 2026 17:49:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=95=B1=20=EC=98=A4=EB=8A=98=20?= =?UTF-8?q?=ED=83=AD=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=A4=84=20=E2=80=94?= =?UTF-8?q?=20=EB=82=A0=EC=94=A8=20=EC=82=AC=EC=A3=BC(=EC=98=A4=EB=8A=98?= =?UTF-8?q?=20=EC=95=88=20=EB=B4=A4=EC=9C=BC=EB=A9=B4=20=EB=B9=A8=EA=B0=84?= =?UTF-8?q?=20=EC=A0=90)=C2=B7=EB=82=A0=EC=94=A8=20=EA=B2=8C=EC=9E=84?= =?UTF-8?q?=C2=B7=EC=87=BC=EC=B8=A0=C2=B7=EB=82=B4=20=EA=B0=81(=EA=B7=B8?= =?UTF-8?q?=20=EC=A4=84=EB=A1=9C=20=EB=82=B4=EB=A0=A4=EA=B0=90)=C2=B7?= =?UTF-8?q?=EB=8F=99=EB=84=A4=20=EC=9D=B4=EC=95=BC=EA=B8=B0,=20=ED=83=80?= =?UTF-8?q?=EB=A1=9C=EB=8A=94=20=EC=9B=B9=EC=B2=98=EB=9F=BC=20=EC=88=A8?= =?UTF-8?q?=EA=B9=80=20(GA=20today=5Ficon)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- docs/이벤트_추적.md | 2 +- mobile/src/app/(tabs)/index.tsx | 10 ++++- mobile/src/components/today/icons.tsx | 61 +++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 mobile/src/components/today/icons.tsx diff --git a/docs/이벤트_추적.md b/docs/이벤트_추적.md index ac1bb8e..d1a01b8 100644 --- a/docs/이벤트_추적.md +++ b/docs/이벤트_추적.md @@ -78,7 +78,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 - 앱도 같은 이벤트 이름·값으로 `track()`을 부른다 (`mobile/src/lib/analytics.ts`). 모든 이벤트에 `platform: 'app'`이 붙는다. - **아직 GA4로 보내지 않는다 (2026-11-04).** Firebase Analytics(`google-services.json`)를 붙이면 앱 시작 때 `setAnalyticsSender`로 보내는 함수를 단다. 그 전까지 `track()`은 아무것도 보내지 않는다. 개발 빌드(`__DEV__`)는 붙인 뒤에도 보내지 않는다. -- 앱에서 부르는 곳: `sheet_open`(`components/sheets/index.tsx`), `view_gak`(`sheets/gak.tsx`), `select_content`(`sheets/article.tsx`), `login`·`sign_up`(`sheets/login.tsx`, 구글만), `region_change`(`sheets/region.tsx`·`lib/region.tsx`), `like`(`post/post-card.tsx` 글, `sheets/comments.tsx` 댓글), `comment`·`report`·`block`·`terms_agree`(`sheets/comments.tsx`), `share`(`lib/share-image.ts`), `hero_day_switch`(`today/hero.tsx`), `like`의 `hero_post`·`gak_post`(`lib/pinned-like.ts`). 레벨 창·레벨업 창은 `sheet_open`(`level`·`levelUp`)으로 잡힌다. 동네 이야기: `talk_post`(`components/talk/talk.tsx` `Composer`), `like`·`report`·`block`의 `talk`(`talk/talk.tsx`), `talk_comment`(`sheets/comments.tsx`), `feed_item_view`(`app/(tabs)/index.tsx` `useSeen`, 화면에 반쯤 보일 때). 내 각: `my_gak_save`(`lib/my-gak.ts`), 만들기·상세 창은 `sheet_open`(`mix`·`myGak`). 사주: `saju_input`(`components/saju/birth-form.tsx`), `saju_view`(`saju/reading.tsx`). 쇼츠: `shorts_open`·`shorts_view`·`shorts_sound`(`app/shorts/[id].tsx`). 구름 합치기 게임은 앱이 웹 `/game`을 웹뷰로 띄우므로 `game_start`·`game_round`·`game_over`는 웹 페이지가 보내고 `platform: 'web'`으로 찍힌다(앱 안 게임과 웹 게임을 GA에서 나눠 볼 수 없음). +- 앱에서 부르는 곳: `sheet_open`(`components/sheets/index.tsx`), `view_gak`(`sheets/gak.tsx`), `select_content`(`sheets/article.tsx`), `login`·`sign_up`(`sheets/login.tsx`, 구글만), `region_change`(`sheets/region.tsx`·`lib/region.tsx`), `like`(`post/post-card.tsx` 글, `sheets/comments.tsx` 댓글), `comment`·`report`·`block`·`terms_agree`(`sheets/comments.tsx`), `share`(`lib/share-image.ts`), `hero_day_switch`(`today/hero.tsx`), `like`의 `hero_post`·`gak_post`(`lib/pinned-like.ts`). 레벨 창·레벨업 창은 `sheet_open`(`level`·`levelUp`)으로 잡힌다. 동네 이야기: `talk_post`(`components/talk/talk.tsx` `Composer`), `like`·`report`·`block`의 `talk`(`talk/talk.tsx`), `talk_comment`(`sheets/comments.tsx`), `feed_item_view`(`app/(tabs)/index.tsx` `useSeen`, 화면에 반쯤 보일 때). 내 각: `my_gak_save`(`lib/my-gak.ts`), 만들기·상세 창은 `sheet_open`(`mix`·`myGak`). 오늘 아이콘 줄: `today_icon`(`components/today/icons.tsx`). 사주: `saju_input`(`components/saju/birth-form.tsx`), `saju_view`(`saju/reading.tsx`). 쇼츠: `shorts_open`·`shorts_view`·`shorts_sound`(`app/shorts/[id].tsx`). 구름 합치기 게임은 앱이 웹 `/game`을 웹뷰로 띄우므로 `game_start`·`game_round`·`game_over`는 웹 페이지가 보내고 `platform: 'web'`으로 찍힌다(앱 안 게임과 웹 게임을 GA에서 나눠 볼 수 없음). - 앱 `share`의 `ratio`는 `'card'` — 보이는 카드를 그대로 찍어 보내 비율을 고르지 않는다. ## GA4 설정 diff --git a/mobile/src/app/(tabs)/index.tsx b/mobile/src/app/(tabs)/index.tsx index 3d20022..e20b9ca 100644 --- a/mobile/src/app/(tabs)/index.tsx +++ b/mobile/src/app/(tabs)/index.tsx @@ -13,6 +13,7 @@ import { ShortsRail } from '@/components/shorts/rail'; import { Composer, TalkPost } from '@/components/talk/talk'; import { GakCard } from '@/components/today/gak-card'; import { Hero } from '@/components/today/hero'; +import { TodayIcons } from '@/components/today/icons'; import { SeasonBand } from '@/components/today/rails'; import { StateBox } from '@/components/ui'; import { track } from '@/lib/analytics'; @@ -72,6 +73,8 @@ export default function TodayScreen() { const talkFrom = Math.floor(posts.length / TALK_EVERY); const eventNo = new Map(posts.filter((p) => p.post_type === PostType.EVENT).map((p, n) => [p.post_id, n + 1])); const seen = useSeen(); + const scroll = useRef(null); + const myGakY = useRef(0); const { open } = useSheet(); const { my } = useLocalSearchParams<{ my?: string }>(); @@ -90,6 +93,7 @@ export default function TodayScreen() { return ( // 지역마다 새로 그려 넘긴 슬라이드 위치가 남지 않게 한다 } @@ -100,9 +104,13 @@ export default function TodayScreen() { onScroll={(e) => seen.onScroll(e.nativeEvent.contentOffset.y, e.nativeEvent.layoutMeasurement.height)} > + scroll.current?.scrollTo({ y: myGakY.current, animated: true })} /> - + {/* 아이콘 줄 '내 각'이 여기로 내려온다 */} + (myGakY.current = e.nativeEvent.layout.y)}> + + {/* 실패 안내는 여기 한 번만, 각 카드 스켈레톤과 같은 크기로 */} {stories.some((g) => g.active) ? ( diff --git a/mobile/src/components/today/icons.tsx b/mobile/src/components/today/icons.tsx new file mode 100644 index 0000000..59ae257 --- /dev/null +++ b/mobile/src/components/today/icons.tsx @@ -0,0 +1,61 @@ +import { router, type Href } from 'expo-router'; +import type { ReactNode } from 'react'; +import { Pressable, View } from 'react-native'; + +import { Text } from '@/components/text'; +import { Ic, Rail } from '@/components/ui'; +import { track } from '@/lib/analytics'; +import { HIDDEN } from '@/lib/level'; +import { useSajuSeenToday } from '@/lib/saju-birth'; + +type Item = { key: string; label: string; icon: string; badge?: ReactNode; to?: Href; onPress?: () => void }; + +const Dot = () => ; + +function Tile({ it }: { it: Item }) { + return ( + <> + + + {it.badge} + + {it.label} + + ); +} + +/** 오늘 탭 히어로 아래 아이콘 줄: 누르면 그 화면으로 가거나 내 각 줄로 내려간다. 오늘 아직 안 본 사주엔 빨간 점 (웹 todayIcons.tsx, 타로는 웹처럼 숨김) */ +export function TodayIcons({ foliage, onMyGak }: { foliage: boolean; onMyGak: () => void }) { + const sajuSeen = useSajuSeenToday(); + const all: Item[] = [ + { key: 'saju', label: '날씨 사주', icon: 'yin_yang', badge: sajuSeen ? null : , to: '/saju' }, + { key: 'game', label: '날씨 게임', icon: 'game', to: '/game' }, + ...(foliage ? [{ key: 'foliage', label: '단풍 지도', icon: 'maple', to: '/foliage' as Href }] : []), + { key: 'shorts', label: '쇼츠', icon: 'clapper', to: '/shorts' }, + { key: 'myGak', label: '내 각', icon: 'rabbit', onPress: onMyGak }, + { key: 'talk', label: '동네 이야기', icon: 'speech', to: '/talk' }, + ]; + const items = all.filter((it) => !HIDDEN.has(it.key)); + + return ( + + + {items.map((it) => ( + { + track('today_icon', { icon: it.key }); + if (it.to) router.push(it.to); + else it.onPress?.(); + }} + accessibilityRole={it.to ? 'link' : 'button'} + accessibilityLabel={it.label} + className="w-[60px] items-center" + > + + + ))} + + + ); +}