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
@@ -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