feat: 축제·전시·콘서트·팝업 7일마다 수집, 피드 행사 종류 섞기

- 행사 수집을 화면 요청에서 빼고 worker 가 월 04:00(켤 때 7일 기록 없으면 한 번) 전국 17개 시도를 받는다
- 문화정보원 음악/콘서트(B000) 추가, 쪽·시도 사이 1초 간격으로 초당 요청 제한 회피
- 팝가(popga.co.kr) 팝업스토어 수집: 사이트맵 + 상세 JSON-LD, 바뀐 페이지만 다시 읽음
- 수집이 끝나면 Teams Workflows webhook 으로 종류별 건수 알림 (TEAMS_WEBHOOK_URL)
- event.kind(1=축제 2=전시 3=콘서트 4=팝업) 칸과 종류별 아이콘 추가
- 피드 행사 카드·띠를 축제→팝업→전시→콘서트 차례로 섞음
- 포스트 종류별 내용·피드 기획 문서 갱신

같은 작업 폴더의 다른 작업(외부 API 가드, 노을·달 계산, 각 API, 문서 파일 이름 정리 등)도 함께 담김.
This commit is contained in:
minaChoi committed 2026-10-07 12:03:48 +09:00
1 parent b61ed92c54
commit 997a366e76
70 files changed
+2083 -649

No files matched your search

+4 -3
View File
@@ -26,12 +26,13 @@ const ACCOUNTS: Record<PostType, readonly [string, string]> = {
[PostType.WEEKEND_PLAN]: ['주말 플랜', 'calendar'],
[PostType.AIR]: ['미세먼지', 'vent'],
[PostType.DAY_TRIP]: ['당일치기', 'picnic'],
[PostType.MOON]: ['오늘 밤 달', 'moon'],
}
type Slide = HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide
const GAK_BG: SlideBg[] = ['butter', 'peach', 'lilac']
const ROW_ICON_BG: Record<string, SlideBg> = { umbrella: 'lilac', vent: 'mint', sunset: 'peach', thermo: 'sky', maple: 'peach' }
const ROW_ICON_BG: Record<string, SlideBg> = { umbrella: 'lilac', vent: 'mint', sunset: 'peach', thermo: 'sky', maple: 'peach', moon: 'lilac' }
/** 배경색은 API에 없어 글 종류·아이콘으로 고른다 */
function slideBg(post: PostData, slide: Slide): SlideBg {
@@ -125,12 +126,12 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
)
if (slide.kind === 'sunset')
return (
<div className={cx(slideBase, 'b-bg-dusk')}>
<div className={cx(slideBase, slide.situation ? `b-sit-${slide.situation}` : 'b-bg-dusk')}>
<Eyebrow>{slide.eyebrow}</Eyebrow>
<Big>
<Lines text={slide.line} />
</Big>
<b className="mt-2 font-bagel text-[62px] leading-[0.9] font-normal">{slide.score}</b>
<small className="mt-1 text-[12.5px] font-bold opacity-85">노을 점수 {slide.score}</small>
<div className="mt-3 flex flex-1 flex-col gap-2">
{slide.cuts.map((c, i) => (
<div key={c.kind} className={cx('b-skyline relative flex-1 overflow-hidden rounded-2xl px-3 py-2 font-bagel text-[21px] text-white', `b-cut-${Math.min(i + 1, 3)}`)}>
+37 -8
View File
@@ -303,6 +303,8 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
const load = loadOf(q)
if (!g) return <Body>{load === 'loading' ? <GakSkel /> : <StateBox load={load} onRetry={() => q.refetch()} empty="이 각의 계산 근거가 아직 없어요." hold={<GakSkel />} className="inset-0" />}</Body>
const factors = d.factors ?? []
const bands = d.bands ?? []
const now = bands.find((b) => b.current)
return (
<Body>
<div className="flex items-center gap-3">
@@ -313,6 +315,12 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
</div>
<b className="ml-auto font-bagel text-[42px] font-normal text-(--orange)">{g.score}</b>
</div>
{now && (
<p className="mt-3 rounded-2xl bg-[#fff4ec] px-3.5 py-2.5 text-[14.5px] font-bold">
<b className="mr-1.5 font-jua font-normal text-(--orange)">{now.low}~{now.high}점</b>
{now.text}
</p>
)}
{factors.length > 2 && <Radar name={g.name} factors={factors} />}
{g.trend && g.trend.length > 0 && (
<div className="mt-2.5 grid grid-cols-4 gap-1.5">
@@ -325,6 +333,18 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
))}
</div>
)}
{bands.length > 0 && (
<ol className="mt-3.5 flex flex-col gap-1.5" aria-label="점수 구간별 설명">
{bands.map((b) => (
<li key={b.low} className={cx('grid grid-cols-[62px_1fr] items-start gap-2 text-[13px] font-semibold', !b.current && 'opacity-45')}>
<span className={cx('rounded-full py-px text-center font-jua text-xs text-white tabular-nums', b.current ? 'bg-(--orange)' : 'bg-(--ink3)')}>
{b.low}~{b.high}
</span>
<span>{b.text}</span>
</li>
))}
</ol>
)}
<div className="mt-3.5 flex flex-col gap-2.5">
{factors.map((f) => (
<div key={f.axis} className="grid grid-cols-[84px_1fr_52px] items-center gap-x-2.5 text-[13.5px] font-bold">
@@ -566,6 +586,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
}
/* ---------- 댓글 ---------- */
const NOT_FOUND = 3001 // 서버 ErrorType.NOT_FOUND
const EMOJIS = ['☀️', '🌂', '🍻', '🌇', '😍', '👍']
function CommentRow({ c, postId }: { c: CommentData; postId: number }) {
@@ -579,28 +600,36 @@ function CommentRow({ c, postId }: { c: CommentData; postId: number }) {
const unlike = useMutation(unlikeCommentMutation())
const remove = useMutation(deleteCommentMutation())
const [removeFailed, setRemoveFailed] = useState(false)
const [likeFailed, setLikeFailed] = useState(false)
const toggle = () => {
if (!loggedIn) return open({ type: 'login' })
if (like.isPending || unlike.isPending) return
const next = !liked
setLikeFailed(false)
setLiked(next)
setCount((n) => n + (next ? 1 : -1))
const revert = () => {
setLiked(!next)
setCount(c.like_count)
}
;(next ? like : unlike).mutate(
{ path: { comment_id: c.comment_id } },
{
onSuccess: (res) => {
if (!res.result?.success) {
setLiked(!next)
setCount(c.like_count)
if (res.result?.success) {
setLiked(!!res.liked)
if (res.like_count != null) setCount(res.like_count)
return
}
setLiked(!!res.liked)
if (res.like_count != null) setCount(res.like_count)
revert()
// 그 사이 지워진 댓글이면 알림 없이 목록을 다시 받아 사라지게 한다
if (res.result?.code === NOT_FOUND) queryClient.invalidateQueries({ queryKey: listCommentsInfiniteQueryKey({ path: { post_id: postId } }) })
else setLikeFailed(true)
},
onError: () => {
setLiked(!next)
setCount(c.like_count)
revert()
setLikeFailed(true)
},
},
)
@@ -636,7 +665,7 @@ function CommentRow({ c, postId }: { c: CommentData; postId: number }) {
{c.body}
</p>
<small className="mt-0.5 block text-xs font-bold text-(--ink3)">
{ago(c.created_at)} · 좋아요 {count}개
{ago(c.created_at)} · {likeFailed ? <span className="text-(--heart)" role="alert">좋아요를 못 했어요. 잠시 뒤에 다시 눌러 주세요</span> : `좋아요 ${count}개`}
{c.mine && (
<>
{' · '}
+65 -159
View File
@@ -1,72 +1,11 @@
import { useQuery } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { getSkyOptions, getSkyRankingOptions } from '../api/client/@tanstack/react-query.gen'
import type { BestTime, RegionData, SkyPlanData, SpotData } from '../api/client/types.gen'
import type { BestTime, SkyPlanData } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { clockShort, compass, dayLabel, loadOf } from './lib'
import { clockShort, loadOf } from './lib'
import { useRegion } from './regionContext'
import { Sec, Skel, StateBox } from './ui'
const W = 400
const H = 260
const BLOCKS = [
[20, 20, 90, 60],
[130, 18, 100, 52],
[262, 22, 110, 48],
[24, 190, 110, 54],
[170, 196, 90, 50],
[290, 180, 92, 62],
]
/** 내 구 중심을 기준으로 명소를 km 단위로 놓고, 해 지는 방향을 그린다 */
function SpotMap({ region, spots, azimuth }: { region: RegionData; spots: SpotData[]; azimuth: number | null | undefined }) {
const kx = 111 * Math.cos((region.lat * Math.PI) / 180)
const pts = spots.map((s) => ({ no: s.no, x: (s.lon - region.lon) * kx, y: (s.lat - region.lat) * 111 }))
const maxX = Math.max(0.5, ...pts.map((p) => Math.abs(p.x)))
const maxY = Math.max(0.5, ...pts.map((p) => Math.abs(p.y)))
const scale = Math.min(160 / maxX, 95 / maxY)
const cx0 = W / 2
const cy0 = H / 2
const az = ((azimuth ?? 270) * Math.PI) / 180
const dir = (len: number, turn = 0) => [cx0 + Math.sin(az + turn) * len, cy0 - Math.cos(az + turn) * len] as const
const tip = dir(190)
const label = dir(120)
return (
<div className="mx-3 mt-3 overflow-hidden rounded-[26px] bg-[#eef2e8] shadow-[inset_0_0_0_2px_#e1e7da]">
<svg viewBox={`0 0 ${W} ${H}`} role="img" aria-label={`${region.name} 주변 노을 명소 지도`} className="block h-auto w-full">
<rect width={W} height={H} fill="#eef2e8" />
{BLOCKS.map(([x, y, w, h]) => (
<rect key={`${x}-${y}`} x={x} y={y} width={w} height={h} rx="10" fill="#e1e7da" />
))}
<path d={`M${W / 2 - 10} 0 L${W / 2 + 4} ${H}`} stroke="#fff" strokeWidth="9" />
<path d={`M0 ${H / 2 - 30} H${W}`} stroke="#fff" strokeWidth="10" />
{azimuth != null && (
<>
<path d={`M${cx0} ${cy0} L${dir(260, -0.3).join(' ')} L${dir(260, 0.3).join(' ')} Z`} fill="#ff8e4e" opacity=".18" />
<path d={`M${cx0} ${cy0} L${tip.join(' ')}`} stroke="#ff7a45" strokeWidth="3" strokeDasharray="7 6" />
<text x={Math.min(W - 110, Math.max(8, label[0] - 50))} y={label[1] + 26} fontFamily="Jua,sans-serif" fontSize="14" fill="#d4552a">
해 지는 {compass(azimuth)}쪽
</text>
</>
)}
<circle cx={cx0} cy={cy0} r="13" fill="#4f97e3" opacity=".25" />
<circle cx={cx0} cy={cy0} r="6" fill="#4f97e3" stroke="#fff" strokeWidth="2" />
<text x={cx0 + 14} y={cy0 + 18} fontFamily="Pretendard Variable,sans-serif" fontWeight="800" fontSize="11" fill="#2f6fb7">
지금 여기
</text>
{pts.map((p) => (
<g key={p.no}>
<circle cx={cx0 + p.x * scale} cy={cy0 - p.y * scale} r="13" fill="#ff7a45" stroke="#fff" strokeWidth="3" />
<text x={cx0 + p.x * scale} y={cy0 - p.y * scale + 5} textAnchor="middle" fontFamily="Bagel Fat One,sans-serif" fontSize="14" fill="#fff">
{p.no}
</text>
</g>
))}
</svg>
</div>
)
}
import { MapLink, Sec, Skel, StateBox } from './ui'
function LiSkel({ ghost = false }: { ghost?: boolean }) {
return (
@@ -89,54 +28,58 @@ function LiSkel({ ghost = false }: { ghost?: boolean }) {
)
}
const HERO = 'relative mx-3 mt-1 min-h-[350px] overflow-hidden rounded-[32px] bg-[linear-gradient(180deg,#7e6fe6,#f08aa2_58%,#ffc28a)] px-5 pt-5 pb-16 text-white'
// 다른 탭 히어로보다 짧게. 배경은 하늘 상황별 색(b-sit-1~5), 아래에 동네 실루엣
const HERO = 'relative mx-3 mt-1 min-h-[230px] overflow-hidden rounded-[32px] px-5 pt-5 pb-14 text-white'
const THREE = [0, 1, 2]
const FOUR = [0, 1, 2, 3]
const RANK_SKELS = Array.from({ length: 8 }, (_, i) => i)
/** 결론 → 왜 → 몇 시에 어디로 → 점수(보조). 글자 줄 수를 고정해 스켈레톤과 크기가 같다 */
function HeroBody({ plan }: { plan?: SkyPlanData }) {
/** 히어로엔 해 지는 시각과 하늘 상황 한 줄만. 결론·이유는 아래 카드로 */
function HeroBody({ plan, sunset }: { plan?: SkyPlanData; sunset?: string }) {
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
const place = plan && (plan.spot ? `${plan.spot.name} · ${plan.spot.distance_km}km` : plan.verdict === 'rest' ? '오늘은 나가지 않아도 돼요' : '30km 안에 등록된 명소가 없어요')
return (
<div aria-hidden={plan ? undefined : true}>
<p className="relative m-0 mt-1.5 font-jua text-[38px] leading-[1.1]">{v(plan?.headline, 'w-[200px]')}</p>
<div className="relative z-[1] mt-3 rounded-[20px] bg-[rgb(45_36_64/0.55)] px-4 py-3">
<p className="m-0 line-clamp-2 h-[2lh] text-[14.5px] leading-snug font-bold">{v(plan?.reason, 'w-[250px]')}</p>
<div className="mt-2.5 grid grid-cols-[auto_1fr] items-center gap-x-3 border-t border-white/25 pt-2.5">
<b className="row-span-2 font-bagel text-[30px] leading-none font-normal">{v(plan?.best_at && clockShort(plan.best_at), 'w-[76px]')}</b>
<span className="text-[13px] font-extrabold">{v(plan && '가장 붉을 때', 'w-20')}</span>
<span className="truncate text-[13px] font-bold">{v(place, 'w-36')}</span>
</div>
<p className="m-0 mt-2.5 border-t border-white/25 pt-2 text-[12.5px] leading-snug font-bold">
{v(plan && `노을 점수 ${plan.score}점 · ${plan.grade_label}`, 'w-32')}
<small className="block text-[12px] font-semibold">{v(plan && '해 지는 쪽 구름 높이·양으로 매겨요. 60점부터 나가 볼 만해요', 'w-56')}</small>
</p>
</div>
<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(sunset && clockShort(sunset), 'w-[150px]')}</p>
<p className="m-0 mt-1.5 font-jua text-[21px]">{v(plan?.situation_label ?? plan?.headline, 'w-[190px]')}</p>
</div>
)
}
/** 일몰 전 골든아워 → 해 짐 → 가장 붉을 때 → 블루아워, 한 줄 */
/** 결론과 이유, 예보 모델이 얼마나 같은 예보를 냈는지, 점수(작게) */
function Verdict({ plan }: { plan?: SkyPlanData }) {
const v = (node: ReactNode, w: string) => (plan ? node : <Skel className={w} />)
const agree = plan?.models_total ? `예보 모델 ${plan.models_total}개 중 ${plan.models_agree}개가 같은 예보` : ''
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]')}
</p>
<small className="mt-1 block text-[12px] font-bold text-(--ink2)">{v(plan && [agree, `노을 점수 ${plan.score}`].filter(Boolean).join(' · '), 'w-48')}</small>
</div>
)
}
/** 골든아워 → 해 짐 → 블루아워 */
function Timeline({ rows }: { rows?: BestTime[] }) {
return (
<ol className="relative mx-3 mt-3 grid grid-cols-4 rounded-[22px] bg-white px-2 pt-4 pb-3 shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={rows ? undefined : true}>
<span className="absolute inset-x-[12.5%] top-[22px] h-0.5 bg-(--line)" aria-hidden="true" />
{(rows ?? FOUR.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 === 'peak' && 'border-[#d6457a] bg-[#d6457a]')} />
<b className={cx('mt-1.5 font-bagel text-lg leading-tight font-normal', t?.kind === 'peak' && 'text-[#d6457a]')}>{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>
))}
</ol>
<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" />
{(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="text-[12px] font-bold text-(--ink2)">{t ? t.label : <Skel className="w-11" />}</span>
</li>
))}
</ol>
</div>
)
}
function SpotsSkel() {
return (
<>
<Skel shape className="mx-3 mt-3 aspect-[400/260] rounded-[26px]" />
<ul className="mx-3 mt-1.5 flex flex-col">
{THREE.map((i) => (
<LiSkel key={i} />
@@ -146,26 +89,6 @@ function SpotsSkel() {
)
}
function DaysSkel() {
return (
<div className="grid grid-cols-3 gap-2 p-3" aria-hidden="true">
{THREE.map((i) => (
<div key={i} className="rounded-[20px] bg-white p-3 text-center shadow-[inset_0_-5px_0_var(--shade)]">
<small className="block text-[12.5px] font-extrabold">
<Skel className="w-10" />
</small>
<b className="block font-bagel text-[30px] font-normal">
<Skel className="w-10" />
</b>
<span className="block text-xs font-bold">
<Skel className="w-12" />
</span>
</div>
))}
</div>
)
}
function RankSkel() {
return (
<ul className="mx-3 mt-1.5 flex flex-col" aria-hidden="true">
@@ -176,13 +99,13 @@ function RankSkel() {
)
}
function Li({ no, title, sub, right, mine = false }: { no: number; title: string; sub?: string | null; right: string; mine?: boolean }) {
function Li({ no, title, sub, right, mine = false, place }: { no: number; title: string; sub?: string | null; right: string; mine?: boolean; place?: string }) {
return (
<li className={cx('grid grid-cols-[34px_1fr_auto] items-center gap-2.5 border-b-[1.5px] border-(--line) px-1 py-3 last:border-b-0', mine && 'rounded-2xl bg-white')}>
<span className="text-center font-bagel text-xl text-(--orange)">{no}</span>
<span className="min-w-0">
<b className="block font-jua text-[17px] font-normal">
{title}
{place ? <MapLink place={place}>{title}</MapLink> : title}
{mine && <small className="ml-1.5 font-sans text-xs font-extrabold text-(--rain)">내 지역</small>}
</b>
<small className="block truncate text-[12.5px] font-semibold text-(--ink2)">{sub || '\u00a0'}</small>
@@ -200,74 +123,57 @@ export function SkyPage() {
const rankLoad = loadOf(ranking)
const plan = sky.data?.plan ?? undefined
const spots = (sky.data?.spots ?? []).slice(0, 3)
const days = sky.data?.days ?? []
const items = (ranking.data?.items ?? []).slice(0, 8)
const target = Math.max(0, days.findIndex((d) => d.day === plan?.day))
const best = days.reduce<number>((b, d, i) => (d.score > days[b].score ? i : b), target)
// 서버 outlook 과 같은 기준: 10점 넘게 나을 때만 더 나은 날로 표시
const better = days.length > 0 && days[best].score - days[target].score > 10 ? best : -1
const target = sky.data?.days?.find((d) => d.day === plan?.day)
const sunset = plan?.timeline?.find((t) => t.kind === 'sun')?.at
return (
<section aria-label="노을" aria-busy={load === 'loading'} className={cx('transition-opacity', sky.isPlaceholderData && 'opacity-60')}>
{/* 히어로 상자는 불러오는 중·실패·빈 값 모두 같은 크기 */}
<div className={HERO}>
<div className="b-skyline pointer-events-none absolute inset-0 [--sky-h:16%]" aria-hidden="true" />
<p className="relative m-0 text-[13px] font-extrabold">
<div className={cx(HERO, `b-sit-${target?.situation ?? 3}`)}>
<i className="b-sit-sun pointer-events-none absolute bottom-6 left-1/2 -ml-[56px] size-[112px] rounded-full" aria-hidden="true" />
<div className="b-skyline pointer-events-none absolute inset-0 [--sky-h:22%]" aria-hidden="true" />
{/* 하늘 위 흰 글씨 대비가 모자라 어두운 바탕을 깐다 */}
<p className="relative z-[1] m-0 self-start rounded-full bg-[rgb(30_18_60/0.35)] px-2.5 py-0.5 text-[13px] font-extrabold">
{plan?.when ?? '오늘'} 노을 · {region.name}
</p>
{plan || load === 'loading' ? (
<HeroBody plan={plan} />
<HeroBody plan={plan} sunset={sunset} />
) : (
<StateBox load={load} onRetry={() => sky.refetch()} empty="오늘 노을 정보가 없어요." hold={<HeroBody />} className="inset-x-0 top-1.5 bottom-0" />
)}
</div>
<Sec title="언제 보면 좋을까" sub={plan ? `${plan.when} 해 지는 시간 기준` : '\u00a0'} />
{(plan || load === 'loading') && <Verdict plan={plan} />}
<Sec title="언제 보면 좋을까" sub="보통 해 진 뒤 10~20분이 가장 붉어요" />
{plan?.timeline?.length || load === 'loading' ? (
<Timeline rows={plan?.timeline} />
) : (
<StateBox load="ready" empty={load === 'ready' ? '노을 시간 정보가 없어요.' : '노을 시간을 불러오지 못했어요.'} hold={<Timeline />} className="inset-x-3 top-3 bottom-0" />
)}
<Sec title="내일·모레가 더 나을까" sub={plan?.outlook || '\u00a0'} />
{days.length > 0 ? (
<div className="grid grid-cols-3 gap-2 p-3">
{days.map((d, i) => (
<div key={d.day} className={cx('rounded-[20px] bg-white p-3 text-center shadow-[inset_0_-5px_0_var(--shade)]', i === better && 'ring-2 ring-[#d6457a] ring-inset')}>
<small className="block text-[12.5px] font-extrabold text-(--ink2)">{dayLabel(d.day, i)}</small>
<b className={cx('block font-bagel text-[30px] font-normal', d.score < 60 ? 'text-(--ink2)' : 'text-[#d6457a]')}>{d.score}</b>
<span className="block text-xs font-bold text-(--ink2)">{d.grade_label}</span>
</div>
))}
</div>
) : load === 'loading' ? (
<DaysSkel />
) : (
<StateBox load="ready" empty={load === 'ready' ? '앞으로 3일 노을 정보가 없어요.' : '앞으로 3일 노을을 불러오지 못했어요.'} hold={<DaysSkel />} className="inset-3" />
)}
<Sec title="가까운 노을 명소" sub={sky.data?.sunset_azimuth != null ? `해 지는 ${compass(sky.data.sunset_azimuth)}쪽이 트인 곳, 가까운 순` : '서쪽이 트인 곳, 가까운 순'} />
{/* 더 나은 날이 있을 때만 */}
{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>}
<Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />
{spots.length ? (
<>
<SpotMap region={region} spots={spots} azimuth={sky.data?.sunset_azimuth} />
<ul className="mx-3 mt-1.5 flex flex-col">
{spots.map((p) => (
<Li key={p.no} no={p.no} title={p.name} sub={p.description} right={`${p.distance_km}km`} />
))}
{/* 3곳이 안 되면 빈 줄로 스켈레톤 높이를 지켜 아래 순위가 밀리지 않게 */}
{THREE.slice(spots.length).map((i) => (
<LiSkel key={`ghost-${i}`} ghost />
))}
</ul>
</>
<ul className="mx-3 mt-1.5 flex flex-col">
{spots.map((p) => (
<Li key={p.no} no={p.no} title={p.name} sub={p.direction ? `${p.direction}쪽` : null} right={`${p.distance_km}km`} place={p.name} />
))}
{/* 3곳이 안 되면 빈 줄로 스켈레톤 높이를 지켜 아래 순위가 밀리지 않게 */}
{THREE.slice(spots.length).map((i) => (
<LiSkel key={`ghost-${i}`} ghost />
))}
</ul>
) : load === 'loading' ? (
<SpotsSkel />
) : (
// 실패 안내·다시 시도는 위 히어로에 한 번만. 여기는 지도·목록 자리만 지킨다
// 실패 안내·다시 시도는 위 히어로에 한 번만. 여기는 목록 자리만 지킨다
<StateBox load="ready" empty={load === 'ready' ? '근처에 등록된 노을 명소가 없어요.' : '명소 정보를 불러오지 못했어요.'} hold={<SpotsSkel />} className="inset-x-3 top-3 bottom-0" />
)}
<Sec title="전국 노을 순위" sub="오늘 기준" />
<Sec title="전국 노을 순위" sub={ranking.data?.summary ?? '오늘 기준'} />
{items.length ? (
<ul className="mx-3 mt-1.5 flex flex-col">
{items.map((r) => (
<Li key={r.region_code} no={r.rank} title={r.name} sub={r.note} right={`${r.score}점`} mine={r.region_code === region.code} />
<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} />
))}
</ul>
) : rankLoad === 'loading' ? (
+27 -2
View File
@@ -88,6 +88,8 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
const feels = mode === 'now' && hero ? hero.feels_c : slot?.feels_c
const top1 = hero?.top1
const who = kind === 'night' ? 'bear' : 'rabbit'
// 저녁(노을)부터는 가운데 동그라미가 오늘 밤 달 모양이 된다
const moon = (kind === 'sunset' || kind === 'night') && hero?.moon_name && hero.moon_pct != null ? { name: hero.moon_name, pct: hero.moon_pct, waning: WANING.includes(hero.moon_name) } : null
const tempLoad = mode === 'now' ? feedLoad : todayLoad
const feelsLine = temp != null ? `체감 ${deg(feels)}${slot ? ` · ${skyText(slot)}` : ''}` : failed(tempLoad) ? '날씨를 못 불러왔어요' : tempLoad === 'ready' ? '체감 ?°' : null
const bubble = hero ? (hero.bubble ?? '오늘은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
@@ -133,7 +135,13 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
<div className="relative mt-5 h-[286px]">
<span className="b-cloud b-fall top-6 left-[6%] h-[30px] w-[84px]" style={fall('.1s', '6s')} aria-hidden="true" />
<div className="b-sun b-fall absolute top-10 left-1/2 -ml-[82px] grid aspect-square w-[164px] place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
<span>
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
{moon && (
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
<path d={moonPath(moon.pct, 1, false)} fill={kind === 'sunset' ? 'rgb(96 40 86 / .55)' : 'rgb(34 30 86 / .62)'} transform={moon.waning ? 'scale(-1,1)' : undefined} />
</svg>
)}
<span className={cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')}>
<b className="block font-bagel text-[56px] leading-[0.9] font-normal">{heroVal(feedLoad, hero?.weather_score, 'w-[84px]')}</b>
<small className="mt-0.5 block font-jua text-[14.5px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : '오늘 날씨 점수'}</small>
</span>
@@ -174,6 +182,18 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
)
}
const WANING = ['기우는 달', '하현달', '그믐달']
/**
* 반지름 r 인 달에서 밝은 쪽(lit) 또는 어두운 쪽 경로. 차오르는 달 기준(오른쪽이 밝음), 기우는 달은 좌우를 뒤집어 쓴다.
* 바깥 반원과 명암 경계(가로 반지름 r·|1-2k| 인 타원 호)로 이루어진다.
*/
function moonPath(pct: number, r: number, lit: boolean) {
const k = pct / 100
const edge = `A${r * Math.abs(1 - 2 * k)},${r} 0 0 ${k < 0.5 ? 0 : 1} 0,${-r}`
return `M0,${-r} A${r},${r} 0 0 ${lit ? 1 : 0} 0,${r} ${edge}`
}
function HeroStat({ icon, label, children }: { icon: string; label: string; children: ReactNode }) {
return (
<div className="b-stat flex min-h-[90px] items-center gap-2.5 rounded-[20px] px-3 py-[9px]">
@@ -315,6 +335,10 @@ export function TodayPage() {
const nowAt = f?.hero?.now_at
const load = loadOf(feed)
useEffect(() => {
window.scrollTo({ top: 0 })
}, [region.code])
// 디자인대로 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
const bandAt: [number, ReactNode][] = [
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} /> : null],
@@ -323,7 +347,8 @@ export function TodayPage() {
]
return (
<section aria-label="오늘" aria-busy={load === 'loading'} className={cx('transition-opacity', feed.isPlaceholderData && 'opacity-60')}>
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
<section key={region.code} aria-label="오늘" aria-busy={load === 'loading'} className={cx('transition-opacity', feed.isPlaceholderData && 'opacity-60')}>
<Hero hero={f?.hero} today={today.data} feedLoad={load} todayLoad={loadOf(today)} />
<Sec title="오늘의 각" sub="누르면 계산 근거를 보여 줘요" more={{ to: '/gak' }} />
{/* 실패 안내는 여기 한 번만, 각 줄 스켈레톤과 같은 크기로 */}
+11 -3
View File
@@ -5,7 +5,7 @@ import { cx } from '../lib/utils'
import { cardBg, dateRange, loadOf, shortDay, sidoOf } from './lib'
import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
import { Arrows, Chips, Ic, Rail, Sec, Skel, SkelRail, StateBox, Thumb } from './ui'
import { Arrows, Chips, Ic, MapLink, Rail, Sec, Skel, SkelRail, StateBox, Thumb } from './ui'
import { useCarousel } from './carousel'
const TEN = Array.from({ length: 10 }, (_, i) => i)
@@ -248,7 +248,9 @@ export function WeekPage() {
<span className="text-[11.5px] font-extrabold text-(--ink3)">
{p.area} · {p.is_outdoor ? '야외' : '실내'}
</span>
<b className="block font-jua text-[16.5px] font-normal">{p.name}</b>
<b className="block font-jua text-[16.5px] font-normal">
<MapLink place={p.name}>{p.name}</MapLink>
</b>
<small className="block text-[12.5px] leading-snug font-semibold text-(--ink2)">
{p.reason}
<br />
@@ -314,7 +316,13 @@ export function WeekPage() {
{e.name}
</b>
<small className="block truncate text-[12.5px] font-semibold text-(--ink2)">
{[dateRange(e.start_date, e.end_date), e.place_name].filter(Boolean).join(' · ')}
{dateRange(e.start_date, e.end_date)}
{e.place_name && (
<>
{' · '}
<MapLink place={e.place_name}>{e.place_name}</MapLink>
</>
)}
{!e.is_confirmed && ' · 일정 확인 필요'}
</small>
<span className={cx('mt-[5px] block h-[1lh] text-xs font-extrabold', e.fit?.includes('비') ? 'text-[#d6457a]' : 'text-[#1f9d62]')}>{e.fit}</span>
+19 -1
View File
@@ -198,7 +198,16 @@
inset -18px -24px 40px rgb(170 50 20 / 0.34),
inset 16px 18px 28px rgb(255 255 255 / 0.55),
0 30px 56px rgb(240 106 58 / 0.32);
color: #fff;
color: #5c1f08; /* 흰 글씨는 주황 위에서 대비가 모자람 */
}
/* 저녁(노을)부터는 해 대신 달. 저녁엔 노을빛, 밤엔 차가운 달빛 */
.b-hero[data-t='sunset'] .b-sun {
background: radial-gradient(circle at 34% 30%, #fff4e6, #ffd9b8 32%, #f7a991 68%, #e07a8f);
color: #4a2442;
box-shadow:
inset -18px -24px 40px rgb(150 50 90 / 0.3),
inset 16px 18px 28px rgb(255 255 255 / 0.55),
0 0 60px rgb(255 150 110 / 0.5);
}
.b-hero[data-t='night'] .b-sun {
background: radial-gradient(circle at 34% 30%, #fff, #e7e3ff 35%, #b9b0f2 72%, #8f86d9);
@@ -274,6 +283,15 @@
}
/* 건물 실루엣 */
/* 노을 탭 히어로: 하늘 상황(SkySituation)별 하늘 색. 1 가려짐 2 낮은 구름 3 물들 구름 적음 4 넓게 물듦 5 두꺼움 */
.b-sit-1 { background: linear-gradient(180deg, #6f7690, #9aa0b4 55%, #b9b4c0); }
.b-sit-2 { background: linear-gradient(180deg, #7a7f9c, #a7a3bb 55%, #c9b8b8); }
.b-sit-3 { background: linear-gradient(180deg, #4b5aa8 0%, #7f86c6 38%, #e9b9a8 68%, #ffb27a 86%, #ff8a4c 100%); }
.b-sit-4 { background: linear-gradient(180deg, #5b3f9e 0%, #c2559a 40%, #ff7a6a 68%, #ffb35c 100%); }
.b-sit-5 { background: linear-gradient(180deg, #6a6aa0, #a98fb4 55%, #e3b1a0); }
.b-sit-sun { background: radial-gradient(circle, #fff6dd 0%, #ffd08f 38%, rgb(255 160 90 / 0) 70%); }
.b-sit-1 .b-sit-sun, .b-sit-2 .b-sit-sun { opacity: 0.25; }
.b-sit-5 .b-sit-sun { opacity: 0.55; }
.b-skyline::after {
content: '';
position: absolute;
+5 -2
View File
@@ -1,7 +1,7 @@
import type { CSSProperties } from 'react'
const SHARED = new Set(['bear', 'bike', 'bronze', 'camping', 'carwash', 'chimaek', 'cloud', 'coldwind', 'delivery', 'dog', 'garden', 'glasses', 'gold', 'hiking', 'iced_hot', 'jjamppong', 'laundry', 'letter', 'makeup', 'makgeolli', 'maple', 'moon', 'muggy', 'naengmyeon', 'photo', 'picnic', 'rabbit', 'rain', 'running', 'silver', 'snow', 'stars', 'sun_cloud', 'sun', 'sunset', 'taxi', 'umbrella', 'vent', 'walk', 'yajang', 'baseball', 'study', 'netflix', 'chestnut', 'peanut', 'tangerine', 'sweet_potato', 'fallen_leaf', 'kimchi', 'apple'])
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf'])
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert'])
/** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons). 'none'(데이터 없는 칸)은 그림 없음 */
export function iconSrc(name: string) {
@@ -63,6 +63,9 @@ export function clockShort(iso: string) {
const COMPASS = ['북', '북북동', '북동', '동북동', '동', '동남동', '남동', '남남동', '남', '남남서', '남서', '서남서', '서', '서북서', '북서', '북북서']
/** 방위각 → 16방위 이름. 263 → "서" */
/** 네이버 지도에서 장소 이름(또는 주소)으로 찾기 */
export const naverMap = (query: string) => `https://map.naver.com/p/search/${encodeURIComponent(query)}`
export const compass = (deg: number) => COMPASS[Math.round(deg / 22.5) % 16]
/** 18:30 → "6시 반", 18:25 → "6시 25분" */
@@ -111,7 +114,7 @@ export function dateRange(start: string, end: string) {
}
const CARD_BG = ['night', 'butter', 'lilac', 'mint', 'peach', 'sky'] as const
const ICON_BG: Record<string, (typeof CARD_BG)[number] | 'dusk'> = { picnic: 'mint', walk: 'mint', sunset: 'dusk', chimaek: 'peach', photo: 'butter', fireworks: 'night', sheaf: 'butter', rain: 'sky', calendar: 'sky', bulb: 'lilac', maple: 'peach', snow: 'sky', thermo: 'sky', umbrella: 'lilac' }
const ICON_BG: Record<string, (typeof CARD_BG)[number] | 'dusk'> = { picnic: 'mint', walk: 'mint', sunset: 'dusk', chimaek: 'peach', photo: 'butter', fireworks: 'night', popup: 'peach', exhibition: 'lilac', concert: 'night', sheaf: 'butter', rain: 'sky', calendar: 'sky', bulb: 'lilac', maple: 'peach', snow: 'sky', thermo: 'sky', umbrella: 'lilac' }
/** API에 배경색이 없어 아이콘·순서로 카드 배경을 고른다 */
export function cardBg(icon: string, index: number) {
+12 -3
View File
@@ -2,7 +2,7 @@ import { useState, type CSSProperties, type ReactNode } from 'react'
import { Link } from 'react-router'
import { cx } from '../lib/utils'
import { useCarousel, type Carousel } from './carousel'
import { AVATAR_COLORS, iconSrc, moodEmoji, type Load } from './lib'
import { AVATAR_COLORS, iconSrc, moodEmoji, naverMap, type Load } from './lib'
type IcProps = { name: string; className?: string; alt?: string; style?: CSSProperties }
@@ -193,13 +193,22 @@ export function StateBox({ load, onRetry, empty, className, hold }: StateProps)
}
/** 줄 목록 (라벨 · 값) */
export function Rows({ rows, dark = false }: { rows: { label: string; value: string }[]; dark?: boolean }) {
/** 위치가 정해진 장소 이름. 누르면 네이버 지도가 새 탭으로 열린다 */
export function MapLink({ place, children, className }: { place: string; children: ReactNode; className?: string }) {
return (
<a href={naverMap(place)} target="_blank" rel="noopener noreferrer" aria-label={`${place}, 네이버 지도에서 보기`} className={cx('underline decoration-dotted decoration-1 underline-offset-[3px]', className)}>
{children}
</a>
)
}
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null }[]; dark?: boolean }) {
return (
<div className="mt-auto flex flex-col">
{rows.map((r) => (
<div key={r.label} className={cx('flex justify-between gap-2.5 border-b-2 py-2.5 font-bold last:border-b-0', dark ? 'border-white/18' : 'border-[rgb(40_48_74/0.08)]')}>
<span>{r.label}</span>
<b className="text-right font-jua text-[17px] font-normal">{r.value}</b>
<b className="text-right font-jua text-[17px] font-normal">{r.place ? <MapLink place={r.place}>{r.value}</MapLink> : r.value}</b>
</div>
))}
</div>