diff --git a/TODO.md b/TODO.md index 2064786..e1cf051 100644 --- a/TODO.md +++ b/TODO.md @@ -175,7 +175,8 @@ | [x] | 움직임: 해·구름 떨어지기/둥둥, 비·눈, 스켈레톤 깜빡임, 첫 로딩 덮개, 하늘색 서서히 바뀜, 밤 별 반짝임 ('동작 줄이기' 켜면 멈춤) | | `mobile/src/components/today/hero.tsx`, `first-load.tsx`, `sky-bg.tsx` | | [x] | 나머지 탭(각·노을·주말·행사·계절·상식) 옮기기 | | `mobile/src/app/`, `mobile/src/components/{gak,sky,week,season}/` | | [x] | 이미지로 공유(`react-native-view-shot` + `expo-sharing`): 게시물은 보고 있는 슬라이드, 주말은 고른 날 추천 카드 | 웹 스토리 이미지(머리말·주소 붙인 9:16)와는 다름 | `mobile/src/lib/share-image.ts` | -| [ ] | 웹과 다른 작은 것들: 좋아요 튀는 하트·토스트, 밤 별똥별, 단풍잎 떨어짐, 시 구절 고운바탕 글꼴, 실패·빈 안내가 스켈레톤 높이를 유지(웹 hold), 시트 배경이 판과 같이 올라옴 | 1차 이전에서 뺌 | `mobile/src/` | +| [x] | 웹과 다른 작은 것들 맞춤: 좋아요 튀는 하트·토스트, 밤 별똥별, 단풍잎 떨어짐, 시 구절 고운바탕, 실패·빈 안내 높이 유지(hold), 시트 배경은 제자리 페이드 | | `mobile/src/` | +| [ ] | 공유 이미지를 웹처럼 9:16 스토리(머리말·사이트 주소)로 — 지금은 화면 그대로 찍음. 좋아요 효과는 카드 안에만 뜸(RN에 portal 없음) | 남은 차이 | `mobile/src/lib/share-image.ts`, `mobile/src/components/post/` | | [x] | `mobile/` 템플릿 예제 화면·`.vscode`·`LICENSE`·README 지움, `AGENTS.md`·`.claude`는 둠 | 사용자 결정 | `mobile/` | | [ ] | `frontend-dev` 개발 컨테이너 실제로 띄워 확인 (이미지 빌드만 확인, 5173이 사용 중이라 실행은 못 함) | 볼륨 경로 바뀜 | `compose.yaml` | | [ ] | 운영 서버가 git pull 뒤 루트 `package-lock.json`으로 빌드되는지 배포 때 확인 | 빌드 대상이 `./frontend` → `.` | `deploy.sh`, `compose.yaml` | diff --git a/mobile/src/app/_layout.tsx b/mobile/src/app/_layout.tsx index 12a5aa9..45b2c9e 100644 --- a/mobile/src/app/_layout.tsx +++ b/mobile/src/app/_layout.tsx @@ -1,5 +1,6 @@ import '@/lib/api'; import { BagelFatOne_400Regular } from '@expo-google-fonts/bagel-fat-one'; +import { GowunBatang_400Regular } from '@expo-google-fonts/gowun-batang'; import { Jua_400Regular, useFonts } from '@expo-google-fonts/jua'; import { QueryClientProvider } from '@tanstack/react-query'; import { Tabs } from 'expo-router/tabs'; @@ -41,7 +42,7 @@ function Shell() { } export default function RootLayout() { - const [loaded, error] = useFonts({ Jua_400Regular, BagelFatOne_400Regular }); + const [loaded, error] = useFonts({ Jua_400Regular, BagelFatOne_400Regular, GowunBatang_400Regular }); useEffect(() => { if (loaded || error) SplashScreen.hideAsync(); }, [loaded, error]); diff --git a/mobile/src/app/gak.tsx b/mobile/src/app/gak.tsx index e1a4de6..7813e90 100644 --- a/mobile/src/app/gak.tsx +++ b/mobile/src/app/gak.tsx @@ -40,13 +40,13 @@ export default function GakScreen() { return ( q.refetch()} />}> - {top.length === 3 ? : load === 'loading' ? : q.refetch()} empty="오늘 1~3위를 아직 못 정했어요." />} + {top.length === 3 ? : load === 'loading' ? : q.refetch()} empty="오늘 1~3위를 아직 못 정했어요." hold={} />} {load === 'loading' ? ( ) : !items.length ? ( // 실패 안내·다시 시도는 위 받침대 자리에 한 번만 - + } boxClassName="inset-3" /> ) : ( )} diff --git a/mobile/src/app/index.tsx b/mobile/src/app/index.tsx index 25ea026..2c5bb36 100644 --- a/mobile/src/app/index.tsx +++ b/mobile/src/app/index.tsx @@ -38,14 +38,27 @@ export default function TodayScreen() { } style={{ opacity: feed.isPlaceholderData ? 0.6 : 1 }}> - {stories.length ? : load === 'loading' ? : feed.refetch()} empty="오늘 계산된 각이 없어요." />} + {stories.length ? : load === 'loading' ? : feed.refetch()} empty="오늘 계산된 각이 없어요." hold={} boxClassName="inset-x-3 top-3 bottom-1" />} {load === 'loading' && ( <> )} - {load !== 'loading' && !posts.length && feed.refetch()} empty="오늘 올라온 글이 아직 없어요." />} + {/* 글이 없거나 못 받아도 스켈레톤 두 장 자리는 그대로 둔다. 다시 시도는 위 각 줄에 한 번만 */} + {load !== 'loading' && !posts.length && ( + + + + + } + boxClassName="inset-x-3 top-3.5" + /> + )} {posts.map((p, i) => ( diff --git a/mobile/src/app/season.tsx b/mobile/src/app/season.tsx index fd272fc..e57743a 100644 --- a/mobile/src/app/season.tsx +++ b/mobile/src/app/season.tsx @@ -31,11 +31,11 @@ export default function SeasonScreen() { return ( }> - {w?.headline ? open({ type: 'seasonWeek' })} /> : weekLoad === 'loading' ? : week.refetch()} empty="이번 주 특집이 아직 없어요." />} + {w?.headline ? open({ type: 'seasonWeek' })} /> : weekLoad === 'loading' ? : week.refetch()} empty="이번 주 특집이 아직 없어요." hold={} />} {artLoad === 'loading' && } - {artLoad !== 'loading' && !list.length && arts.refetch()} empty="읽을거리가 아직 없어요." />} + {artLoad !== 'loading' && !list.length && arts.refetch()} empty="읽을거리가 아직 없어요." hold={} boxClassName="inset-3" />} {list.map((a) => ( open({ type: 'article', articleId: a.article_id })} /> ))} diff --git a/mobile/src/app/sky.tsx b/mobile/src/app/sky.tsx index c68e134..8b18c60 100644 --- a/mobile/src/app/sky.tsx +++ b/mobile/src/app/sky.tsx @@ -5,12 +5,32 @@ import { useState } from 'react'; import { RefreshControl, ScrollView, View } from 'react-native'; import { DayTiles, Li, LiSkel, ScoreHelp, SkyHero, Timeline } from '@/components/sky/parts'; -import { Sec, StateBox } from '@/components/ui'; +import { Sec, Skel, StateBox } from '@/components/ui'; import { useRegion } from '@/lib/region'; const THREE = [0, 1, 2]; const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i); +/** 히어로 글자 자리 (실패·빈 안내를 같은 높이로 띄우려고) */ +function HeroHold() { + return ( + + + + + ); +} + +function LiSkels({ n }: { n: number[] }) { + return ( + + {n.map((i) => ( + + ))} + + ); +} + export default function SkyScreen() { const { region } = useRegion(); const sky = useQuery(getSkyOptions({ query: { region: region.code } })); @@ -32,13 +52,13 @@ export default function SkyScreen() { ) : ( - sky.refetch()} empty="오늘 노을 정보가 없어요." /> + sky.refetch()} empty="오늘 노을 정보가 없어요." hold={} boxClassName="inset-x-0 top-1.5 bottom-0" /> )} {plans.length > 1 && } {plan && } - {plan?.timeline?.length || load === 'loading' ? : } + {plan?.timeline?.length || load === 'loading' ? : } />} {!rise && } {rise ? null : spots.length ? ( @@ -58,7 +78,7 @@ export default function SkyScreen() { ) : ( // 실패 안내·다시 시도는 위 히어로에 한 번만 - + } /> )} {items.length ? ( @@ -74,7 +94,7 @@ export default function SkyScreen() { ))} ) : ( - ranking.refetch()} empty="순위가 아직 없어요." /> + ranking.refetch()} empty="순위가 아직 없어요." hold={} boxClassName="inset-x-3 top-1.5 bottom-0" /> )} ); diff --git a/mobile/src/app/week.tsx b/mobile/src/app/week.tsx index 8bd3c96..d4d2118 100644 --- a/mobile/src/app/week.tsx +++ b/mobile/src/app/week.tsx @@ -66,7 +66,17 @@ export default function WeekScreen() { ) : ( - week.refetch()} empty="날씨가 아직 없어요." /> + week.refetch()} + empty="날씨가 아직 없어요." + hold={ + <> + + + + } + /> )} {sel && ( @@ -97,7 +107,7 @@ export default function WeekScreen() { ) : placeLoad === 'loading' ? ( ) : ( - places.refetch()} empty={sel ? '30km 안에 데이트 명소가 아직 없어요.' : '날씨를 불러오면 명소를 골라 드려요.'} /> + places.refetch()} empty={sel ? '30km 안에 데이트 명소가 아직 없어요.' : '날씨를 불러오면 명소를 골라 드려요.'} hold={} /> )} )} @@ -116,7 +126,7 @@ export default function WeekScreen() { ) : rankLoad === 'loading' ? ( ) : ( - ranking.refetch()} empty="주말 예보가 아직 없어요." /> + ranking.refetch()} empty="주말 예보가 아직 없어요." hold={} boxClassName="inset-x-3 top-1.5 bottom-0" /> )} {eventList.length ? ( @@ -128,7 +138,7 @@ export default function WeekScreen() { ) : eventLoad === 'loading' ? ( ) : ( - events.refetch()} empty="30km 안에 열리는 행사가 아직 없어요. 다른 지역을 골라 보세요." /> + events.refetch()} empty="30km 안에 열리는 행사가 아직 없어요. 다른 지역을 골라 보세요." hold={} boxClassName="inset-x-3 top-2.5 bottom-0" /> )} {/* 행사 수가 정해진 뒤에 붙여 목록이 늘어날 때 밀리지 않게 */} {eventLoad !== 'loading' && ( diff --git a/mobile/src/components/post/like-burst.tsx b/mobile/src/components/post/like-burst.tsx new file mode 100644 index 0000000..894b797 --- /dev/null +++ b/mobile/src/components/post/like-burst.tsx @@ -0,0 +1,64 @@ +import { useEffect } from 'react'; +import { View } from 'react-native'; +import Animated, { Easing, interpolate, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withTiming } from 'react-native-reanimated'; +import Svg, { Path } from 'react-native-svg'; + +import { HEART } from '@/components/post/icons'; + +// 튀어 나가는 작은 하트: x·y 이동, 회전, 색 (웹 BURST) +const BURST: [number, number, number, string][] = [ + [-86, -60, -24, '#ff3b5c'], + [84, -66, 22, '#ff8e4e'], + [-104, 18, -40, '#ffc86e'], + [102, 24, 36, '#ff3b5c'], + [-48, -104, -8, '#ff8aa0'], + [52, -100, 12, '#ffc86e'], +]; + +function Bit({ dx, dy, rot, color }: { dx: number; dy: number; rot: number; color: string }) { + const p = useSharedValue(0); + useEffect(() => { + p.value = withDelay(80, withTiming(1, { duration: 900, easing: Easing.bezier(0.2, 0.8, 0.3, 1) })); + }, [p]); + const style = useAnimatedStyle(() => ({ + opacity: interpolate(p.value, [0, 0.25, 1], [0, 1, 0]), + transform: [{ translateX: dx * p.value }, { translateY: dy * p.value }, { scale: interpolate(p.value, [0, 1], [0.4, 1.1]) }, { rotate: `${rot * p.value}deg` }], + })); + return ( + + + + + + ); +} + +function Toast() { + const p = useSharedValue(0); + useEffect(() => { + p.value = withTiming(1, { duration: 1300, easing: Easing.bezier(0.2, 0.9, 0.3, 1) }); + }, [p]); + const style = useAnimatedStyle(() => ({ + opacity: interpolate(p.value, [0, 0.18, 0.78, 1], [0, 1, 1, 0]), + transform: [{ translateY: interpolate(p.value, [0, 0.18, 0.78, 1], [14, 0, 0, -8]) }, { scale: interpolate(p.value, [0, 0.18, 0.3, 1], [0.85, 1.06, 1, 1]) }], + })); + return ( + + 좋아요했어요! + + ); +} + +/** 좋아요 때 하트 조각이 튀어 나가고 '좋아요했어요!' 가 떴다 사라진다 */ +export function LikeBurst() { + const reduce = useReducedMotion(); + if (reduce) return null; + return ( + + {BURST.map(([dx, dy, rot, color], k) => ( + + ))} + + + ); +} diff --git a/mobile/src/components/post/post-card.tsx b/mobile/src/components/post/post-card.tsx index 6217b71..4ea6713 100644 --- a/mobile/src/components/post/post-card.tsx +++ b/mobile/src/components/post/post-card.tsx @@ -8,6 +8,7 @@ import Svg, { Path } from 'react-native-svg'; import { useCSSVariable } from 'uniwind'; import { CommentIcon, HEART, HeartIcon, SendIcon } from '@/components/post/icons'; +import { LikeBurst } from '@/components/post/like-burst'; import { Dots, Pager } from '@/components/post/pager'; import { slideBg, SlideView } from '@/components/post/slides'; import { Ic, Skel } from '@/components/ui'; @@ -197,6 +198,7 @@ function FullCard({ post }: PostProps) { )} {pop > 0 && } + {pop > 0 && } {likeFailed > 0 && ( {liked ? '좋아요를 취소하지 못했어요' : '좋아요를 반영하지 못했어요'}. 다시 해 주세요. diff --git a/mobile/src/components/season/parts.tsx b/mobile/src/components/season/parts.tsx index 69664b9..84fa103 100644 --- a/mobile/src/components/season/parts.tsx +++ b/mobile/src/components/season/parts.tsx @@ -3,6 +3,7 @@ import { ARTICLE_LABEL, cardBg, dateRange, shortDay } from '@nalssigak/shared/li import { LinearGradient } from 'expo-linear-gradient'; import { Pressable, Text, View } from 'react-native'; +import { Fall } from '@/components/fall'; import { Credit, Ic, Skel, Thumb } from '@/components/ui'; import { CARD_BG } from '@/lib/colors'; import { useSky } from '@/lib/sky'; @@ -54,10 +55,12 @@ export function SeasonHead({ week: w, onPress }: { week: ResSeasonWeek; onPress: return ( - + + + 이번 주 특집{w.start && w.end ? ` · ${dateRange(w.start, w.end)}` : ''} {w.headline} - {poem.length > 0 && {poem.join('\n')}} + {poem.length > 0 && {poem.join('\n')}} {w.term_now && w.term_next && ( diff --git a/mobile/src/components/sheets/article.tsx b/mobile/src/components/sheets/article.tsx index b0f960a..044ef22 100644 --- a/mobile/src/components/sheets/article.tsx +++ b/mobile/src/components/sheets/article.tsx @@ -22,7 +22,7 @@ export function ArticleSheet({ articleId, onTitle }: { articleId: number; onTitl }, [a, onTitle]); const load = loadOf(q); - if (!a) return {load === 'loading' ? : q.refetch()} empty="글을 찾지 못했어요." />}; + if (!a) return {load === 'loading' ? : q.refetch()} empty="글을 찾지 못했어요." hold={} boxClassName="inset-0" />}; return ( @@ -46,7 +46,7 @@ export function SeasonWeekSheet() { const q = useQuery(getSeasonWeekOptions()); const w = q.data; const load = loadOf(q); - if (!w?.headline) return {load === 'loading' ? : q.refetch()} empty="이번 주 특집이 아직 없어요." />}; + if (!w?.headline) return {load === 'loading' ? : q.refetch()} empty="이번 주 특집이 아직 없어요." hold={} boxClassName="inset-0" />}; return ( @@ -57,7 +57,7 @@ export function SeasonWeekSheet() { {w.headline} {(w.poem_lines ?? []).length > 0 && ( - + {w.poem_lines?.join(' ')} {w.author && {w.author}} diff --git a/mobile/src/components/sheets/comments.tsx b/mobile/src/components/sheets/comments.tsx index a5aa2c6..5881e18 100644 --- a/mobile/src/components/sheets/comments.tsx +++ b/mobile/src/components/sheets/comments.tsx @@ -190,7 +190,7 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin ) : loadOf(list) === 'loading' ? ( ) : ( - list.refetch()} empty="아직 댓글이 없어요. 첫 댓글을 남겨 보세요." /> + list.refetch()} empty="아직 댓글이 없어요. 첫 댓글을 남겨 보세요." hold={} boxClassName="inset-0" /> )} diff --git a/mobile/src/components/sheets/gak.tsx b/mobile/src/components/sheets/gak.tsx index 576b801..1b9ca85 100644 --- a/mobile/src/components/sheets/gak.tsx +++ b/mobile/src/components/sheets/gak.tsx @@ -110,7 +110,7 @@ export function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: s }, [g, onTitle]); const load = loadOf(q); - if (!g) return {load === 'loading' ? : q.refetch()} empty="이 각의 계산 근거가 아직 없어요." />}; + if (!g) return {load === 'loading' ? : q.refetch()} empty="이 각의 계산 근거가 아직 없어요." hold={} boxClassName="inset-0" />}; const factors = d.factors ?? []; const bands = d.bands ?? []; const now = bands.find((b) => b.current); diff --git a/mobile/src/components/sheets/index.tsx b/mobile/src/components/sheets/index.tsx index 8fb4a06..dda6630 100644 --- a/mobile/src/components/sheets/index.tsx +++ b/mobile/src/components/sheets/index.tsx @@ -1,6 +1,7 @@ import { subscribeAuth } from '@nalssigak/shared/api/auth'; import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'; import { KeyboardAvoidingView, Modal, Platform, Pressable, Text, View } from 'react-native'; +import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { SheetContext, useSheet, type SheetState } from '@/lib/sheet'; @@ -31,8 +32,29 @@ export function SheetProvider({ children }: { children: ReactNode }) { const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기' } as const; -/** 아래에서 올라오는 창. 바깥을 누르거나 뒤로 가기(안드로이드)로 닫는다 */ -function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void }) { +/** 판만 아래에서 올라온다 (웹 b-sheet: 0.26초, 40px 아래·흐릿하게에서) */ +function Rise({ children }: { children: ReactNode }) { + const reduce = useReducedMotion(); + const p = useSharedValue(reduce ? 1 : 0); + useEffect(() => { + p.value = withTiming(1, { duration: 260, easing: Easing.bezier(0.2, 0.9, 0.3, 1) }); + }, [p]); + const anim = useAnimatedStyle(() => ({ opacity: 0.4 + 0.6 * p.value, transform: [{ translateY: 40 * (1 - p.value) }] })); + return {children}; +} + +/** 아래에서 올라오는 창. 배경은 제자리에서 서서히. 바깥을 누르거나 뒤로 가기(안드로이드)로 닫는다 */ +function SheetHost({ state: next, onClose }: { state: SheetState; onClose: () => void }) { + // 닫는 동안(배경이 사라지는 동안)에도 마지막 내용을 그대로 보여 준다. 열 때마다 판을 새로 올린다 + const [last, setLast] = useState(next); + const [isOpen, setIsOpen] = useState(next != null); + const [opens, setOpens] = useState(0); + if (next && next !== last) setLast(next); + if ((next != null) !== isOpen) { + setIsOpen(next != null); + if (next) setOpens((n) => n + 1); + } + const state = next ?? last; const { open } = useSheet(); const { bottom } = useSafeAreaInsets(); const [gakTitle, setGakTitle] = useState(''); @@ -42,28 +64,30 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void const title = !state ? '' : state.type === 'gak' ? gakTitle : state.type === 'article' ? articleTitle || TITLES.article : TITLES[state.type]; return ( - + {state && ( - - - - - {title} - - - × - + + + + + + {title} + + + × + + + {state.type === 'gak' && } + {state.type === 'article' && } + {state.type === 'seasonWeek' && } + {state.type === 'comments' && } + {state.type === 'login' && open(then) : onClose} />} + {state.type === 'me' && } + {state.type === 'region' && } - {state.type === 'gak' && } - {state.type === 'article' && } - {state.type === 'seasonWeek' && } - {state.type === 'comments' && } - {state.type === 'login' && open(then) : onClose} />} - {state.type === 'me' && } - {state.type === 'region' && } - + )} diff --git a/mobile/src/components/sheets/region.tsx b/mobile/src/components/sheets/region.tsx index 6d49bdd..d75fd4f 100644 --- a/mobile/src/components/sheets/region.tsx +++ b/mobile/src/components/sheets/region.tsx @@ -55,7 +55,7 @@ export function RegionSheet({ onDone }: { onDone: () => void }) { {listLoad === 'loading' && } - {listLoad !== 'loading' && !regions.length && list.refetch()} empty="찾는 구가 없어요." />} + {listLoad !== 'loading' && !regions.length && (listLoad === 'ready' ? : list.refetch()} hold={} boxClassName="inset-x-0 top-2 bottom-0" />)} {regions.map((r) => { const here = r.code === region.code; diff --git a/mobile/src/components/sky-bg.tsx b/mobile/src/components/sky-bg.tsx index e9ec5f3..7b5f6bb 100644 --- a/mobile/src/components/sky-bg.tsx +++ b/mobile/src/components/sky-bg.tsx @@ -1,8 +1,8 @@ import type { TimeKind } from '@nalssigak/shared/lib'; import { LinearGradient } from 'expo-linear-gradient'; import { useEffect } from 'react'; -import { StyleSheet, View } from 'react-native'; -import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withRepeat, withTiming } from 'react-native-reanimated'; +import { StyleSheet, View, type DimensionValue } from 'react-native'; +import Animated, { cancelAnimation, Easing, interpolate, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withRepeat, withTiming } from 'react-native-reanimated'; import { useSky } from '@/lib/sky'; @@ -43,7 +43,40 @@ function Star({ star, reduce }: { star: (typeof STARS)[number]; reduce: boolean return ; } -/** 화면 전체 하늘: 시간대별 색이 서서히 바뀌고, 밤에는 별이 반짝인다 */ +export type ShootSpec = { top: DimensionValue; left: DimensionValue; len: number; dur: number; dl: number }; + +// 별똥별: 위치·길이·주기를 엇갈려 몇 초마다 하나씩 떨어지게 (웹 BLayout SHOOTS, 밀리초) +const SHOOTS: ShootSpec[] = [ + { top: '8%', left: '78%', len: 110, dur: 7000, dl: 1000 }, + { top: '22%', left: '46%', len: 80, dur: 9000, dl: 3500 }, + { top: '5%', left: '30%', len: 95, dur: 8000, dl: 5500 }, + { top: '36%', left: '88%', len: 70, dur: 10000, dl: 2200 }, + { top: '52%', left: '62%', len: 90, dur: 11000, dl: 7000 }, + { top: '14%', left: '96%', len: 120, dur: 12000, dl: 9000 }, +]; + +/** 별똥별 하나: 주기 끝 14% 동안만 비스듬히 240px 미끄러지며 반짝 (웹 .b-shoot). 동작 줄이기면 그리지 않는다 */ +export function Shoot({ top, left, len, dur, dl }: ShootSpec) { + const reduce = useReducedMotion(); + const p = useSharedValue(0); + useEffect(() => { + if (reduce) return; + p.value = withDelay(dl, withRepeat(withTiming(1, { duration: dur, easing: Easing.in(Easing.ease) }), -1, false)); + return () => cancelAnimation(p); + }, [reduce, dur, dl, p]); + const style = useAnimatedStyle(() => ({ + opacity: interpolate(p.value, [0, 0.86, 0.89, 1], [0, 0, 1, 0]), + transform: [{ rotate: '-24deg' }, { translateX: interpolate(p.value, [0, 0.86, 1], [0, 0, -240]) }], + })); + if (reduce) return null; + return ( + + + + ); +} + +/** 화면 전체 하늘: 시간대별 색이 서서히 바뀌고, 밤에는 별이 반짝이고 별똥별이 떨어진다 */ export function SkyBg() { const { kind } = useSky(); const reduce = useReducedMotion(); @@ -53,6 +86,7 @@ export function SkyBg() { ))} {kind === 'night' && STARS.map((s, i) => )} + {kind === 'night' && SHOOTS.map((s, i) => )} ); } diff --git a/mobile/src/components/today/hero.tsx b/mobile/src/components/today/hero.tsx index b260140..ede5c5f 100644 --- a/mobile/src/components/today/hero.tsx +++ b/mobile/src/components/today/hero.tsx @@ -9,6 +9,7 @@ import { LinearGradient } from 'expo-linear-gradient'; import Svg, { Defs, Path, RadialGradient, Rect, Stop } from 'react-native-svg'; import { Fall } from '@/components/fall'; +import { Shoot, type ShootSpec } from '@/components/sky-bg'; import { Ic, Skel } from '@/components/ui'; import { useSheet } from '@/lib/sheet'; import { useSky } from '@/lib/sky'; @@ -31,6 +32,13 @@ const ORB: Record<'sun' | 'sunset' | 'night', { stops: [string, string, string, const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }) as const); // 구름 자리·떨어지는 지연·둥둥 주기 (웹 CLOUDS). 구름 수: 구름 많음 둘, 흐림·비·눈 셋 +// 별똥별 셋: 위치·길이·주기를 엇갈려 하나씩 떨어지게 (웹 TodayPage SHOOTS, 밀리초) +const SHOOTS: ShootSpec[] = [ + { top: '6%', left: '80%', len: 90, dur: 7000, dl: 1500 }, + { top: '20%', left: '52%', len: 70, dur: 9000, dl: 4000 }, + { top: '34%', left: '94%', len: 80, dur: 11000, dl: 6500 }, +]; + const CLOUDS = [ { top: 36, left: '5%', w: 84, h: 32, d: 100, f: 6000 }, { top: 96, left: '63%', w: 96, h: 36, d: 250, f: 6400 }, @@ -136,6 +144,7 @@ export function Hero({ hero, today, ranked, feedLoad, todayLoad }: Props) { {kind === 'night' && STARS.map((s, i) => )} + {kind === 'night' && SHOOTS.map((s, i) => )} {(rain || snow) && ( {rain && DROPS.map((p, i) => )} diff --git a/mobile/src/components/ui.tsx b/mobile/src/components/ui.tsx index a049bc3..0ca625e 100644 --- a/mobile/src/components/ui.tsx +++ b/mobile/src/components/ui.tsx @@ -81,13 +81,17 @@ export function Rail({ children }: { children: ReactNode }) { ); } -/** 실패·빈 목록 안내. 불러오는 중엔 그리지 않는다(그 자리는 스켈레톤) */ -export function StateBox({ load, onRetry, empty }: { load: Load; onRetry?: () => void; empty?: string }) { +/** + * 실패·빈 목록 안내. 불러오는 중엔 그리지 않는다(그 자리는 스켈레톤). + * hold 에 스켈레톤을 주면 그 크기를 보이지 않게 깔고 안내를 그 위에 띄운다 — 로딩·실패·빈 상태의 자리 크기가 같다. + * 이때 boxClassName 은 안내 상자의 위치(스켈레톤 바깥 여백만큼 inset). + */ +export function StateBox({ load, onRetry, empty, hold, boxClassName = 'inset-x-3 top-3 bottom-0' }: { load: Load; onRetry?: () => void; empty?: string; hold?: ReactNode; boxClassName?: string }) { const failed = load === 'error' || load === 'retrying'; const text = failed ? '정보를 불러오지 못했어요.' : load === 'ready' ? empty : undefined; if (!text) return null; - return ( - + const box = ( + {text} {failed && onRetry && ( @@ -96,6 +100,15 @@ export function StateBox({ load, onRetry, empty }: { load: Load; onRetry?: () => )} ); + if (!hold) return box; + return ( + + + {hold} + + {box} + + ); } /** 사진 출처 표기 (공공누리 조건). 위치는 className 으로 */ diff --git a/mobile/src/global.css b/mobile/src/global.css index 4bc6941..7436086 100644 --- a/mobile/src/global.css +++ b/mobile/src/global.css @@ -44,4 +44,5 @@ @theme { --font-jua: 'Jua_400Regular'; --font-bagel: 'BagelFatOne_400Regular'; + --font-batang: 'GowunBatang_400Regular'; }