feat: 노을 탭 시안 A — 히어로에 결론·가장 붉을 때·쉬운 이유, 내일 안내 위로, 숫자는 자세히로, 시간표에 가장 붉을 때

This commit is contained in:
minaChoi committed 2026-10-12 10:04:03 +09:00
1 parent 8422829f9d
commit c30fac20a6
7 files changed
+69 -45

No files matched your search

+1 -1
View File
@@ -151,4 +151,4 @@
| [ ] | `docs/콘텐츠_구현기획.md` 2-1의 오늘 날씨 점수 식이 예전 기준(기온 40·비 30·바람 15·미세먼지 15) — 새 기준은 `docs/점수_계산식.md` | 점수 계산식 정리 중 발견 (10/8) | `docs/콘텐츠_구현기획.md` |
| [ ] | **[결정 필요]** 각 순위가 점수 순이 아니라 보임 — 순위가 점수 × 중요도라 환기각 92점(하)이 5위, 골프각 89점이 3위, 빨래각 83점이 2위. 각 탭 받침대·스토리에서 높은 점수가 뒤에 있어 어색함. 점수를 순위대로 보여줄지, 중요도 가중을 줄일지 | 화면 직접 확인 중 발견 (10/12) | `backend/services/calc/index_calc.py` (`PRIORITY_WEIGHT`), `frontend/src/b/GakPage.tsx` |
| [x] | 노을 점수 29점(잿빛)인데 결론 '나가 볼 만해요' — 결론이 구름 분포만 보고 공기 보정(가시거리·습도)을 안 봤음 → 공기 보정 0.7배 미만이면 결론 한 단계 낮추고 이유에 공기 표시, '해 질 무렵(N시) 예보 기준' 표시. 운영 DB에 `sky_score.air` 칸 추가 필요(배포 때 `init.sql`의 ALTER) | 사용자 지적 (10/12, 분당구) | `backend/services/sky_service.py` (`day_verdict`, `build_plan`), `backend/services/calc/sky_score.py` (`air_note`) |
| [ ] | 노을 탭 다시 짜기 — 처음 보면 '그래서 가?'에서 멈춤: 히어로 18:00이 무슨 시각인지 없음, 결론 카드가 좋은 말·나쁜 말을 섞음, 구름 %·예보 모델 수 같은 전문 용어, '가장 붉을 때'가 시간표에 없음, '내일이 더 나아요'가 맨 아래. 시안 먼저 보고 결정 | 사용자 지적 (10/12) | `frontend/src/b/SkyPage.tsx`, `backend/services/calc/sky_score.py` (`reason`) |
| [x] | 노을 탭 다시 짜기 → 시안 A(사용자 선택): 히어로 '오늘은 애매해요 / 18:10쯤 가장 붉어요 / 쉬운 이유', 내일 안내 바로 아래, 숫자는 '자세히', 시간표에 가장 붉을 때 — 처음 보면 '그래서 가?'에서 멈춤: 히어로 18:00이 무슨 시각인지 없음, 결론 카드가 좋은 말·나쁜 말을 섞음, 구름 %·예보 모델 수 같은 전문 용어, '가장 붉을 때'가 시간표에 없음, '내일이 더 나아요'가 맨 아래. 시안 먼저 보고 결정 | 사용자 지적 (10/12) | `frontend/src/b/SkyPage.tsx`, `backend/services/calc/sky_score.py` (`reason`) |
+21 -4
View File
@@ -70,6 +70,23 @@ def air_note(air: Optional[dict]) -> Optional[str]:
return "공기가 뿌예 색이 흐려요" + (f" ({'·'.join(parts)})" if parts else "")
def plain_line(situation: SkySituation | None, air: Optional[dict], kind: SkyType = SkyType.SUNSET) -> Optional[str]:
"""히어로에 쓸 쉬운 말 한 줄. 공기가 크게 깎였으면 그것까지."""
side = "해 뜨는 쪽" if kind is SkyType.SUNRISE else "해 지는 쪽"
base = {
SkySituation.COVERED: f"{side}이 구름에 막혀 붉은빛이 안 들어와요",
SkySituation.LOW_CLOUD: "낮은 구름이 하늘을 덮어 색이 안 보여요",
SkySituation.FEW: "구름이 거의 없어 짧고 은은하게 끝나요",
SkySituation.THICK: "구름이 두꺼워 색이 약해요",
SkySituation.GLOW: "구름이 알맞게 깔려 하늘이 넓게 물들어요",
}.get(situation) if situation else None
if air_note(air) is None:
return base
if situation is SkySituation.GLOW:
return "구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요"
return f"{base}. 공기도 뿌예요" if base else "공기가 뿌예서 색이 흐릴 거예요"
def grade(value: int) -> SkyGrade:
if value >= 80:
return SkyGrade.RED
@@ -164,10 +181,10 @@ def reason(near20: Layers, far100: Layers, kind: SkyType = SkyType.SUNSET) -> st
return f"물들 중·높은 구름이 {canvas}%로 {'적은' if canvas < 25 else '많은'} 편이에요"
def sunrise_timeline(blue_at: datetime, sun_at: datetime, golden_end_at: datetime) -> list[dict]:
"""해 뜨기 전 블루아워 → 해 뜸 → 골든아워 끝. 분 아래는 버린다."""
rows = [("blue", "블루아워", blue_at), ("sun", "해 떠요", sun_at), ("golden", "골든아워", golden_end_at)]
return [{"at": at.replace(second=0, microsecond=0).isoformat(), "kind": kind, "label": label} for kind, label, at in rows]
def sunrise_timeline(blue_at: datetime, peak_at: datetime | None, sun_at: datetime, golden_end_at: datetime) -> list[dict]:
"""해 뜨기 전 블루아워 → 가장 붉을 때 → 해 뜸 → 골든아워 끝. 분 아래는 버린다."""
rows = [("blue", "블루아워", blue_at), ("peak", "가장 붉을 때", peak_at), ("sun", "해 떠요", sun_at), ("golden", "골든아워", golden_end_at)]
return [{"at": at.replace(second=0, microsecond=0).isoformat(), "kind": kind, "label": label} for kind, label, at in rows if at is not None]
def sunset_timeline(golden_at: datetime, sun_at: datetime, peak_at: datetime | None, blue_at: datetime) -> list[dict]:
+4 -6
View File
@@ -21,7 +21,7 @@ from crud.region_crud import RegionCRUD
from crud.sky_crud import SkyCRUD
from services.calc.sky_score import (
DISTANCES_KM, GRADE_LABEL, RAIN_BEFORE_HOURS, SITUATION_LINE, SITUATION_VERDICT, VERDICT_LINE, VERDICT_RANK, Air, Layers, air_factor, best_times,
air_note, confidence, grade, mean_layers, reason, score, situation, sunrise_timeline, sunset_timeline, verdict,
air_note, confidence, grade, mean_layers, plain_line, reason, score, situation, sunrise_timeline, sunset_timeline, verdict,
)
from services.calc.sun import SunTimes, sun_times
from services.external.open_meteo import OpenMeteoRequestFailed, fetch_clouds, parse_clouds
@@ -137,14 +137,12 @@ def build_plan(
kind=kind, target=target, day=target.score_date, when=when, verdict=v, headline=VERDICT_LINE[v],
reason=", ".join(filter(None, [reason(*layers, kind) if layers else _FALLBACK_REASON[v], air_note(target.air)])),
score=target.score, grade_label=GRADE_LABEL[SkyGrade(target.grade)],
situation_label=(
"공기가 뿌예 색이 흐려요" if air_note(target.air) else SITUATION_LINE[SkySituation(target.situation)] if target.situation else None
),
situation_label=plain_line(SkySituation(target.situation) if target.situation else None, target.air, kind),
models_total=target.models_total, models_agree=target.models_agree,
best_at=peak_at, spot=spots[0] if spots and v != "rest" and not rise else None,
timeline=(
sunrise_timeline(st.dawn_start_at.astimezone(KST), st.sunrise_at.astimezone(KST), st.golden_end_at.astimezone(KST)) if rise
else sunset_timeline(st.golden_start_at.astimezone(KST), st.sunset_at.astimezone(KST), None, st.dusk_end_at.astimezone(KST))
sunrise_timeline(st.dawn_start_at.astimezone(KST), peak_at, st.sunrise_at.astimezone(KST), st.golden_end_at.astimezone(KST)) if rise
else sunset_timeline(st.golden_start_at.astimezone(KST), st.sunset_at.astimezone(KST), peak_at, st.dusk_end_at.astimezone(KST))
),
outlook=outlook(target, days, today),
)
+2 -2
View File
@@ -54,8 +54,8 @@ async def test_sky_view_scores_three_days_with_spots(monkeypatch, clean):
assert plan["verdict"] == "go" and plan["headline"] == "나가 볼 만해요" and plan["when"] in ("오늘", "내일")
assert "알맞게" in plan["reason"]
assert plan["spot"]["name"] == "망원한강공원" and plan["best_at"]
assert [t["kind"] for t in plan["timeline"]] == ["golden", "sun", "blue"]
assert plan["situation_label"] == "하늘이 넓게 물들 수 있어요" and plan["models_agree"] == plan["models_total"] == 2
assert [t["kind"] for t in plan["timeline"]] == ["golden", "sun", "peak", "blue"]
assert plan["situation_label"] == "구름이 알맞게 깔려 하늘이 넓게 물들어요" and plan["models_agree"] == plan["models_total"] == 2
assert plan["outlook"] == ""
assert body["sunset"]["verdict"] == "go" and body["spots"][0]["direction"]
+11 -2
View File
@@ -124,8 +124,8 @@ def test_sunrise_reason_and_timeline():
assert "해 뜨는 쪽" in reason(Layers(0, 0, 0), Layers(90, 50, 0), SkyType.SUNRISE)
sun = sun_times(date(2026, 10, 8), 37.5, 127.0)
rows = sunrise_timeline(sun.dawn_start_at, sun.sunrise_at, sun.golden_end_at)
assert [r["kind"] for r in rows] == ["blue", "sun", "golden"]
rows = sunrise_timeline(sun.dawn_start_at, sun.sunrise_at - timedelta(minutes=12), sun.sunrise_at, sun.golden_end_at)
assert [r["kind"] for r in rows] == ["blue", "peak", "sun", "golden"]
assert sun.dawn_start_at < sun.sunrise_at < sun.golden_end_at
@@ -142,3 +142,12 @@ def test_hazy_air_lowers_verdict_and_says_why():
assert day_verdict(glow) == "maybe"
assert day_verdict(SimpleNamespace(situation=SkySituation.GLOW.value, score=60, air=None)) == "go"
assert day_verdict(SimpleNamespace(situation=SkySituation.COVERED.value, score=10, air=hazy)) == "rest"
def test_plain_line_says_it_simply():
from services.calc.sky_score import plain_line
hazy = {"factor": 0.5, "visibility_km": 6.5, "humidity": 80}
assert plain_line(SkySituation.GLOW, None) == "구름이 알맞게 깔려 하늘이 넓게 물들어요"
assert plain_line(SkySituation.GLOW, hazy) == "구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요"
assert plain_line(SkySituation.FEW, hazy) == "구름이 거의 없어 짧고 은은하게 끝나요. 공기도 뿌예요"
+2 -2
View File
@@ -134,7 +134,7 @@
| 하늘이 넓게 물들 수 있어요 | 그 밖 (25~75) | 나가 볼 만해요 |
- **무엇을 보여 주나**: 다음에 오는 것. 오늘 해 뜨기 전엔 오늘 일출, 그 뒤 블루아워가 끝나기 전엔 오늘 노을, 그 뒤엔 내일 일출. 피드 노을 카드도 같습니다. 일출도 같은 식으로 계산합니다(구름은 해 뜨는 쪽).
- 노을 탭 히어로는 점수를 크게 보여 주고, 그 아래에 해 지는(뜨는) 시각과 하늘 상황을 씁니다.
- 노을 탭 히어로는 답만 보여 줍니다: '오늘은 애매해요'(결론), '18:10쯤 가장 붉어요', 쉬운 말 이유 한 줄(예: 구름은 좋은데 공기가 뿌예서 색이 흐릴 거예요). 더 나은 날이 있으면 바로 아래, 점수·구름·예보 모델 수는 '자세히'에 접어 둡니다.
- 점수는 **지금 하늘이 아니라 해 질(뜰) 무렵 예보**로 낸 값입니다. 노을 탭에 "해 질 무렵(18시) 예보 기준"으로 적습니다.
- 화면 결론(나가 볼 만해요·애매해요·쉬어요)은 **하늘 상황 기준**이고, **공기 보정이 0.7배 미만이면 한 단계 낮춥니다.** 이때 이유에 "공기가 뿌예 색이 흐려요 (가시거리 N km·습도 N%)"를 붙이고, 히어로·피드 카드의 상황 줄도 이 말로 바꿉니다. 예) 분당구 10/12: 구름 57점 × 공기 0.50(가시거리 6.5km 0.62 · 습도 80% 0.81) = 29점 잿빛 → '하늘이 넓게 물들 수 있어요'였던 결론이 '애매해요'로. 상황이 없을 때만 점수로 정합니다(60↑ 나가 볼 만해요, 40↑ 애매해요).
- 확신도: 모델별 점수의 표준편차가 8 미만이면 높음, 15 미만이면 보통, 그 이상이거나 모델이 1개면 낮음.
@@ -149,7 +149,7 @@
| 가장 붉을 때 | 일몰 + 10분 + (20km 상층 구름 % ÷ 10)분. 상층 구름이 많을수록 늦게까지 물듦 |
| 블루아워 | 해가 진 뒤 해 고도 **−6°**(시민박명 끝)가 되는 때. 해는 졌지만 하늘이 푸르게 남는 시간 |
일출 시간표는 블루아워(해 뜨기 전 해 고도 −6°) → 해 떠요 → 골든아워(해 고도 6°까지 올라오는 때)입니다. '가장 붉을 때'는 해 뜨기 10분 + (상층 구름 % ÷ 10)분 전입니다.
노을 시간표는 골든아워 → 해 져요 → 가장 붉을 때 → 블루아워, 일출 시간표는 블루아워(해 뜨기 전 해 고도 −6°) → 가장 붉을 때 → 해 떠요 → 골든아워(해 고도 6°까지 올라오는 때)입니다. 해 짐·뜸은 해 고도 −0.833°, 모두 구 중심 좌표와 날짜로 계산(NOAA 근사식)합니다. '가장 붉을 때'는 해 뜨기 10분 + (상층 구름 % ÷ 10)분 전입니다.
## 8. 달 모양·잘 보이는지
+28 -28
View File
@@ -33,35 +33,35 @@ const HERO = 'relative mx-3 mt-1 min-h-[230px] overflow-hidden rounded-[32px] px
const THREE = [0, 1, 2]
const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i)
/** 히어로엔 해 지는(뜨는) 시각과 하늘 상황 한 줄만. 결론·이유·점수는 아래 카드로 */
function HeroBody({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
/** '오늘은' · '모레는' */
const topic = (w: string) => `${w}${(w.charCodeAt(w.length - 1) - 0xac00) % 28 ? '은' : '는'}`
/** 히어로엔 답만: 갈 만한지, 몇 시에, 왜(쉬운 말 한 줄). 숫자는 아래 '자세히'로 */
function HeroBody({ plan }: { plan?: SkyPlanData }) {
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
return (
<div className="relative z-[1] [text-shadow:0_2px_10px_rgb(50_25_70/0.35)]" aria-hidden={plan ? undefined : true}>
<p className="m-0 mt-2.5 font-bagel text-[52px] leading-none">{v(sunAt && clockShort(sunAt), 'w-[150px]')}</p>
<p className="m-0 mt-1.5 font-jua text-[21px]">{v(plan?.situation_label ?? plan?.headline, 'w-[190px]')}</p>
<p className="m-0 mt-2.5 font-jua text-[34px] leading-tight">{v(plan && `${topic(plan.when)} ${plan.headline}`, 'w-[200px]')}</p>
<p className="m-0 mt-1 font-jua text-[21px]">{v(plan?.best_at && `${clockShort(plan.best_at)}쯤 가장 붉어요`, 'w-[170px]')}</p>
<p className="m-0 mt-1.5 text-[14px] font-bold opacity-95">{v(plan?.situation_label, 'w-[230px]')}</p>
</div>
)
}
/** 결론과 이유, 예보 모델이 얼마나 같은 예보를 냈는지, 점수(작게) */
function Verdict({ plan, sunAt }: { plan?: SkyPlanData; sunAt?: string }) {
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
/** 점수·구름·예보 모델처럼 궁금한 사람만 볼 숫자 */
function Details({ plan, sunAt }: { plan: SkyPlanData; sunAt?: string }) {
// 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 걸 밝힌다
const basis = sunAt ? `해 ${plan?.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 예보 기준` : ''
const agree = [
basis,
plan ? `${plan.kind === 'sunrise' ? '일출' : '노을'} 점수 ${plan.score}` : '',
plan?.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : '',
].filter(Boolean).join(' · ')
const basis = sunAt ? `해 ${plan.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 예보 기준` : ''
return (
<div className="mx-3 mt-3 rounded-[22px] bg-white px-4 py-3 text-[14px] font-semibold shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={plan ? undefined : true}>
<p className="m-0">
<b className="mr-1.5 font-jua text-[17px] font-normal">{v(plan?.headline, 'w-20')}</b>
{v(plan?.reason, 'w-[220px]')}
<details className="mx-3 mt-2 rounded-[18px] bg-white/70 px-4 py-2.5 text-[13px] font-semibold text-(--ink2)">
<summary className="cursor-pointer font-extrabold">자세히</summary>
<p className="m-0 mt-1.5 text-(--ink)">{plan.reason}</p>
<p className="m-0 mt-1">
{[basis, `${plan.kind === 'sunrise' ? '일출' : '노을'} 점수 ${plan.score} (${plan.grade_label})`, plan.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : '']
.filter(Boolean)
.join(' · ')}
</p>
<small className="mt-1 block text-[12px] font-bold text-(--ink2)">{v(plan && (agree || '\u00a0'), 'w-48')}</small>
</div>
</details>
)
}
@@ -76,16 +76,16 @@ const TERMS = {
},
} as const
/** 노을: 골든아워 → 해 짐 → 블루아워. 일출: 블루아워 → 해 뜸 → 골든아워 */
/** 노을: 골든아워 → 해 짐 → 가장 붉을 때 → 블루아워. 일출: 블루아워 → 가장 붉을 때 → 해 뜸 → 골든아워 */
function Timeline({ rows, kind = 'sunset' }: { rows?: BestTime[]; kind?: SkyPlanData['kind'] }) {
return (
<div className="mx-3 mt-3 rounded-[22px] bg-white px-2 pt-4 pb-3 shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={rows ? undefined : true}>
<ol className="relative grid grid-cols-3">
<span className="absolute inset-x-[16.6%] top-[6px] h-0.5 bg-(--line)" aria-hidden="true" />
<ol className={cx('relative grid', (rows?.length ?? 3) === 4 ? 'grid-cols-4' : 'grid-cols-3')}>
<span className={cx('absolute top-[6px] h-0.5 bg-(--line)', (rows?.length ?? 3) === 4 ? 'inset-x-[12.5%]' : 'inset-x-[16.6%]')} aria-hidden="true" />
{(rows ?? THREE.map(() => undefined)).map((t, i) => (
<li key={t?.kind ?? i} className="relative flex flex-col items-center text-center">
<span className={cx('size-3 rounded-full border-2 border-(--line) bg-white', t?.kind === 'sun' && 'border-(--orange) bg-(--orange)')} />
<b className="mt-1.5 font-bagel text-lg leading-tight font-normal">{t ? clockShort(t.at) : <Skel className="w-12" />}</b>
<span className={cx('size-3 rounded-full border-2 border-(--line) bg-white', t?.kind === 'peak' && 'border-(--orange) bg-(--orange)')} />
<b className={cx('mt-1.5 font-bagel text-lg leading-tight font-normal', t?.kind === 'peak' && 'text-(--orange)')}>{t ? clockShort(t.at) : <Skel className="w-12" />}</b>
<span className="text-[12px] font-bold text-(--ink2)">{t ? t.label : <Skel className="w-11" />}</span>
</li>
))}
@@ -169,20 +169,20 @@ export function SkyPage() {
{plan?.when ?? '오늘'} {word} · {region.name}
</p>
{plan || load === 'loading' ? (
<HeroBody plan={plan} sunAt={sunAt} />
<HeroBody plan={plan} />
) : (
<StateBox load={load} onRetry={() => sky.refetch()} empty="오늘 노을 정보가 없어요." hold={<HeroBody />} className="inset-x-0 top-1.5 bottom-0" />
)}
</div>
{(plan || load === 'loading') && <Verdict plan={plan} sunAt={sunAt} />}
{/* 더 나은 날이 있으면 히어로 바로 아래 */}
{plan?.outlook && <p className="mx-3 mt-3 mb-0 rounded-[18px] bg-[#e8f6ee] px-4 py-2.5 text-[14px] font-extrabold text-[#1d6b46]">{plan.outlook}</p>}
{plan && <Details plan={plan} sunAt={sunAt} />}
<Sec title="언제 보면 좋을까" sub={rise ? '보통 해 뜨기 10~20분 전이 가장 붉어요' : '보통 해 진 뒤 10~20분이 가장 붉어요'} />
{plan?.timeline?.length || load === 'loading' ? (
<Timeline rows={plan?.timeline} kind={plan?.kind} />
) : (
<StateBox load="ready" empty={load === 'ready' ? '노을 시간 정보가 없어요.' : '노을 시간을 불러오지 못했어요.'} hold={<Timeline />} className="inset-x-3 top-3 bottom-0" />
)}
{/* 더 나은 날이 있을 때만 */}
{plan?.outlook && <p className="mx-3 mt-3 mb-0 rounded-[22px] bg-[#ffe6ec] px-4 py-3 text-[14px] font-bold text-[#7a2a4a]">{plan.outlook}</p>}
{!rise && <Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />}
{rise ? null : spots.length ? (
<ul className="mx-3 mt-1.5 flex flex-col">