feat: 앱 오늘 탭 아이콘 줄 — 날씨 사주(오늘 안 봤으면 빨간 점)·날씨 게임·쇼츠·내 각(그 줄로 내려감)·동네 이야기, 타로는 웹처럼 숨김 (GA today_icon)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
02ebcda0ea
commit
6daa2f4d2a
3 files changed
+71
-2
No files matched your search
+1
-1
@@ -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 설정
|
||||
|
||||
@@ -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<ScrollView>(null);
|
||||
const myGakY = useRef(0);
|
||||
const { open } = useSheet();
|
||||
const { my } = useLocalSearchParams<{ my?: string }>();
|
||||
|
||||
@@ -90,6 +93,7 @@ export default function TodayScreen() {
|
||||
return (
|
||||
// 지역마다 새로 그려 넘긴 슬라이드 위치가 남지 않게 한다
|
||||
<ScrollView
|
||||
ref={scroll}
|
||||
key={region.code}
|
||||
contentContainerClassName="pb-6"
|
||||
refreshControl={<RefreshControl refreshing={feed.isRefetching && !feed.isPlaceholderData} onRefresh={refresh} />}
|
||||
@@ -100,9 +104,13 @@ export default function TodayScreen() {
|
||||
onScroll={(e) => seen.onScroll(e.nativeEvent.contentOffset.y, e.nativeEvent.layoutMeasurement.height)}
|
||||
>
|
||||
<Hero hero={f?.hero} post={f?.hero_post} today={today.data} ranked={stories} feedLoad={load} todayLoad={loadOf(today)} />
|
||||
<TodayIcons foliage={false} onMyGak={() => scroll.current?.scrollTo({ y: myGakY.current, animated: true })} />
|
||||
<ShortsRail />
|
||||
<Composer />
|
||||
<MyGakRow />
|
||||
{/* 아이콘 줄 '내 각'이 여기로 내려온다 */}
|
||||
<View onLayout={(e) => (myGakY.current = e.nativeEvent.layout.y)}>
|
||||
<MyGakRow />
|
||||
</View>
|
||||
{/* 실패 안내는 여기 한 번만, 각 카드 스켈레톤과 같은 크기로 */}
|
||||
{stories.some((g) => g.active) ? (
|
||||
<GakCard items={stories} post={f?.gak_post} place={region.name.split(' ').at(-1)!} at={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} />
|
||||
|
||||
@@ -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 = () => <View className="absolute -top-0.5 -right-0.5 size-[11px] rounded-full border-2 border-white bg-[#ff4d4f]" />;
|
||||
|
||||
function Tile({ it }: { it: Item }) {
|
||||
return (
|
||||
<>
|
||||
<View className="size-[52px] items-center justify-center rounded-[17px] border-b-4 border-shade bg-card">
|
||||
<Ic name={it.icon} size={32} />
|
||||
{it.badge}
|
||||
</View>
|
||||
<Text className="mt-1.5 text-[11.5px] font-extrabold text-ink2">{it.label}</Text>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** 오늘 탭 히어로 아래 아이콘 줄: 누르면 그 화면으로 가거나 내 각 줄로 내려간다. 오늘 아직 안 본 사주엔 빨간 점 (웹 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 : <Dot />, 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 (
|
||||
<View accessibilityLabel="바로 가기" className="pb-2">
|
||||
<Rail>
|
||||
{items.map((it) => (
|
||||
<Pressable
|
||||
key={it.key}
|
||||
onPress={() => {
|
||||
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"
|
||||
>
|
||||
<Tile it={it} />
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user