feat: 앱 위치로 지역 찾기(expo-location), 게시물·주말 일정 이미지 공유(view-shot·expo-sharing)
This commit is contained in:
1 parent
f71dd2cebb
commit
26bb6a00d2
10 files changed
+231
-31
No files matched your search
+11
-4
@@ -1,13 +1,14 @@
|
||||
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';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
|
||||
|
||||
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 { shareView } from '@/lib/share-image';
|
||||
import { SITE_URL } from '@/lib/site';
|
||||
|
||||
// 불러오는 동안에도 탭 줄 높이를 지키려고 같은 칩을 미리 그린다
|
||||
@@ -44,10 +45,12 @@ export default function WeekScreen() {
|
||||
const placeLoad = sel ? loadOf(places) : weekLoad === 'loading' ? 'loading' : 'ready';
|
||||
const refresh = () => Promise.all([week.refetch(), events.refetch(), ranking.refetch(), sel ? places.refetch() : null]);
|
||||
|
||||
const pickShot = useRef<View>(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));
|
||||
void shareView(pickShot, { title: `${sel.weekday}요일 일정`, message });
|
||||
};
|
||||
|
||||
const placeSub = sel ? `${sel.weekday}요일은 ${rainy ? '비가 와서 실내 명소를 먼저' : sel.icon === 'sun' ? '맑아서 야외 명소를 먼저' : '비 소식이 없어 야외 명소를 먼저'} 보여 줘요` : weekLoad === 'loading' ? undefined : '날씨에 맞춰 골라 보여 줘요';
|
||||
@@ -65,7 +68,11 @@ export default function WeekScreen() {
|
||||
) : (
|
||||
<StateBox load={weekLoad} onRetry={() => week.refetch()} empty="날씨가 아직 없어요." />
|
||||
)}
|
||||
{sel && <PickCard day={sel} />}
|
||||
{sel && (
|
||||
<View ref={pickShot} collapsable={false}>
|
||||
<PickCard day={sel} />
|
||||
</View>
|
||||
)}
|
||||
{(sel || weekLoad !== 'ready') && (
|
||||
<>
|
||||
<Text className="mx-4 mt-3.5 text-[13.5px] font-bold text-ink2">30km 안 · 데이트 명소</Text>
|
||||
|
||||
Reference in new issue
Block a user