From eb84a72c2fbfe34b545e0601a96730a7367668bd Mon Sep 17 00:00:00 2001
From: Mina Choi
Date: Fri, 23 Oct 2026 11:14:56 +0900
Subject: [PATCH] =?UTF-8?q?feat:=20=EB=82=A0=EC=94=A8=20=EC=A0=90=EC=88=98?=
=?UTF-8?q?=20=EA=B7=BC=EA=B1=B0=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EA=B5=AC?=
=?UTF-8?q?=EB=A6=84=EC=97=90=20=EA=B0=80=EB=A6=AC=EB=8D=98=20=ED=95=B4=20?=
=?UTF-8?q?=EA=B5=AC=EC=84=9D=20'=3F'=EC=97=90=EC=84=9C=20=EC=83=81?=
=?UTF-8?q?=ED=83=9C=20=EC=A4=84=20=EB=81=9D=20'=EC=A0=90=EC=88=98=20?=
=?UTF-8?q?=EA=B7=BC=EA=B1=B0=20=E2=80=BA'=EB=A1=9C(=ED=95=B4=EB=A5=BC=20?=
=?UTF-8?q?=EB=88=8C=EB=9F=AC=EB=8F=84=20=EC=97=B4=EB=A6=BC),=20=EA=B7=BC?=
=?UTF-8?q?=EA=B1=B0=20=EC=B0=BD=EC=97=90=20=EC=A7=80=EA=B8=88=20=EC=83=81?=
=?UTF-8?q?=ED=83=9C(=EC=8A=B5=EB=8F=84=C2=B7=EB=B6=88=EC=BE=8C=EC=A7=80?=
=?UTF-8?q?=EC=88=98=C2=B7=EC=9E=90=EC=99=B8=EC=84=A0=C2=B7=EB=AF=B8?=
=?UTF-8?q?=EC=84=B8=EB=A8=BC=EC=A7=80)=20=EC=8B=A4=EC=A0=9C=20=EA=B0=92?=
=?UTF-8?q?=EA=B3=BC=20=EA=B8=B0=EC=A4=80=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/router/v1/feed/protocol.py | 1 +
backend/services/feed_service.py | 3 +-
backend/services/hero_stats.py | 12 ++++---
frontend/src/api/client/types.gen.ts | 6 ++++
frontend/src/b/TodayPage.tsx | 52 +++++++++++++++-------------
frontend/src/b/weatherWhy.tsx | 36 ++++++++++++++++++-
6 files changed, 80 insertions(+), 30 deletions(-)
diff --git a/backend/router/v1/feed/protocol.py b/backend/router/v1/feed/protocol.py
index add81af..00665a9 100644
--- a/backend/router/v1/feed/protocol.py
+++ b/backend/router/v1/feed/protocol.py
@@ -162,6 +162,7 @@ class HeroStat(WebPacketProtocol):
label: str
value: str
tone: Literal["normal", "warn", "rain"] = Field(description="normal=기본, warn=조심(노랑), rain=비(파랑)")
+ detail: Optional[str] = Field(default=None, description="단계 이름 밑의 실제 값 (예: 68%, 72, 2, 초미세먼지 15㎍/㎥). 상태 줄에만")
class WeatherWhy(WebPacketProtocol):
diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py
index ae3f7b2..1334070 100644
--- a/backend/services/feed_service.py
+++ b/backend/services/feed_service.py
@@ -148,6 +148,7 @@ def _hero_input(
now=now, night=slot in ("evening", "night"), after_dark=slot == "night", rain_at=rainy[0].at if rainy else None,
rain_later_at=later, today_known=bool(ahead),
air=AirGrade(now_w.air.grade) if now_w and now_w.air and now_w.air.grade is not None else None, uv=uv,
+ pm25=now_w.air.pm25 if now_w and now_w.air else None, pm10=now_w.air.pm10 if now_w and now_w.air else None,
temp_min=min(temps, default=None), temp_max=max(temps, default=None),
temp=float(cur.temp_c) if cur else None, feels=float(cur.feels_c) if cur else None,
moon=moon, humidity=cur.humidity if cur else None, discomfort=cur.discomfort_index if cur else None,
@@ -475,7 +476,7 @@ class FeedService:
top1=_top(top) if top else None, bubble=bubble,
moon_name=moon[0].name if moon else None, moon_pct=round(moon[0].lit * 100) if moon else None,
stats=[HeroStat(icon=x.icon, label=x.label, value=x.value, tone=x.tone) for x in hero_stats(x_in)],
- status=[HeroStat(icon=x.icon, label=x.label, value=x.value, tone=x.tone) for x in hero_status(x_in)],
+ status=[HeroStat(icon=x.icon, label=x.label, value=x.value, tone=x.tone, detail=x.detail) for x in hero_status(x_in)],
tomorrow=_hero_tomorrow(now.date() + timedelta(days=1), board) if board else None,
)
diff --git a/backend/services/hero_stats.py b/backend/services/hero_stats.py
index b83adcd..8285c65 100644
--- a/backend/services/hero_stats.py
+++ b/backend/services/hero_stats.py
@@ -24,6 +24,7 @@ class HeroStatItem:
label: str
value: str
tone: Tone = "normal"
+ detail: Optional[str] = None # 단계 이름 밑의 실제 값 (예: 68%, 72, 2, 초미세먼지 15㎍/㎥)
@dataclass(frozen=True)
@@ -34,6 +35,8 @@ class HeroInput:
rain_later_at: Optional[datetime] = None # 그 뒤 오늘 안에 비 오는 첫 시각 (단기예보)
today_known: bool = False # 오늘 남은 시간 예보가 있어 '오늘 비 안 와요'라고 말할 수 있는지
air: Optional[AirGrade] = None
+ pm25: Optional[int] = None
+ pm10: Optional[int] = None
uv: Optional[float] = None
temp_min: Optional[float] = None
temp_max: Optional[float] = None
@@ -69,13 +72,14 @@ def hero_status(x: HeroInput) -> list[HeroStatItem]:
"""히어로 상태 한 줄: 습도·불쾌지수(늘)·자외선(해 있을 때, 저녁 포함)·미세먼지를 단계 이름으로. 값이 없는 칸은 뺀다. 조심할 것만 warn."""
out: list[HeroStatItem] = []
if x.humidity is not None:
- out.append(HeroStatItem("humidity", "muggy", "습도", humidity_label(x.humidity)))
+ out.append(HeroStatItem("humidity", "muggy", "습도", humidity_label(x.humidity), detail=f"{x.humidity}%"))
if x.discomfort is not None:
- out.append(HeroStatItem("discomfort", "muggy", "불쾌지수", discomfort_label(x.discomfort), "warn" if x.discomfort >= MUGGY_DI else "normal"))
+ out.append(HeroStatItem("discomfort", "muggy", "불쾌지수", discomfort_label(x.discomfort), "warn" if x.discomfort >= MUGGY_DI else "normal", detail=str(x.discomfort)))
if not x.after_dark and x.uv is not None:
- out.append(HeroStatItem("uv", "glasses", "자외선", uv_label(x.uv), "warn" if x.uv >= UV_HIGH else "normal"))
+ out.append(HeroStatItem("uv", "glasses", "자외선", uv_label(x.uv), "warn" if x.uv >= UV_HIGH else "normal", detail=f"{x.uv:g}"))
if x.air is not None:
- out.append(HeroStatItem("air", "mask", "미세먼지", GRADE_LABEL[x.air], "warn" if x.air in (AirGrade.BAD, AirGrade.VERY_BAD) else "normal"))
+ pm = " · ".join(s for s in (f"초미세먼지 {x.pm25}㎍/㎥" if x.pm25 is not None else "", f"미세먼지 {x.pm10}㎍/㎥" if x.pm10 is not None else "") if s) or None
+ out.append(HeroStatItem("air", "mask", "미세먼지", GRADE_LABEL[x.air], "warn" if x.air in (AirGrade.BAD, AirGrade.VERY_BAD) else "normal", detail=pm))
return out
diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts
index a42d0c5..8699d3b 100644
--- a/frontend/src/api/client/types.gen.ts
+++ b/frontend/src/api/client/types.gen.ts
@@ -687,6 +687,12 @@ export type HeroStat = {
* normal=기본, warn=조심(노랑), rain=비(파랑)
*/
tone: 'normal' | 'warn' | 'rain';
+ /**
+ * Detail
+ *
+ * 단계 이름 밑의 실제 값 (예: 68%, 72, 2, 초미세먼지 15㎍/㎥). 상태 줄에만
+ */
+ detail?: string | null;
};
/**
diff --git a/frontend/src/b/TodayPage.tsx b/frontend/src/b/TodayPage.tsx
index f1a76b5..d339daf 100644
--- a/frontend/src/b/TodayPage.tsx
+++ b/frontend/src/b/TodayPage.tsx
@@ -373,30 +373,29 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
)}
-
-
- {failed(feedLoad) ? '점수를 못 불러왔어요' : `${tmr && mode !== 'now' ? `내일 ${PREVIEW[mode].label}` : slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}
-
- {heroVal(feedLoad, score, 'w-[84px]')}
-
- {why && score != null && (
-
- )}
+ {/* 점수 근거가 있으면 해를 눌러도 근거 창: 구석 버튼은 구름에 가려져서 상태 줄 끝으로 옮김 */}
+ {(() => {
+ const body = (
+ <>
+
+ {failed(feedLoad) ? '점수를 못 불러왔어요' : `${tmr && mode !== 'now' ? `내일 ${PREVIEW[mode].label}` : slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}
+
+ {heroVal(feedLoad, score, 'w-[84px]')}
+ >
+ )
+ const cls = cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')
+ if (!why || score == null) return {body}
+ return (
+
+ )
+ })()}
@@ -429,6 +428,11 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
))}
+ {why && score != null && (
+
+ )}
)}
diff --git a/frontend/src/b/weatherWhy.tsx b/frontend/src/b/weatherWhy.tsx
index d50e0ef..1a8ea17 100644
--- a/frontend/src/b/weatherWhy.tsx
+++ b/frontend/src/b/weatherWhy.tsx
@@ -1,6 +1,8 @@
import type { WeatherWhy } from '../api/client/types.gen'
+import { cx } from '../lib/utils'
-export type WeatherWhyPayload = { label: string; score: number; why: WeatherWhy[] }
+/** status: 히어로 상태 줄 그대로 (단계 이름, 실제 값) */
+export type WeatherWhyPayload = { label: string; score: number; why: WeatherWhy[]; status?: { label: string; value: string; tone?: string; detail?: string | null }[] }
// 조건마다 같은 색을 막대 칸과 아래 줄 점에 같이 써서 이어 보이게
const COLOR: Record = {
@@ -13,6 +15,14 @@ const COLOR: Record = {
}
const colorOf = (label: string) => COLOR[label] ?? '#9aa3b8'
+// 상태 줄 항목마다 단계를 나누는 기준 (backend/services/hero_stats.py 와 같은 값)
+const RULE: Record = {
+ 습도: '30% 아래는 건조, 60% 넘으면 습함이에요',
+ 불쾌지수: '68 아래는 쾌적, 75부터 불쾌예요',
+ 자외선: '3 아래는 낮음, 6부터 높음이에요',
+ 미세먼지: '에어코리아 기준 등급이에요',
+}
+
/** 날씨 점수 근거: 비중만큼 나눈 막대(채운 만큼 얻은 점수)와 조건별 지금 값 */
export function WeatherWhySheet({ d }: { d: WeatherWhyPayload }) {
return (
@@ -46,6 +56,30 @@ export function WeatherWhySheet({ d }: { d: WeatherWhyPayload }) {
))}
+ {d.status && d.status.length > 0 && (
+ <>
+ 지금 상태
+
+ {d.status.map((s) => (
+ -
+
+ {s.label}
+ {RULE[s.label] && {RULE[s.label]}}
+
+
+ {s.value}
+ {s.detail?.split(' · ').map((x) => (
+
+ {x}
+
+ ))}
+
+
+ ))}
+
+ >
+ )}
+
조건마다 점수를 매겨 비중대로 합쳐요. 유난히 아쉬운 조건이 있으면 조금 더 깎고, 모든 조건이 완벽할 때만 만점이 나와요.