feat: 앱 오늘 탭 아이콘 줄 — 날씨 사주(오늘 안 봤으면 빨간 점)·날씨 게임·쇼츠·내 각(그 줄로 내려감)·동네 이야기, 타로는 웹처럼 숨김 (GA today_icon)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
skkimandClaude committed 2026-11-04 17:49:01 +09:00
1 parent 02ebcda0ea
commit 6daa2f4d2a
3 files changed
+71 -2

No files matched your search

+9 -1
View File
@@ -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}시 기준` : '오늘 기준'} />
+61
View File
@@ -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>
);
}