import { getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'; import { kst, seasonOf } from '@nalssigak/shared/lib'; import { useQuery } from '@tanstack/react-query'; import { usePathname } from 'expo-router'; import { useState } from 'react'; import { Text, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useCSSVariable } from 'uniwind'; import { PinIcon } from '@/components/svg'; import { Ic } from '@/components/ui'; import { useRegion } from '@/lib/region'; import { useSky } from '@/lib/sky'; const TITLES: Record = { '/sky': '노을', '/gak': '오늘의 각', '/week': '주말·행사', '/season': '계절·상식' }; /** 로고 옆 계절 칩: 계절 이름과 지금 절기 */ function SeasonChip() { const week = useQuery(getSeasonWeekOptions()); const [month] = useState(() => kst(new Date()).mo); const [name, icon] = seasonOf(month); const term = week.data?.term_now?.name; return ( {name} {term && · {term}} ); } export function TopBar() { const pathname = usePathname(); const { region } = useRegion(); const { kind } = useSky(); const { top } = useSafeAreaInsets(); const ink = String(useCSSVariable('--color-ink')); const title = TITLES[pathname]; return ( {title ? {title} : 날씨각} {region.name.split(' ').at(-1)} ); }