feat: 앱 나머지 화면 이전 — 게시물 카드·시트·각/노을/주말/계절 탭·움직임
- 게시물 카드 슬라이드 7종, 좋아요·댓글, 텍스트 공유 - 시트 7종(RN Modal), 위 막대 지역·계절·로그인/아바타 - 각·노을·주말·행사·계절·상식 탭, 당겨서 새로고침 - 히어로 해·구름·비·눈 움직임, 스켈레톤 깜빡임, 첫 로딩 덮개, 하늘색 전환
This commit is contained in:
1 parent
28ff032160
commit
f71dd2cebb
33 files changed
+2786
-75
No files matched your search
@@ -11,6 +11,7 @@ import { View } from 'react-native';
|
||||
import '@/global.css';
|
||||
import { SkyBg } from '@/components/sky-bg';
|
||||
import { TabBar } from '@/components/tab-bar';
|
||||
import { FirstLoad } from '@/components/first-load';
|
||||
import { SheetProvider } from '@/components/sheets';
|
||||
import { TopBar } from '@/components/top-bar';
|
||||
import { AuthProvider } from '@/lib/auth';
|
||||
@@ -34,6 +35,7 @@ function Shell() {
|
||||
<Tabs.Screen name="week" />
|
||||
<Tabs.Screen name="season" />
|
||||
</Tabs>
|
||||
<FirstLoad />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
+62
-3
@@ -1,5 +1,64 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
import { listArticlesOptions, listIndicesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { ArticleCategory, IndexCategory } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { kst, loadOf, seasonOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="오늘의 각" />;
|
||||
import { GakGrid, GridSkel } from '@/components/gak/grid';
|
||||
import { Podium, PodiumSkel } from '@/components/gak/podium';
|
||||
import { Chips, Ic, Sec, StateBox } from '@/components/ui';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
|
||||
type Cat = 'all' | 'out' | 'food' | 'home' | 'life' | 'core';
|
||||
|
||||
// 마지막 칩은 지금 계절의 제철 각 (예: 가을 각)
|
||||
const CATS: readonly (readonly [Cat, string])[] = [
|
||||
['all', '전체'],
|
||||
['out', '밖에서 놀기'],
|
||||
['food', '먹고 마시기'],
|
||||
['home', '집안일'],
|
||||
['life', '생활 고민'],
|
||||
['core', `${seasonOf(kst(new Date()).mo)[0]} 각`],
|
||||
];
|
||||
|
||||
const CAT_PARAM: Partial<Record<Cat, IndexCategory>> = { out: IndexCategory.OUTSIDE, food: IndexCategory.FOOD, home: IndexCategory.HOME, life: IndexCategory.LIFE };
|
||||
|
||||
export default function GakScreen() {
|
||||
const { region } = useRegion();
|
||||
const { open } = useSheet();
|
||||
const [cat, setCat] = useState<Cat>('all');
|
||||
const q = useQuery(listIndicesOptions({ query: { region: region.code, category: CAT_PARAM[cat], core: cat === 'core' ? true : undefined } }));
|
||||
const articles = useQuery(listArticlesOptions({ query: { category: ArticleCategory.GAK } }));
|
||||
const top = q.data?.top3 ?? [];
|
||||
const items = q.data?.items ?? [];
|
||||
const day = q.data?.day?.split('-').map(Number);
|
||||
const load = loadOf(q);
|
||||
const howto = articles.data?.articles?.find((a) => a.code === 'howgak');
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={q.isRefetching && !q.isPlaceholderData} onRefresh={() => q.refetch()} />}>
|
||||
<Sec title="오늘 1~3위" sub={`${day ? `${day[1]}월 ${day[2]}일 기준 · ` : ''}${region.name}`} />
|
||||
{top.length === 3 ? <Podium top={top} dim={q.isPlaceholderData} /> : load === 'loading' ? <PodiumSkel /> : <StateBox load={load} onRetry={() => q.refetch()} empty="오늘 1~3위를 아직 못 정했어요." />}
|
||||
<Chips items={CATS} value={cat} onChange={setCat} />
|
||||
{load === 'loading' ? (
|
||||
<GridSkel />
|
||||
) : !items.length ? (
|
||||
// 실패 안내·다시 시도는 위 받침대 자리에 한 번만
|
||||
<StateBox load="ready" empty={load === 'ready' ? '이 분야는 오늘 계산된 각이 없어요.' : '각 목록을 불러오지 못했어요.'} />
|
||||
) : (
|
||||
<GakGrid items={items} dim={q.isPlaceholderData} />
|
||||
)}
|
||||
{howto && load !== 'loading' && (
|
||||
<Pressable onPress={() => open({ type: 'article', articleId: howto.article_id })} className="mx-3 mt-1.5 flex-row items-center gap-3 rounded-[22px] bg-[#ece7ff] p-3.5">
|
||||
<Ic name="bulb" size={44} />
|
||||
<View className="flex-1">
|
||||
<Text className="font-jua text-[17px] text-[#28304a]">각 점수는 어떻게 매길까?</Text>
|
||||
<Text className="text-[12.5px] font-semibold text-[#5a6380]">기온·비·바람·습도·공기·시간대 6가지로 계산해요</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,45 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
import { getSeasonWeekOptions, listArticlesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { ArticleCategory } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { loadOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { RefreshControl, ScrollView, View } from 'react-native';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="계절·상식" />;
|
||||
import { ArticleRow, HeadSkel, RowsSkel, SeasonHead } from '@/components/season/parts';
|
||||
import { Chips, StateBox } from '@/components/ui';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
|
||||
const CATS = [
|
||||
['all', '전체'],
|
||||
['season', '계절 소식'],
|
||||
['tip', '날씨 상식'],
|
||||
['gak', '각 원리'],
|
||||
] as const;
|
||||
|
||||
const CAT_PARAM = { season: ArticleCategory.SEASON, tip: ArticleCategory.TIP, gak: ArticleCategory.GAK } as const;
|
||||
|
||||
export default function SeasonScreen() {
|
||||
const { open } = useSheet();
|
||||
const [cat, setCat] = useState<(typeof CATS)[number][0]>('all');
|
||||
const week = useQuery(getSeasonWeekOptions());
|
||||
const arts = useQuery(listArticlesOptions(cat === 'all' ? undefined : { query: { category: CAT_PARAM[cat] } }));
|
||||
const w = week.data;
|
||||
const list = arts.data?.articles ?? [];
|
||||
const weekLoad = loadOf(week);
|
||||
const artLoad = loadOf(arts);
|
||||
const refresh = () => Promise.all([week.refetch(), arts.refetch()]);
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={(week.isRefetching || arts.isRefetching) && !arts.isPlaceholderData} onRefresh={refresh} />}>
|
||||
{w?.headline ? <SeasonHead week={w} onPress={() => open({ type: 'seasonWeek' })} /> : weekLoad === 'loading' ? <HeadSkel /> : <StateBox load={weekLoad} onRetry={() => week.refetch()} empty="이번 주 특집이 아직 없어요." />}
|
||||
<Chips items={CATS} value={cat} onChange={setCat} />
|
||||
<View className="mt-1.5" style={{ opacity: arts.isPlaceholderData ? 0.6 : 1 }}>
|
||||
{artLoad === 'loading' && <RowsSkel />}
|
||||
{artLoad !== 'loading' && !list.length && <StateBox load={artLoad} onRetry={() => arts.refetch()} empty="읽을거리가 아직 없어요." />}
|
||||
{list.map((a) => (
|
||||
<ArticleRow key={a.article_id} article={a} onPress={() => open({ type: 'article', articleId: a.article_id })} />
|
||||
))}
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
+79
-3
@@ -1,5 +1,81 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
import { getSkyOptions, getSkyRankingOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { loadOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { RefreshControl, ScrollView, View } from 'react-native';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="노을" />;
|
||||
import { DayTiles, Li, LiSkel, ScoreHelp, SkyHero, Timeline } from '@/components/sky/parts';
|
||||
import { Sec, StateBox } from '@/components/ui';
|
||||
import { useRegion } from '@/lib/region';
|
||||
|
||||
const THREE = [0, 1, 2];
|
||||
const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i);
|
||||
|
||||
export default function SkyScreen() {
|
||||
const { region } = useRegion();
|
||||
const sky = useQuery(getSkyOptions({ query: { region: region.code } }));
|
||||
const ranking = useQuery(getSkyRankingOptions());
|
||||
const load = loadOf(sky);
|
||||
const rankLoad = loadOf(ranking);
|
||||
const plans = sky.data?.plans ?? [];
|
||||
const [picked, setPicked] = useState<string>();
|
||||
// 타일을 누르면 그날, 아니면 다음에 오는 날
|
||||
const plan = plans.find((p) => p.day === picked) ?? sky.data?.plan ?? undefined;
|
||||
const spots = (sky.data?.spots ?? []).slice(0, 3);
|
||||
const items = (ranking.data?.items ?? []).slice(0, 8);
|
||||
const rise = plan?.kind === 'sunrise';
|
||||
const refresh = () => Promise.all([sky.refetch(), ranking.refetch()]);
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={sky.isRefetching && !sky.isPlaceholderData} onRefresh={refresh} />} style={{ opacity: sky.isPlaceholderData ? 0.6 : 1 }}>
|
||||
{plan || load === 'loading' ? (
|
||||
<SkyHero plan={plan} />
|
||||
) : (
|
||||
<SkyHero>
|
||||
<StateBox load={load} onRetry={() => sky.refetch()} empty="오늘 노을 정보가 없어요." />
|
||||
</SkyHero>
|
||||
)}
|
||||
{plans.length > 1 && <DayTiles plans={plans} day={plan?.day} onPick={setPicked} />}
|
||||
{plan && <ScoreHelp plan={plan} />}
|
||||
<Sec title="언제 보면 좋을까" />
|
||||
{plan?.timeline?.length || load === 'loading' ? <Timeline rows={plan?.timeline} kind={plan?.kind} /> : <StateBox load="ready" empty={load === 'ready' ? '노을 시간 정보가 없어요.' : '노을 시간을 불러오지 못했어요.'} />}
|
||||
{!rise && <Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />}
|
||||
{rise ? null : spots.length ? (
|
||||
<View className="mx-3 mt-1.5">
|
||||
{spots.map((p, i) => (
|
||||
<Li key={p.no} no={p.no} title={p.name} sub={p.direction ? `${p.direction}쪽` : null} right={`${p.distance_km}km`} place={p.name} last={i === 2} />
|
||||
))}
|
||||
{/* 3곳이 안 되면 빈 줄로 높이를 지켜 아래 순위가 밀리지 않게 */}
|
||||
{THREE.slice(spots.length).map((i) => (
|
||||
<LiSkel key={`ghost-${i}`} ghost last={i === 2} />
|
||||
))}
|
||||
</View>
|
||||
) : load === 'loading' ? (
|
||||
<View className="mx-3 mt-1.5">
|
||||
{THREE.map((i) => (
|
||||
<LiSkel key={i} last={i === 2} />
|
||||
))}
|
||||
</View>
|
||||
) : (
|
||||
// 실패 안내·다시 시도는 위 히어로에 한 번만
|
||||
<StateBox load="ready" empty={load === 'ready' ? '근처에 등록된 노을 명소가 없어요.' : '명소 정보를 불러오지 못했어요.'} />
|
||||
)}
|
||||
<Sec title="전국 노을 순위" sub={ranking.data?.summary ?? '오늘 기준'} />
|
||||
{items.length ? (
|
||||
<View className="mx-3 mt-1.5">
|
||||
{items.map((r, i) => (
|
||||
<Li key={r.region_code} no={r.rank} title={r.name} sub={[r.note, r.situation_label].filter(Boolean).join(' · ')} right={`${r.score}점`} mine={r.region_code === region.code} last={i === items.length - 1} />
|
||||
))}
|
||||
</View>
|
||||
) : rankLoad === 'loading' ? (
|
||||
<View className="mx-3 mt-1.5">
|
||||
{RANK_SKELS.map((i) => (
|
||||
<LiSkel key={i} last={i === RANK_SKELS.length - 1} />
|
||||
))}
|
||||
</View>
|
||||
) : (
|
||||
<StateBox load={rankLoad} onRetry={() => ranking.refetch()} empty="순위가 아직 없어요." />
|
||||
)}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
+132
-3
@@ -1,5 +1,134 @@
|
||||
import { ComingSoon } from '@/components/coming-soon';
|
||||
import { getWeekOptions, getWeekRankingOptions, listEventsOptions, listPlacesOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { loadOf, shortDay } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { Pressable, RefreshControl, ScrollView, Share, Text, View } from 'react-native';
|
||||
|
||||
export default function Screen() {
|
||||
return <ComingSoon title="주말·행사" />;
|
||||
import { DayStrip, EventRow, PickCard, PlaceCard, RankRow } from '@/components/week/sections';
|
||||
import { DaysSkel, EventsSkel, PickSkel, PlacesSkel, RankSkel } from '@/components/week/skels';
|
||||
import { Chips, Rail, Sec, Skel, StateBox } from '@/components/ui';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { SITE_URL } from '@/lib/site';
|
||||
|
||||
// 불러오는 동안에도 탭 줄 높이를 지키려고 같은 칩을 미리 그린다
|
||||
const RANK_TABS_HOLD = [
|
||||
['토', '토요일'],
|
||||
['일', '일요일'],
|
||||
] as const;
|
||||
|
||||
export default function WeekScreen() {
|
||||
const { region } = useRegion();
|
||||
const week = useQuery(getWeekOptions({ query: { region: region.code } }));
|
||||
const days = week.data?.days ?? [];
|
||||
const [picked, setPicked] = useState<string | null>(null);
|
||||
// 지역을 바꾸면 동네 고르기는 전체로 돌아간다
|
||||
const [areaPick, setAreaPick] = useState({ region: region.code, area: '전체' });
|
||||
const area = areaPick.region === region.code ? areaPick.area : '전체';
|
||||
// 처음에는 이번 토요일을 고른다
|
||||
const sel = days.find((d) => d.day === picked) ?? days.find((d) => d.weekday === '토') ?? days[0];
|
||||
const places = useQuery({ ...listPlacesOptions({ query: { region: region.code, day: sel?.day, area: area === '전체' ? undefined : area } }), enabled: !!sel });
|
||||
const events = useQuery(listEventsOptions({ query: { region: region.code } }));
|
||||
const ranking = useQuery(getWeekRankingOptions());
|
||||
const rankDays = ranking.data?.days ?? [];
|
||||
const [rankPick, setRankPick] = useState<string | null>(null);
|
||||
const rankDay = rankDays.find((d) => d.day === rankPick) ?? rankDays[0];
|
||||
const rankItems = (rankDay?.items ?? []).slice(0, 10);
|
||||
const rankLoad = loadOf(ranking);
|
||||
const areas = places.data?.areas ?? [];
|
||||
const rainy = places.data?.rainy ?? sel?.is_rainy;
|
||||
const placeList = places.data?.places ?? [];
|
||||
const eventList = events.data?.events ?? [];
|
||||
const weekLoad = loadOf(week);
|
||||
const eventLoad = loadOf(events);
|
||||
// 날씨(고른 날)가 와야 명소를 부를 수 있다
|
||||
const placeLoad = sel ? loadOf(places) : weekLoad === 'loading' ? 'loading' : 'ready';
|
||||
const refresh = () => Promise.all([week.refetch(), events.refetch(), ranking.refetch(), sel ? places.refetch() : null]);
|
||||
|
||||
const sendPlan = () => {
|
||||
if (!sel) return;
|
||||
const message = [`${sel.weekday}요일 일정 · ${region.name}`, sel.headline, sel.summary, sel.pick, `날씨각 ${SITE_URL}`].filter(Boolean).join('\n');
|
||||
Share.share({ message }).catch((e: unknown) => console.warn('일정 공유 실패', e));
|
||||
};
|
||||
|
||||
const placeSub = sel ? `${sel.weekday}요일은 ${rainy ? '비가 와서 실내 명소를 먼저' : sel.icon === 'sun' ? '맑아서 야외 명소를 먼저' : '비 소식이 없어 야외 명소를 먼저'} 보여 줘요` : weekLoad === 'loading' ? undefined : '날씨에 맞춰 골라 보여 줘요';
|
||||
|
||||
return (
|
||||
<ScrollView key={region.code} contentContainerClassName="pb-6" refreshControl={<RefreshControl refreshing={week.isRefetching && !week.isPlaceholderData} onRefresh={refresh} />}>
|
||||
<Sec title="열흘 날씨" sub="날짜를 누르면 그날 추천이 바뀌어요" />
|
||||
{days.length ? (
|
||||
<DayStrip days={days} selected={sel?.day} onPick={setPicked} dim={week.isPlaceholderData} />
|
||||
) : weekLoad === 'loading' ? (
|
||||
<>
|
||||
<DaysSkel />
|
||||
<PickSkel />
|
||||
</>
|
||||
) : (
|
||||
<StateBox load={weekLoad} onRetry={() => week.refetch()} empty="날씨가 아직 없어요." />
|
||||
)}
|
||||
{sel && <PickCard day={sel} />}
|
||||
{(sel || weekLoad !== 'ready') && (
|
||||
<>
|
||||
<Text className="mx-4 mt-3.5 text-[13.5px] font-bold text-ink2">30km 안 · 데이트 명소</Text>
|
||||
<Chips items={['전체', ...areas].map((a) => [a, a] as const)} value={area} onChange={(a) => setAreaPick({ region: region.code, area: a })} disabled={!areas.length} />
|
||||
</>
|
||||
)}
|
||||
{/* 명소 데이터가 없으면 칸 전체를 숨긴다 */}
|
||||
{!(placeLoad === 'ready' && !placeList.length) && (
|
||||
<>
|
||||
<View className="-mt-2.5">
|
||||
<Sec title="날씨 맞춤 데이트 명소" sub={placeSub} />
|
||||
</View>
|
||||
{!placeSub && <Skel className="mx-4 w-56" />}
|
||||
{placeList.length ? (
|
||||
<View style={{ opacity: places.isPlaceholderData ? 0.6 : 1 }}>
|
||||
<Rail>
|
||||
{placeList.map((p, i) => (
|
||||
<PlaceCard key={p.place_id} place={p} index={i} />
|
||||
))}
|
||||
</Rail>
|
||||
</View>
|
||||
) : placeLoad === 'loading' ? (
|
||||
<PlacesSkel />
|
||||
) : (
|
||||
<StateBox load={placeLoad} onRetry={() => places.refetch()} empty={sel ? '30km 안에 데이트 명소가 아직 없어요.' : '날씨를 불러오면 명소를 골라 드려요.'} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<Sec title="이번 주말 전국 날씨 순위" sub="낮 10~17시 나들이 날씨 · 대표 지역 30곳 중 10위까지" />
|
||||
{rankDays.length ? (
|
||||
<Chips items={rankDays.map((d) => [d.day, `${d.weekday}요일 ${shortDay(d.day)}`] as const)} value={rankDay?.day ?? ''} onChange={setRankPick} />
|
||||
) : (
|
||||
<Chips items={RANK_TABS_HOLD} value="토" onChange={() => undefined} disabled />
|
||||
)}
|
||||
{rankItems.length ? (
|
||||
<View className="mx-3 mt-1.5" style={{ opacity: ranking.isPlaceholderData ? 0.6 : 1 }}>
|
||||
{rankItems.map((r) => (
|
||||
<RankRow key={r.region_code} item={r} mine={r.region_code === region.code} />
|
||||
))}
|
||||
</View>
|
||||
) : rankLoad === 'loading' ? (
|
||||
<RankSkel />
|
||||
) : (
|
||||
<StateBox load={rankLoad} onRetry={() => ranking.refetch()} empty="주말 예보가 아직 없어요." />
|
||||
)}
|
||||
<Sec title="가까운 축제·행사" sub="30km 안 · 앞으로 30일 · 그날 날씨까지 같이 봐요" />
|
||||
{eventList.length ? (
|
||||
<View style={{ opacity: events.isPlaceholderData ? 0.6 : 1 }}>
|
||||
{eventList.map((e, i) => (
|
||||
<EventRow key={e.event_id} event={e} index={i} />
|
||||
))}
|
||||
</View>
|
||||
) : eventLoad === 'loading' ? (
|
||||
<EventsSkel />
|
||||
) : (
|
||||
<StateBox load={eventLoad} onRetry={() => events.refetch()} empty="30km 안에 열리는 행사가 아직 없어요. 다른 지역을 골라 보세요." />
|
||||
)}
|
||||
{/* 행사 수가 정해진 뒤에 붙여 목록이 늘어날 때 밀리지 않게 */}
|
||||
{eventLoad !== 'loading' && (
|
||||
<Pressable onPress={sendPlan} disabled={!sel} className="mx-3 mt-4 items-center rounded-full border-b-[5px] border-orange-deep bg-orange p-[13px] disabled:opacity-60">
|
||||
<Text className="font-jua text-[17px] text-white">이번 주말 일정 보내기</Text>
|
||||
</Pressable>
|
||||
)}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user