import { type ReactNode } from 'react' import { Link } from 'react-router' import { track } from '../lib/analytics' import { HIDDEN } from './features' import { useFoliage } from './foliage' import { useTarotBadge } from './fortune' import { sajuSeenToday } from './SajuPage' import { useSheet } from './sheetContext' import { Ic, Rail } from './ui' /** 오늘 탭 '내 각' 줄 자리 (아이콘에서 거기로 내려간다) */ export const MY_GAK_ID = 'my-gak' type Item = { key: string; label: string; icon: string; badge?: ReactNode; to?: string; onClick?: () => void } const Dot = () => /** 오늘 탭 히어로 아래 아이콘 줄: 누르면 창이 뜨거나 그 페이지로 간다. 오늘 아직 안 본 것엔 빨간 점 */ export function TodayIcons() { const { open } = useSheet() const tarot = useTarotBadge() const { inSeason } = useFoliage() const items: Item[] = [ { key: 'tarot', label: '오늘 타로', icon: 'crystal_ball', badge: tarot.drawn ? ( {tarot.streak}일째 ) : ( ), onClick: () => open({ type: 'tarot' }), }, { key: 'saju', label: '날씨 사주', icon: 'yin_yang', badge: sajuSeenToday() ? null : , to: '/saju' }, { key: 'game', label: '날씨 게임', icon: 'game', to: '/game' }, ...(inSeason ? [{ key: 'foliage', label: '단풍 지도', icon: 'maple', to: '/foliage' }] : []), { key: 'shorts', label: '쇼츠', icon: 'clapper', to: '/shorts' }, { key: 'myGak', label: '내 각', icon: 'rabbit', onClick: () => document.getElementById(MY_GAK_ID)?.scrollIntoView({ behavior: 'smooth', block: 'start' }) }, { key: 'talk', label: '동네 이야기', icon: 'speech', to: '/talk' }, ].filter((it) => !HIDDEN.has(it.key)) const tile = (it: Item) => ( <> {it.badge} {it.label} ) const cls = 'flex w-[60px] cursor-pointer flex-col items-center' return ( {items.map((it) => it.to ? ( track('today_icon', { icon: it.key })} className={cls}> {tile(it)} ) : ( ), )} ) }