feat: 앱 나머지 화면 이전 — 게시물 카드·시트·각/노을/주말/계절 탭·움직임

- 게시물 카드 슬라이드 7종, 좋아요·댓글, 텍스트 공유
- 시트 7종(RN Modal), 위 막대 지역·계절·로그인/아바타
- 각·노을·주말·행사·계절·상식 탭, 당겨서 새로고침
- 히어로 해·구름·비·눈 움직임, 스켈레톤 깜빡임, 첫 로딩 덮개, 하늘색 전환
This commit is contained in:
minaChoi committed 2026-10-14 14:45:56 +09:00
1 parent 28ff032160
commit f71dd2cebb
33 files changed
+2786 -75

No files matched your search

+25 -3
View File
@@ -2,8 +2,10 @@ import { getFeedOptions, getWeatherTodayOptions } from '@nalssigak/shared/api/cl
import { kst, loadOf } from '@nalssigak/shared/lib';
import { atSlot, PREVIEW } from '@nalssigak/shared/lib/today';
import { useQuery } from '@tanstack/react-query';
import { Fragment, type ReactNode } from 'react';
import { RefreshControl, ScrollView } from 'react-native';
import { PostCard, PostCardSkel } from '@/components/post/post-card';
import { Hero } from '@/components/today/hero';
import { EventsBand, SeasonBand, Stories, StoriesSkel, TopBand } from '@/components/today/rails';
import { Sec, StateBox } from '@/components/ui';
@@ -16,6 +18,7 @@ export default function TodayScreen() {
const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }));
const { preview } = useSky();
const f = feed.data;
const posts = f?.posts ?? [];
const stories = atSlot(f?.stories ?? [], preview);
const sloted = preview != null && stories !== f?.stories;
const bands = f?.bands;
@@ -23,14 +26,33 @@ export default function TodayScreen() {
const load = loadOf(feed);
const refresh = () => Promise.all([feed.refetch(), today.refetch()]);
// 웹처럼 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
const bandAt: [number, ReactNode][] = [
[3, bands?.events?.length ? <EventsBand events={bands.events} /> : null],
[6, bands?.top5?.length ? <TopBand items={sloted ? stories.filter((g) => g.active) : bands.top5} sub={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} /> : null],
[9, bands?.season?.length ? <SeasonBand news={bands.season} /> : null],
];
return (
// 지역마다 새로 그려 넘긴 슬라이드 위치가 남지 않게 한다
<ScrollView key={region.code} contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={feed.isRefetching && !feed.isPlaceholderData} onRefresh={refresh} />} style={{ opacity: feed.isPlaceholderData ? 0.6 : 1 }}>
<Hero hero={f?.hero} today={today.data} ranked={stories} feedLoad={load} todayLoad={loadOf(today)} />
<Sec title="오늘의 각" sub="누르면 계산 근거를 보여 줘요" more="/gak" />
{stories.length ? <Stories items={stories} /> : load === 'loading' ? <StoriesSkel /> : <StateBox load={load} onRetry={() => feed.refetch()} empty="오늘 계산된 각이 없어요." />}
{!!bands?.events?.length && <EventsBand events={bands.events} />}
{!!bands?.top5?.length && <TopBand items={sloted ? stories.filter((g) => g.active) : bands.top5} sub={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} />}
{!!bands?.season?.length && <SeasonBand news={bands.season} />}
{load === 'loading' && (
<>
<PostCardSkel />
<PostCardSkel />
</>
)}
{load !== 'loading' && !posts.length && <StateBox load={load === 'ready' ? 'ready' : load} onRetry={() => feed.refetch()} empty="오늘 올라온 글이 아직 없어요." />}
{posts.map((p, i) => (
<Fragment key={p.post_id}>
<PostCard post={p} />
{bandAt.find(([at]) => at === i + 1)?.[1]}
</Fragment>
))}
{feed.isSuccess && bandAt.filter(([at]) => at > posts.length).map(([at, node]) => <Fragment key={at}>{node}</Fragment>)}
</ScrollView>
);
}