From b5c280ca3c238f8cf4fe0e33d81bf4725b7e1fa9 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Wed, 21 Oct 2026 13:33:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9E=88=EC=96=B4=EB=A1=9C=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=ED=95=98?= =?UTF-8?q?=EB=A3=A8=20=EB=9D=A0=EB=A1=9C=20=E2=80=94=20=EC=95=84=EC=B9=A8?= =?UTF-8?q?=C2=B7=EB=82=AE=C2=B7=EC=A0=80=EB=85=81=C2=B7=EB=B0=A4=20?= =?UTF-8?q?=EB=84=A4=20=EC=A4=84(=EA=B7=B8=20=EC=8B=9C=EA=B0=84=EB=8C=80?= =?UTF-8?q?=20=ED=95=98=EB=8A=98=C2=B7=EB=82=A0=EC=94=A8=C2=B7=EA=B8=B0?= =?UTF-8?q?=EC=98=A8=C2=B7=EB=82=A0=EC=94=A8=20=EC=A0=90=EC=88=98=C2=B71?= =?UTF-8?q?=EB=93=B1=20=EA=B0=81,=20=EC=A7=80=EA=B8=88=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C),=201:1=EC=9D=80=202=C3=972=20=EC=B9=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/Sheets.tsx | 4 +- frontend/src/b/TodayPage.tsx | 45 ++++++++------- frontend/src/b/shareCards.tsx | 101 ++++++++++++++++++++------------- frontend/src/b/sheetContext.ts | 3 +- 4 files changed, 91 insertions(+), 62 deletions(-) diff --git a/frontend/src/b/Sheets.tsx b/frontend/src/b/Sheets.tsx index 81bd01c..31499ea 100644 --- a/frontend/src/b/Sheets.tsx +++ b/frontend/src/b/Sheets.tsx @@ -532,7 +532,7 @@ function ShareSheet({ share }: { share: SharePayload }) { if (images[size] || failed[size]) return let alive = true const today = new Date().toLocaleDateString('ko-KR', { month: 'long', day: 'numeric', weekday: 'long' }) - shareImage(share.slides, { size, sky: kind, sub: `${region.name} · ${today}`, host: new URL(SITE_URL).host }).then( + shareImage(size === 'square' && share.square ? share.square : share.slides, { size, sky: kind, sub: `${region.name} · ${today}`, host: new URL(SITE_URL).host }).then( (blob) => { if (!alive) return const src = URL.createObjectURL(blob) @@ -547,7 +547,7 @@ function ShareSheet({ share }: { share: SharePayload }) { return () => { alive = false } - }, [size, images, failed, share.slides, kind, region.name]) + }, [size, images, failed, share.slides, share.square, kind, region.name]) useEffect(() => { const list = srcs.current diff --git a/frontend/src/b/TodayPage.tsx b/frontend/src/b/TodayPage.tsx index 8e1f33c..802718e 100644 --- a/frontend/src/b/TodayPage.tsx +++ b/frontend/src/b/TodayPage.tsx @@ -15,7 +15,7 @@ import { useFeedTalks } from './talkState' import { useRegion } from './regionContext' import { useSheet } from './sheetContext' import { useSky } from './skyContext' -import { GakShareCard, HeroShareCard, type HeroShare } from './shareCards' +import { DayShareCard, DayShareGrid, GakShareCard, type DayShare } from './shareCards' import { SendIcon } from './svg' import { Ic, Rail, Sec, Skel, StateBox, TAP44, Thumb } from './ui' import { deg, slotAt } from './weatherText' @@ -86,7 +86,7 @@ function atSlot(items: TopIndex[], kind: TimeKind | null): TopIndex[] { ] } -type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; feedLoad: Load; todayLoad: Load } +type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; all: TopIndex[]; feedLoad: Load; todayLoad: Load } type Weather = 'clear' | 'partly' | 'cloudy' | 'rain' | 'snow' | 'sleet' @@ -108,11 +108,13 @@ const CLOUDS = [ ] const CLOUD_N: Record = { clear: 0, partly: 2, cloudy: 3, rain: 3, snow: 3, sleet: 3 } -function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) { +function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) { const { open } = useSheet() const { region } = useRegion() const tplRef = useRef(null) - const share = () => tplRef.current && open({ type: 'share', share: { title: `${region.name} 오늘 날씨`, slides: [tplRef.current] } }) + const gridRef = useRef(null) + const share = () => + tplRef.current && open({ type: 'share', share: { title: `${region.name} 오늘 날씨`, slides: [tplRef.current], square: gridRef.current ? [gridRef.current] : undefined } }) const { preview, setServerKind, setPreview } = useSky() const mode: Mode = preview ?? 'now' const clock = useNow() @@ -148,26 +150,27 @@ function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) { const rain = weather === 'rain' || weather === 'sleet' const snow = weather === 'snow' || weather === 'sleet' - const shareData: HeroShare = { - kind, - sky: weather, - date: `${t.mo}월 ${t.d}일 ${WEEKDAYS[t.wd]}요일`, - place: region.name, - label: `${slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`, - score, - bubble, - summary: top1?.summary, - status: status.map((x) => ({ label: x.label, value: x.value, warn: x.tone === 'warn' })), - slots: KINDS.map((k) => { - const s = slotOf(k === nowKind ? 'now' : k) - return { label: k === nowKind ? '지금' : PREVIEW[k].label, icon: k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)], temp: s?.temp_c != null ? deg(s.temp_c) : '–', on: k === kind } - }), - } + // 공유 이미지: 아침~밤 네 시간대 모두. 점수는 시간대 점수, 각은 그 시간대 1등 + const days: DayShare[] = KINDS.map((k) => { + const isNow = k === nowKind + const s = slotOf(isNow ? 'now' : k) + const top = atSlot(all, k).find((g) => g.active) + return { + kind: k, + label: PREVIEW[k].label, + now: isNow, + icon: k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)], + temp: s?.temp_c != null ? deg(s.temp_c) : '–', + score: hero?.weather_slots?.[SLOT_KEY[k]] ?? (isNow ? hero?.weather_score : null), + gak: top ? { name: top.name, icon: top.icon } : null, + } + }) // 시안 D4-2: 가운데 해(점수)와 하늘 날씨, 결론 두 줄, 상태 한 줄, 아래 하루 흐름 칸(누르면 그 시간대 하늘로) return (
- + +