Merge remote-tracking branch 'origin/main' into feat/apps-in-toss

# Conflicts:
#	TODO.md
#	docs/QA_체크리스트.md
#	frontend/src/b/BLayout.tsx
#	frontend/vite.config.ts
This commit is contained in:
minaChoi committed 2026-10-13 15:04:14 +09:00
commit 07290597a0
114 files changed
+5027 -890

No files matched your search

@@ -150,7 +150,7 @@ export const getSkyRankingOptions = (options?: Options<GetSkyRankingData>) => qu
export const listIndicesQueryKey = (options: Options<ListIndicesData>) => createQueryKey('listIndices', options);
/**
* 지수 목록 (점수순, 1~3위, 오늘 날씨 점수)
* 지수 목록 (지금 구간 점수순, 1~3위, 지금 날씨 점수)
*/
export const listIndicesOptions = (options: Options<ListIndicesData>) => queryOptions<ListIndicesResponse, ListIndicesError, ListIndicesResponse, ReturnType<typeof listIndicesQueryKey>>({
queryFn: async ({ queryKey, signal }) => {
+1 -1
View File
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { addComment, deleteComment, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, listArticles, listComments, listEvents, listIndices, listPlaces, listRegions, listSaved, login, logout, me, nearestRegion, type Options, refresh, savePost, signup, unlikeComment, unlikePost, unsavePost, updateMe } from './sdk.gen';
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErLine truncated
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReqComment, type ReqLogin, type ReqRefresh, type ReqSignup, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, typeLine truncated
+1 -1
View File
@@ -49,7 +49,7 @@ export const getSky = <ThrowOnError extends boolean = true>(options: Options<Get
export const getSkyRanking = <ThrowOnError extends boolean = true>(options?: Options<GetSkyRankingData, ThrowOnError>): RequestResult<GetSkyRankingResponses, unknown, ThrowOnError> => (options?.client ?? client).get<GetSkyRankingResponses, unknown, ThrowOnError>({ url: '/v1/sky/ranking', ...options });
/**
* 지수 목록 (점수순, 1~3위, 오늘 날씨 점수)
* 지수 목록 (지금 구간 점수순, 1~3위, 지금 날씨 점수)
*/
export const listIndices = <ThrowOnError extends boolean = true>(options: Options<ListIndicesData, ThrowOnError>): RequestResult<ListIndicesResponses, ListIndicesErrors, ThrowOnError> => (options.client ?? client).get<ListIndicesResponses, ListIndicesErrors, ThrowOnError>({ url: '/v1/index/list', ...options });
+172 -4
View File
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
baseUrl: `${string}://openapi.gen.json` | (string & {});
baseUrl: `${string}://${string}` | (string & {});
};
/**
@@ -230,6 +230,12 @@ export type BestTime = {
* Label
*/
label: string;
/**
* End
*
* 구간이면 끝 시각 (골든아워·블루아워)
*/
end?: string | null;
};
/**
@@ -561,8 +567,16 @@ export type Hero = {
* Feels C
*/
feels_c?: number | null;
/**
* Humidity
*
* 지금 습도 %. 히어로에 늘 보인다
*/
humidity?: number | null;
/**
* Discomfort
*
* 지금 불쾌지수. 히어로에 늘 보인다
*/
discomfort?: number | null;
/**
@@ -581,6 +595,14 @@ export type Hero = {
* Weather Score
*/
weather_score?: number | null;
/**
* Weather Slots
*
* 오늘 구간별 날씨 점수 {morning·day·evening·night: 점수}
*/
weather_slots?: {
[key: string]: number;
};
top1?: TopIndex | null;
/**
* Bubble
@@ -595,15 +617,21 @@ export type Hero = {
/**
* Moon Pct
*
* 달이 밝게 보이는 비율 0~100
* 달에서 빛나는 면의 비율 0~100 (모양 그림용, 밝기 아님)
*/
moon_pct?: number | null;
/**
* Stats
*
* 히어로 두 칸. 지금 챙길 것(비·미세먼지·자외선·일교차·체감·불쾌지수) 먼저
* 히어로 상황 칸 1개. 지금 챙길 것(비·미세먼지·자외선·일교차·체감) 먼저
*/
stats?: Array<HeroStat>;
/**
* Status
*
* 히어로 상태 한 줄: 습도·불쾌지수·자외선(밤 구간 빼고)·미세먼지 단계 이름. tone=warn 이면 조심(앱이 주황 글자로)
*/
status?: Array<HeroStat>;
};
/**
@@ -727,6 +755,18 @@ export type IndexSummary = {
* Is Core
*/
is_core: boolean;
/**
* Season
*
* 지금 제철이면 계절 이름(봄·여름·가을·겨울). 일 년 내내인 각은 없음
*/
season?: string | null;
/**
* In Season
*
* false 면 제철이 아니라 순위 밖, 목록 맨 끝
*/
in_season?: boolean;
/**
* Score
*/
@@ -743,6 +783,24 @@ export type IndexSummary = {
* Trend
*/
trend?: Array<TrendPoint>;
/**
* Active
*
* 지금 구간이 이 각의 시간대와 겹침. false 면 순위 밖, score 는 하루 점수
*/
active?: boolean;
/**
* Slot
*
* score 가 어느 구간 점수인지 (지금 구간)
*/
slot?: string | null;
/**
* Slots
*
* 오늘 구간별 점수. 각 시간대와 안 겹치는 구간은 없음
*/
slots?: Array<SlotPoint>;
};
/**
@@ -1440,6 +1498,8 @@ export type ResIndexList = {
day?: string | null;
/**
* Weather Score
*
* 지금 날씨 점수 (지금 구간 기준)
*/
weather_score?: number | null;
/**
@@ -1667,6 +1727,12 @@ export type ResSky = {
*/
spots?: Array<SpotData>;
plan?: SkyPlanData | null;
/**
* Plans
*
* plan 과 같은 종류로 아직 안 끝난 날 최대 3일 (날짜 타일, 누르면 그날로)
*/
plans?: Array<SkyPlanData>;
};
/**
@@ -1871,6 +1937,12 @@ export type Row = {
* 위치가 정해진 장소면 지도에서 찾을 이름 (앱이 네이버 지도 링크를 건다)
*/
place?: string | null;
/**
* Level
*
* 자외선 단계 1 낮음 ~ 5 위험. 있으면 앱이 값을 단계 색 칩으로 그린다
*/
level?: number | null;
};
/**
@@ -2008,6 +2080,18 @@ export type SkyGrade = typeof SkyGrade[keyof typeof SkyGrade];
* SkyPlanData
*/
export type SkyPlanData = {
/**
* Kind
*
* 다음에 오는 것: 해 뜨기 전·밤엔 일출, 그 사이엔 노을
*/
kind: 'sunset' | 'sunrise';
/**
* Title
*
* 하늘이 어떻게 보일지 한 문장 (오늘 노을은 물들긴 하는데 색이 흐릴 거예요). 히어로 제목
*/
title: string;
/**
* Day
*/
@@ -2154,6 +2238,28 @@ export const SkyType = { /**
*/
export type SkyType = typeof SkyType[keyof typeof SkyType];
/**
* SlotPoint
*/
export type SlotPoint = {
/**
* Slot
*
* morning / day / evening / night
*/
slot: string;
/**
* Label
*
* 아침 / 낮 / 저녁 / 밤
*/
label: string;
/**
* Score
*/
score: number;
};
/**
* SlotTone
*/
@@ -2245,6 +2351,18 @@ export type SunsetSlide = {
* 하늘 상황. 앱이 카드 하늘 색을 고른다
*/
situation?: SkySituation | null;
/**
* Headline
*
* 결론 (나가 볼 만해요 · 애매해요 · 쉬어요). 카드 맨 위에 크게
*/
headline?: string | null;
/**
* Peak At
*
* 가장 붉을 때
*/
peak_at?: string | null;
};
/**
@@ -2311,6 +2429,28 @@ export type TopIndex = {
* Summary
*/
summary?: string | null;
/**
* Active
*
* 지금 구간이 이 각의 시간대와 겹침. false 면 순위 밖, score 는 하루 점수
*/
active?: boolean;
/**
* Slots
*
* 오늘 구간별 점수 {morning·day·evening·night: 점수}. 각 시간대와 안 겹치는 구간은 없음
*/
slots?: {
[key: string]: number;
};
/**
* Slot Ranks
*
* 오늘 구간별 순위 (점수 × 중요도 가중치). 각 시간대와 안 겹치는 구간은 없음
*/
slot_ranks?: {
[key: string]: number;
};
};
/**
@@ -2632,6 +2772,34 @@ export type WeekDay = {
* Rain Prob
*/
rain_prob?: number | null;
/**
* Gaks
*
* 그날 대표 각 (점수 × 중요도 순 3개). 각 점수가 아직 없는 날은 비어 있음
*/
gaks?: Array<WeekGak>;
};
/**
* WeekGak
*/
export type WeekGak = {
/**
* Index Id
*/
index_id: number;
/**
* Name
*/
name: string;
/**
* Icon
*/
icon: string;
/**
* Score
*/
score: number;
};
/**
@@ -2921,7 +3089,7 @@ export type ListIndicesData = {
/**
* Core
*
* 이번 계절 핵심 지수만
* 지금 제철인 각만
*/
core?: boolean;
};
+56 -4
View File
@@ -1,8 +1,10 @@
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
import { NavLink, Outlet, useLocation } from 'react-router'
import { useIsFetching, useQuery } from '@tanstack/react-query'
import { getSeasonWeekOptions } from '../api/client/@tanstack/react-query.gen'
import { SOCIAL } from '../lib/platform'
import { cx } from '../lib/utils'
import { kindOfHour, kst, type TimeKind } from './lib'
import { kindOfHour, kst, seasonOf, type TimeKind } from './lib'
import './b.css'
import { AuthProvider } from './auth'
import { RegionProvider } from './region'
@@ -12,7 +14,7 @@ import { useSheet } from './sheetContext'
import { SheetProvider } from './Sheets'
import { SkyContext, useSky } from './skyContext'
import { PinIcon, TabIcon } from './svg'
import { Avatar, Skel } from './ui'
import { Avatar, Ic, Skel } from './ui'
const TABS = [
{ to: '/sky', key: 'sky', label: '노을', title: '노을' },
@@ -23,6 +25,22 @@ const TABS = [
{ to: '/season', key: 'season', label: '계절·상식', title: '계절·상식' },
] as const
/** 로고 옆 계절 칩: 계절 이름과 지금 절기. 누르면 이번 주 절기 창. 좁은 화면에선 절기를 뺀다 */
function SeasonChip() {
const { open } = useSheet()
const week = useQuery(getSeasonWeekOptions())
const [month] = useState(() => kst(new Date()).mo)
const [name, icon] = seasonOf(month)
const term = week.data?.term_now?.name
return (
<button type="button" onClick={() => open({ type: 'seasonWeek' })} aria-label={`지금 ${name}${term ? `, ${term}` : ''}. 이번 주 절기 보기`} className="flex shrink-0 cursor-pointer items-center gap-1 rounded-full bg-white/70 py-1 pr-2.5 pl-1.5 text-[13px] font-extrabold whitespace-nowrap shadow-[0_4px_10px_rgb(40_48_74/0.06)]">
<Ic name={icon} className="size-[18px]" />
{name}
{term && <span className="hidden font-bold opacity-70 min-[400px]:inline">· {term}</span>}
</button>
)
}
function TopBar() {
const { pathname } = useLocation()
const { region, locateStatus } = useRegion()
@@ -32,7 +50,8 @@ function TopBar() {
return (
<header className="sticky top-0 z-20 flex h-[calc(54px+env(safe-area-inset-top,0px))] items-center justify-between gap-2.5 px-4 pt-[env(safe-area-inset-top,0px)]">
{tab?.title ? <h1 className="font-jua text-[22px] font-normal">{tab.title}</h1> : <h1 className="font-jua text-[25px] font-normal text-(--orange)">날씨각</h1>}
{tab?.title ? <h1 className="shrink-0 font-jua text-[22px] font-normal">{tab.title}</h1> : <h1 className="shrink-0 font-jua text-[25px] font-normal text-(--orange)">날씨각</h1>}
<SeasonChip />
<button
type="button"
onClick={() => open({ type: 'region' })}
@@ -152,6 +171,38 @@ const NOTCH_BG: Record<TimeKind, string> = {
night: '#0e1433',
}
/** 처음 들어올 때만: 첫 데이터를 다 받을 때까지 하늘 위에 캐릭터와 '날씨 불러오는 중…'. 한 번 사라지면 다시 안 뜬다 */
function FirstLoad() {
const fetching = useIsFetching()
const { kind } = useSky()
const [started, setStarted] = useState(false)
const [done, setDone] = useState(false)
const [gone, setGone] = useState(false)
// 받기 시작했다가 받는 게 없어지면 끝 (렌더 중에 바로 맞춘다)
if (fetching > 0 && !started) setStarted(true)
if (fetching === 0 && started && !done) setDone(true)
// 앱이 떴으니 index.html 의 첫 화면은 걷는다 (이 덮개가 이어받는다)
useEffect(() => document.getElementById('boot')?.remove(), [])
// 느린 망에서도 10초 넘게 막지 않는다 (그 뒤는 화면 안 스켈레톤이 맡는다)
useEffect(() => {
const id = setTimeout(() => setDone(true), 10000)
return () => clearTimeout(id)
}, [])
if (gone) return null
return (
<div
role="status"
aria-live="polite"
onTransitionEnd={() => done && setGone(true)}
className={cx('fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 backdrop-blur-[6px] transition-opacity duration-400', done && 'pointer-events-none opacity-0')}
style={{ backgroundColor: `color-mix(in srgb, ${NOTCH_BG[kind]} 72%, transparent)` }}
>
<Ic name={kind === 'night' ? 'bear' : 'rabbit'} className="b-hop w-[88px]" />
<p className="m-0 font-jua text-[19px]">날씨 불러오는 중…</p>
</div>
)
}
function Shell() {
const { pathname } = useLocation()
const { kind } = useSky()
@@ -165,6 +216,7 @@ function Shell() {
return (
<div className="min-h-dvh text-(--ink)">
<SkyBg />
<FirstLoad />
{/* 위·아래 바: 띠는 화면 끝까지, 내용은 가운데 440px 안 */}
<div className="b-topbg fixed inset-x-0 top-0 z-[19] h-[calc(54px+env(safe-area-inset-top,0px))] backdrop-blur-md" aria-hidden="true" />
<div className="fixed inset-x-0 top-0 z-[19] h-[env(safe-area-inset-top,0px)] transition-colors duration-1400" style={{ backgroundColor: NOTCH_BG[kind] }} aria-hidden="true" />
@@ -178,7 +230,7 @@ function Shell() {
t.key === 'today' ? (
// 메인 탭: 막대 위로 솟은 큰 주황 동그라미
<NavLink key={t.key} to={t.to} end className={({ isActive }) => cx('b-tab-main relative -mt-6 flex flex-col items-center gap-1 text-[12px] font-extrabold', isActive ? 'text-(--orange)' : 'text-(--ink3)')}>
<span className="grid size-[60px] place-items-center rounded-full bg-[linear-gradient(160deg,#ffb067,var(--orange)_55%,var(--orange-deep))] text-white shadow-[0_8px_18px_rgb(255_122_69/0.45),inset_0_-4px_0_rgb(0_0_0/0.12)] ring-4 ring-white/85 [&_svg]:stroke-[2.6]">
<span className="b-keep-bg grid size-[60px] place-items-center rounded-full bg-[linear-gradient(160deg,#ffb067,var(--orange)_55%,var(--orange-deep))] text-white shadow-[0_8px_18px_rgb(255_122_69/0.45),inset_0_-4px_0_rgb(0_0_0/0.12)] ring-4 ring-white/85 [&_svg]:stroke-[2.6]">
<TabIcon name={t.key} className="size-[30px]" />
</span>
{t.label}
+19 -14
View File
@@ -3,21 +3,22 @@ import { useQuery } from '@tanstack/react-query'
import { listArticlesOptions, listIndicesOptions } from '../api/client/@tanstack/react-query.gen'
import { ArticleCategory, IndexCategory } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { loadOf, MEDALS } from './lib'
import { kst, loadOf, MEDALS, seasonOf } from './lib'
import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
import { Chips, Ic, Sec, Skel, StateBox } from './ui'
type Cat = 'all' | 'out' | 'food' | 'home' | 'life' | 'core'
const CATS = [
// 마지막 칩은 지금 계절의 제철 각 (예: 가을 각)
const CATS: readonly (readonly [Cat, string])[] = [
['all', '전체'],
['out', '밖에서 놀기'],
['food', '먹고 마시기'],
['home', '집안일'],
['life', '생활 고민'],
['core', '가을 각'],
] as const
['core', `${seasonOf(kst(new Date()).mo)[0]} 각`],
]
const CAT_PARAM: Partial<Record<Cat, IndexCategory>> = { out: IndexCategory.OUTSIDE, food: IndexCategory.FOOD, home: IndexCategory.HOME, life: IndexCategory.LIFE }
@@ -26,11 +27,11 @@ const GRID_SKELS = Array.from({ length: 9 }, (_, i) => i)
/** 1~3위 받침대와 같은 칸(가운데가 높은 3칸)의 스켈레톤 */
function PodiumSkel() {
return (
<div className="grid grid-cols-[1fr_1.15fr_1fr] items-end gap-1.5 px-3 pt-3" aria-hidden="true">
<div className="grid grid-cols-[1fr_1.15fr_1fr] gap-1.5 px-3 pt-3" aria-hidden="true">
{[1, 0, 2].map((k) => (
<span key={k} className={cx('flex flex-col items-center rounded-3xl bg-white px-1.5 text-center shadow-[inset_0_-6px_0_var(--shade)]', k === 0 ? 'py-4' : 'py-3')}>
<span key={k} className={cx('flex flex-col items-center rounded-3xl bg-white px-1.5 text-center shadow-[inset_0_-6px_0_var(--shade)]', k === 0 ? 'py-4' : 'mt-6 py-3')}>
<Skel shape className={cx('aspect-square rounded-full', k === 0 ? 'w-20' : 'w-[62px]')} />
<b className="mt-1.5 font-jua text-base font-normal">
<b className="mt-1.5 flex flex-1 items-center font-jua text-base font-normal">
<Skel className="w-16" />
</b>
<em className="font-bagel text-[30px] leading-[1.05] not-italic">
@@ -90,7 +91,7 @@ export function GakPage() {
<StateBox load={load} onRetry={() => q.refetch()} empty="오늘 1~3위를 아직 못 정했어요." hold={<PodiumSkel />} className="inset-x-3 top-3 bottom-0" />
)
) : (
<div className={cx('grid grid-cols-[1fr_1.15fr_1fr] items-end gap-1.5 px-3 pt-3 transition-opacity', q.isPlaceholderData && 'opacity-60')}>
<div className={cx('grid grid-cols-[1fr_1.15fr_1fr] gap-1.5 px-3 pt-3 transition-opacity', q.isPlaceholderData && 'opacity-60')}>
{[1, 0, 2].map((k) => {
const g = top[k]
return (
@@ -98,13 +99,13 @@ export function GakPage() {
key={g.index_id}
type="button"
onClick={() => open({ type: 'gak', indexId: g.index_id })}
className={cx('flex cursor-pointer flex-col items-center rounded-3xl px-1.5 text-center shadow-[inset_0_-6px_0_var(--shade)]', k === 0 ? 'bg-[linear-gradient(180deg,#fff1c4,#fff)] py-4' : 'bg-white py-3')}
className={cx('flex cursor-pointer flex-col items-center rounded-3xl px-1.5 text-center shadow-[inset_0_-6px_0_var(--shade)]', k === 0 ? 'bg-[linear-gradient(180deg,#fff1c4,#fff)] py-4' : 'mt-6 bg-white py-3')}
>
<span className="relative">
<Ic name={g.icon} className={cx('drop-shadow-[0_10px_12px_rgb(40_48_74/0.15)]', k === 0 ? 'w-20' : 'w-[62px]')} />
<Ic name={MEDALS[k]} className="absolute -top-1.5 -left-3 w-7" />
</span>
<b className="mt-1.5 font-jua text-base font-normal">
<b className="mt-1.5 flex flex-1 items-center font-jua text-base font-normal">
{k + 1}위 {g.name}
</b>
<em className="font-bagel text-[30px] leading-[1.05] text-(--orange) not-italic">{g.score}</em>
@@ -124,12 +125,16 @@ export function GakPage() {
<div className={cx('grid grid-cols-3 gap-2 p-3 transition-opacity', q.isPlaceholderData && 'opacity-60')}>
{items.map((g) => {
return (
<button key={g.index_id} type="button" onClick={() => open({ type: 'gak', indexId: g.index_id })} aria-label={`${g.rank}위 ${g.name} ${g.score}점`} className="relative flex cursor-pointer flex-col items-center rounded-[22px] bg-white px-1.5 pt-3 pb-2.5 shadow-[inset_0_-5px_0_var(--shade)]">
<span className="absolute top-[7px] left-[9px] font-jua text-[13px] text-(--ink3)">{g.rank}</span>
{g.is_core && <span className="absolute top-2 right-2 text-[10.5px] font-extrabold text-[#1f9d62]">가을</span>}
<button key={g.index_id} type="button" onClick={() => open({ type: 'gak', indexId: g.index_id })} aria-label={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, ${g.in_season === false ? '제철 아님' : '지금 시간대 아님'}`} className={cx('relative flex cursor-pointer flex-col items-center rounded-[22px] bg-white px-1.5 pt-3 pb-2.5 shadow-[inset_0_-5px_0_var(--shade)]', !g.active && 'opacity-55')}>
{g.active && <span className="absolute top-[7px] left-[9px] font-jua text-[13px] text-(--ink3)">{g.rank}</span>}
{g.season && <span className="absolute top-2 right-2 text-[10.5px] font-extrabold text-[#1f9d62]">{g.season}</span>}
<Ic name={g.icon} className="w-[50px]" />
<b className="mt-1 font-jua text-[15px] font-normal">{g.name}</b>
<em className={cx('font-bagel text-[22px] leading-[1.1] not-italic', g.score < 50 ? 'text-(--ink3)' : 'text-(--orange)')}>{g.score}</em>
{g.active ? (
<em className={cx('font-bagel text-[22px] leading-[1.1] not-italic', g.score < 50 ? 'text-(--ink3)' : 'text-(--orange)')}>{g.score}</em>
) : (
<small className="py-1 text-[12px] leading-[1.1] font-extrabold text-(--ink3)">{g.in_season === false ? '제철 아님' : '지금 아님'}</small>
)}
</button>
)
})}
+18 -6
View File
@@ -131,10 +131,9 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
return (
<div className={cx(slideBase, slide.situation ? `b-sit-${slide.situation}` : 'b-bg-dusk')}>
<Eyebrow>{slide.eyebrow}</Eyebrow>
<Big>
<Lines text={slide.line} />
</Big>
<small className="mt-1 text-[12.5px] font-bold opacity-85">노을 점수 {slide.score}</small>
{/* 노을 탭 히어로와 같은 순서: 결론 → 가장 붉을 때 → 쉬운 이유. 점수는 노을 탭 '자세히'에 */}
<Big>{slide.headline ?? slide.grade_label}</Big>
{slide.line && <p className="m-0 mt-0.5 font-jua text-[18px]">{slide.line}</p>}
<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)}`)}>
@@ -154,7 +153,8 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
<Big>
<Lines text={slide.line} />
</Big>
<div className="mt-auto grid grid-cols-2 gap-2.5">
{/* 칸은 제목 바로 아래, 팁만 맨 아래로. 칸을 바닥에 붙이면 가운데가 비어 덜 그려진 화면처럼 보인다 */}
<div className="mt-4 grid grid-cols-2 gap-2.5">
{slide.days.map((d) => (
<div key={d.day} className="flex flex-col gap-0.5 rounded-[18px] bg-white/85 px-3 py-2.5 shadow-[inset_0_-5px_0_rgb(217_229_244/0.9)]">
<Ic name={d.icon} className="w-[34px]" />
@@ -167,10 +167,22 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
<small className="text-xs font-bold text-(--ink2)">
비 {d.rain_prob ?? '?'}%{d.temp_min_c != null && d.temp_max_c != null && ` · 일교차 ${Math.round(d.temp_max_c - d.temp_min_c)}°`}
</small>
{d.gaks && d.gaks.length > 0 && (
<ul className="mt-2 flex flex-col gap-1.5 border-t border-[rgb(217_229_244)] pt-2" aria-label={`${d.weekday}요일 대표 각`}>
<li className="text-[11px] font-extrabold text-(--ink2)">이날 할 만한 각</li>
{d.gaks.map((g) => (
<li key={g.index_id} className="flex items-center gap-1.5">
<Ic name={g.icon} className="w-[26px] shrink-0" />
<span className="min-w-0 flex-1 truncate text-[14px] font-bold">{g.name}</span>
<em className="font-bagel text-[16px] text-(--orange) not-italic">{g.score}</em>
</li>
))}
</ul>
)}
</div>
))}
</div>
{slide.tip && <p className="mt-3 rounded-[14px] bg-(--ink) px-3 py-2.5 text-[13px] leading-snug font-bold text-white">{slide.tip}</p>}
{slide.tip && <p className="mt-auto rounded-[14px] bg-(--ink) px-3 py-2.5 text-[13px] leading-snug font-bold text-white">{slide.tip}</p>}
</div>
)
if (slide.kind === 'plan') {
+22 -2
View File
@@ -158,6 +158,8 @@ function Swap({ labels, at }: { labels: readonly ReactNode[]; at: number }) {
/* ---------- 시트 스켈레톤: 완료 화면과 같은 틀·같은 줄 높이 ---------- */
const N3 = [0, 1, 2]
const N4 = [0, 1, 2, 3]
const SLOT_KEYS = ['morning', 'day', 'evening', 'night'] as const
const SLOT_NAMES = { morning: '아침', day: '낮', evening: '저녁', night: '밤' } as const
const N6 = [0, 1, 2, 3, 4, 5]
const N14 = Array.from({ length: 14 }, (_, i) => i)
@@ -349,8 +351,9 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
<h4 className="m-0 font-jua text-[22px] font-normal">{g.name}</h4>
{d.description && <p className="mt-0.5 text-[13.5px] font-semibold text-(--ink2)">{d.description}</p>}
</div>
<b className="ml-auto font-bagel text-[42px] font-normal text-(--orange)">{g.score}</b>
<b className={cx('ml-auto font-bagel text-[42px] font-normal', g.active ? 'text-(--orange)' : 'text-(--ink3)')}>{g.score}</b>
</div>
{!g.active && <p className="mt-2 text-[13px] font-bold text-(--ink2)">지금 시간대엔 해당 없어요. 점수는 오늘 가장 좋은 시간대 기준이에요.</p>}
{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>
@@ -358,6 +361,23 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
</p>
)}
{factors.length > 2 && <Radar name={g.name} factors={factors} />}
{g.slots && g.slots.length > 0 && (
<div className="mt-2.5 grid grid-cols-4 gap-1.5" aria-label="오늘 시간대별 점수">
{SLOT_KEYS.map((k) => {
const s = g.slots?.find((x) => x.slot === k)
const cur = g.active && g.slot === k
return (
<div key={k} className={cx('rounded-2xl px-1 py-2 text-center', cur ? 'bg-[#fff4ec]' : 'bg-[#f3f6fb]')}>
<small className="block text-xs font-extrabold text-(--ink2)">
{SLOT_NAMES[k]}
{cur && ' · 지금'}
</small>
<b className={cx('block font-bagel text-xl font-normal', s ? 'text-(--orange)' : 'text-(--ink3)')}>{s ? s.score : '–'}</b>
</div>
)
})}
</div>
)}
{g.trend && g.trend.length > 0 && (
<div className="mt-2.5 grid grid-cols-4 gap-1.5">
{g.trend.map((t) => (
@@ -386,7 +406,7 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string)
<div key={f.axis} className="grid grid-cols-[84px_1fr_52px] items-center gap-x-2.5 text-[13.5px] font-bold">
<span>{f.label}</span>
<i className="block h-[9px] overflow-hidden rounded-full bg-[#e3eaf4]">
<s className="block h-full bg-[linear-gradient(90deg,#ffc86e,var(--orange))]" style={{ width: `${f.value}%` }} />
<s className="b-keep-bg block h-full bg-[linear-gradient(90deg,#ffc86e,var(--orange))]" style={{ width: `${f.value}%` }} />
</i>
<em className="text-right text-xs text-(--ink2) not-italic">비중 {f.weight}%</em>
<p className="col-start-2 col-end-4 -mt-0.5 text-[12.5px] font-semibold text-(--ink2)">{f.note}</p>
+96 -43
View File
@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { useState, type ReactNode } from 'react'
import { getSkyOptions, getSkyRankingOptions } from '../api/client/@tanstack/react-query.gen'
import type { BestTime, SkyPlanData } from '../api/client/types.gen'
import { cx } from '../lib/utils'
@@ -31,48 +31,104 @@ function LiSkel({ ghost = false }: { ghost?: boolean }) {
// 다른 탭 히어로보다 짧게. 배경은 하늘 상황별 색(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, sunset }: { plan?: SkyPlanData; sunset?: string }) {
/** 점수 등급별 하늘색: 히어로 배경과 3일 타일이 같은 색. b-keep-bg 는 밤 화면에서도 이 색을 지킨다 */
const GRADE_SKY: Record<string, { hero: string; tile: string }> = {
잿빛: { hero: 'b-keep-bg bg-[linear-gradient(180deg,#6f7690,#9aa0b4_55%,#b9b4c0)]', tile: 'b-keep-bg bg-[linear-gradient(160deg,#8f8aa5,#b9b0bf)]' },
은은함: { hero: 'b-keep-bg bg-[linear-gradient(180deg,#4b5aa8,#7f86c6_40%,#e9b9a8_78%,#ffb27a)]', tile: 'b-keep-bg bg-[linear-gradient(160deg,#7f86c6,#e9b9a8_70%,#f6b07a)]' },
고움: { hero: 'b-keep-bg bg-[linear-gradient(180deg,#5b3f9e,#c2559a_45%,#ff7a6a_78%,#ffb35c)]', tile: 'b-keep-bg bg-[linear-gradient(160deg,#5b3f9e,#c2559a_55%,#ff7a6a)]' },
붉음: { hero: 'b-keep-bg bg-[linear-gradient(180deg,#4a2a8a,#b0306a_40%,#ff4a3a_72%,#ff9a3c)]', tile: 'b-keep-bg bg-[linear-gradient(160deg,#4a2a8a,#b0306a_50%,#ff4a3a)]' },
}
const skyOf = (p?: SkyPlanData) => GRADE_SKY[p?.grade_label ?? ''] ?? GRADE_SKY['은은함']
/** 히어로엔 답만: 등급에 따라 노을 피크 시각과 어떻게 물드는지, 잿빛이면 왜 안 보이는지 */
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(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>
<p className="m-0 font-jua text-[28px] leading-tight text-balance">{v(plan?.title, 'w-[230px]')}</p>
{(!plan || plan.situation_label) && <p className="m-0 mt-1.5 text-[15px] font-bold">{v(plan?.situation_label, 'w-[180px]')}</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}개가 같은 예보` : ''
/** 오늘·내일·모레를 그날 예상 하늘색 타일로. 누르면 그날로 */
function DayTiles({ plans, day, onPick }: { plans: SkyPlanData[]; day?: string; onPick: (day: string) => void }) {
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]')}
<div className="mx-3 mt-2.5 grid grid-cols-3 gap-2">
{plans.map((p) => (
<button
key={p.day}
type="button"
aria-pressed={p.day === day}
onClick={() => onPick(p.day)}
className={cx(
'grid cursor-pointer gap-px rounded-2xl px-2.5 pt-2 pb-2.5 text-left text-white [text-shadow:0_1px_4px_rgb(40_20_50/0.35)]',
skyOf(p).tile,
p.day === day && 'outline-[3px] outline-offset-2 outline-(--ink) outline-solid',
)}
>
<small className="text-[11.5px] font-extrabold">{p.when}</small>
<b className="font-jua text-lg leading-tight font-normal">{p.best_at ? clockShort(p.best_at) : '–'}</b>
<span className="text-[11.5px] font-bold">
{p.grade_label} {p.score}
</span>
</button>
))}
</div>
)
}
/** 노을 점수 뜻. 지금 하늘이 아니라 해 질(뜰) 무렵 예보라는 것도 */
function ScoreHelp({ plan }: { plan: SkyPlanData }) {
const sunAt = plan.timeline?.find((t) => t.kind === 'sun')?.at
return (
<details className="mx-3 mt-1.5 px-1 text-[12px] font-bold text-(--ink2)">
<summary className="flex cursor-pointer list-none items-center justify-between [&::-webkit-details-marker]:hidden">
노을 점수 100점 만점 · 높을수록 붉어요
<span className="grid size-[18px] place-items-center rounded-full bg-white/80 text-[11px] font-extrabold">?</span>
</summary>
<p className="m-0 mt-1.5 rounded-xl bg-white/70 px-2.5 py-2 leading-snug font-semibold">
80점 넘으면 붉게, 60점 넘으면 곱게, 40점 넘으면 은은하게 물들어요.
{sunAt && ` 해 ${plan.kind === 'sunrise' ? '뜰' : '질'} 무렵(${new Date(sunAt).getHours()}시) 날씨 예보로 계산했고, 노을 피크 시각은 해 ${plan.kind === 'sunrise' ? '뜨기 10~20분 전' : '지고 10~20분 뒤'}로 어림한 거라 실제와 다를 수 있어요.`}
</p>
<small className="mt-1 block text-[12px] font-bold text-(--ink2)">{v(plan && [agree, `노을 점수 ${plan.score}`].filter(Boolean).join(' · '), 'w-48')}</small>
</div>
</details>
)
}
/** 골든아워 → 해 짐 → 블루아워 */
function Timeline({ rows }: { rows?: BestTime[] }) {
/** 언제 보면 좋을까: 왼쪽 세로 줄 색이 그 시각 하늘색, 노을 피크만 강조. 용어 뜻은 ?를 눌러야 */
function Timeline({ rows, kind = 'sunset' }: { rows?: BestTime[]; kind?: SkyPlanData['kind'] }) {
const rail = kind === 'sunrise' ? 'bg-[linear-gradient(180deg,#2d3f8f,#8c5aa6_25%,#e8506a_45%,#f6844e_60%,#f2b84b)]' : 'bg-[linear-gradient(180deg,#f2b84b,#f6844e_45%,#e8506a_62%,#8c5aa6_82%,#2d3f8f)]'
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" />
{(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>
<div className="mx-3 mt-3 rounded-[22px] bg-white px-4 pt-3.5 pb-3 shadow-[inset_0_-5px_0_var(--shade)]" aria-hidden={rows ? undefined : true}>
<div className="grid grid-cols-[12px_1fr] gap-x-3">
<span className={cx('row-span-4 rounded-full', rail)} aria-hidden="true" />
{(rows ?? FOUR.map(() => undefined)).map((t, i) => (
<p
key={t?.kind ?? i}
className={cx('m-0 flex items-baseline gap-2.5 py-1.5', t?.kind === 'peak' ? '-mx-1.5 my-0.5 rounded-xl bg-[#fff1f2] px-2.5 py-2' : 'border-b border-(--line) last:border-b-0')}
>
<b className={cx('min-w-[96px] font-jua font-normal tabular-nums', t?.kind === 'peak' ? 'text-[20px] text-[#d23d5a]' : 'text-[17px]')}>
{t ? (t.end ? `${clockShort(t.at)}~${clockShort(t.end)}` : clockShort(t.at)) : <Skel className="w-11" />}
</b>
<span className={cx(t?.kind === 'peak' ? 'font-jua text-base text-[#d23d5a]' : 'text-[13.5px] font-bold text-(--ink2)')}>{t ? t.label : <Skel className="w-20" />}</span>
</p>
))}
</ol>
</div>
{rows && (
<details className="mt-2 text-[12px] text-(--ink2)">
<summary className="inline-flex cursor-pointer list-none items-center gap-1.5 font-bold [&::-webkit-details-marker]:hidden">
<span className="grid size-[18px] place-items-center rounded-full bg-[#f1ebe3] text-[11px] font-extrabold">?</span>골든아워·블루아워가 뭐예요
</summary>
<p className="m-0 mt-1.5 rounded-xl bg-[#faf6f1] px-2.5 py-2 leading-snug">
<b className="text-(--ink)">골든아워</b> 해가 {kind === 'sunrise' ? '뜬 뒤' : '지기 전'}, 햇빛이 금빛으로 물드는 시간
<br />
<b className="text-(--ink)">블루아워</b> 해가 {kind === 'sunrise' ? '뜨기 전' : '진 뒤'}, 하늘이 짙은 파랑으로 남는 시간
</p>
</details>
)}
</div>
)
}
@@ -121,39 +177,36 @@ export function SkyPage() {
const ranking = useQuery(getSkyRankingOptions())
const load = loadOf(sky)
const rankLoad = loadOf(ranking)
const plan = sky.data?.plan ?? undefined
const plans = sky.data?.plans ?? []
const [picked, setPicked] = useState<string>()
// 타일을 누르면 그날, 아니면 다음에 오는 날
const plan = plans.find((p) => p.day === picked) ?? sky.data?.plan ?? undefined
const spots = (sky.data?.spots ?? []).slice(0, 3)
const items = (ranking.data?.items ?? []).slice(0, 8)
const target = sky.data?.days?.find((d) => d.day === plan?.day)
const sunset = plan?.timeline?.find((t) => t.kind === 'sun')?.at
const rise = plan?.kind === 'sunrise'
return (
<section aria-label="노을" aria-busy={load === 'loading'} className={cx('transition-opacity', sky.isPlaceholderData && 'opacity-60')}>
{/* 히어로 상자는 불러오는 중·실패·빈 값 모두 같은 크기 */}
<div className={cx(HERO, `b-sit-${target?.situation ?? 3}`)}>
<div className={cx(HERO, skyOf(plan).hero)}>
<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} sunset={sunset} />
<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} />}
<Sec title="언제 보면 좋을까" sub="보통 해 진 뒤 10~20분이 가장 붉어요" />
{plans.length > 1 && <DayTiles plans={plans} day={plan?.day} onPick={setPicked} />}
{plan && <ScoreHelp plan={plan} />}
<Sec title="언제 보면 좋을까" />
{plan?.timeline?.length || load === 'loading' ? (
<Timeline rows={plan?.timeline} />
<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>}
<Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />
{spots.length ? (
{!rise && <Sec title="가까운 노을 명소" sub="가까운 순 · 방향은 내 동네에서 본 쪽" />}
{rise ? null : spots.length ? (
<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} />
+135 -82
View File
@@ -2,7 +2,7 @@ import { Fragment, useEffect, useState, type ReactNode } from 'react'
import { Link } from 'react-router'
import { useQuery } from '@tanstack/react-query'
import { getFeedOptions, getWeatherTodayOptions } from '../api/client/@tanstack/react-query.gen'
import type { BandArticle, BandEvent, Hero as HeroData, HeroStat as HeroStatData, ResWeatherToday, TopIndex } from '../api/client/types.gen'
import { RainType, Sky, type BandArticle, type BandEvent, type Hero as HeroData, type ResWeatherToday, type TopIndex, type WeatherSlot } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { cardBg, fall, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEKDAYS } from './lib'
import { PostCard, PostCardSkel } from './Post'
@@ -10,28 +10,22 @@ import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
import { useSky } from './skyContext'
import { Ic, Rail, Sec, Skel, SkelRail, StateBox, Thumb } from './ui'
import { deg, skyText, slotAt } from './weatherText'
import { deg, slotAt } from './weatherText'
type Mode = 'now' | TimeKind
const MODES: [Mode, string][] = [
['now', '지금'],
['morning', '아침'],
['day', '낮'],
['sunset', '저녁'],
['night', '밤'],
]
// 미리보기 시간대마다 보여 줄 시계와 그 시각의 예보 칸
const PREVIEW: Record<TimeKind, { label: string; clock: string; hour: number }> = {
morning: { label: '아침', clock: '07:40', hour: 7 },
day: { label: '낮', clock: '13:20', hour: 13 },
sunset: { label: '저녁', clock: '18:25', hour: 18 },
night: { label: '밤', clock: '22:10', hour: 22 },
// 하루 흐름 칸 순서와 칸마다 볼 예보 시각
const KINDS: TimeKind[] = ['morning', 'day', 'sunset', 'night']
const PREVIEW: Record<TimeKind, { label: string; hour: number }> = {
morning: { label: '아침', hour: 7 },
day: { label: '낮', hour: 13 },
sunset: { label: '저녁', hour: 18 },
night: { label: '밤', hour: 22 },
}
// 히어로 칸을 받아 오는 동안 자리만 잡아 둔다
const STAT_HOLD = ['a', 'b']
// 비·눈 줄기: 위치·주기를 엇갈려 고르게
const DROPS = Array.from({ length: 22 }, (_, i) => ({ left: `${(i * 41) % 100}%`, '--top': `${(i * 29) % 90}%`, '--dl': `${((i * 37) % 100) / 100}s`, '--dur': `${0.55 + ((i * 13) % 5) / 10}s` }))
const FLAKES = Array.from({ length: 16 }, (_, i) => ({ left: `${(i * 47) % 100}%`, '--top': `${(i * 31) % 90}%`, '--dl': `${((i * 53) % 100) / 25}s`, '--dur': `${3.2 + ((i * 7) % 5) / 2}s` }))
const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }))
// 별똥별 셋: 위치·길이·주기를 엇갈려 하나씩 떨어지게
@@ -70,33 +64,82 @@ function heroVal(load: Load, v: ReactNode, skel: string) {
const failed = (load: Load) => load === 'error' || load === 'retrying'
type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; feedLoad: Load; todayLoad: Load }
// 미리보기 탭과 서버 구간 이름. 저녁 탭(노을 하늘)은 서버의 evening 구간
const SLOT_KEY: Record<TimeKind, string> = { morning: 'morning', day: 'day', sunset: 'evening', night: 'night' }
function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
/** 미리보기 시간대면 이미 받은 구간 점수·순위로 다시 줄 세운다. 그 구간과 안 겹치는 각은 흐리게 끝으로. 구간 값이 없으면(예전 캐시) 그대로 */
function atSlot(items: TopIndex[], kind: TimeKind | null): TopIndex[] {
const k = kind && SLOT_KEY[kind]
if (!k || !items.some((g) => Object.keys(g.slot_ranks ?? {}).length)) return items
const on = items.filter((g) => g.slot_ranks?.[k] != null && g.slots?.[k] != null)
return [
...on.map((g) => ({ ...g, score: g.slots![k], rank: g.slot_ranks![k], active: true })).sort((a, b) => a.rank - b.rank),
...items.filter((g) => !on.includes(g)).map((g) => ({ ...g, active: false })),
]
}
type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; feedLoad: Load; todayLoad: Load }
type Weather = 'clear' | 'partly' | 'cloudy' | 'rain' | 'snow' | 'sleet'
/** 예보 칸 하나의 하늘: 비·눈이 오면 그걸, 아니면 구름 양 */
function weatherOf(slot?: WeatherSlot): Weather {
const r = slot?.rain_type
if (r === RainType.RAIN || r === RainType.SHOWER) return 'rain'
if (r === RainType.SNOW) return 'snow'
if (r === RainType.SLEET) return 'sleet'
return slot?.sky === Sky.CLOUDY ? 'cloudy' : slot?.sky === Sky.PARTLY ? 'partly' : 'clear'
}
const WEATHER_ICON: Record<Weather, string> = { clear: 'sun', partly: 'sun_cloud', cloudy: 'cloud', rain: 'rain', snow: 'snow', sleet: 'snow' }
// 구름 수: 구름 많음 둘, 흐림·비·눈 셋
const CLOUDS = [
{ cls: 'top-9 left-[5%] h-8 w-[84px]', d: '.1s', f: '6s' },
{ cls: 'top-[96px] left-[63%] h-9 w-[96px]', d: '.25s', f: '6.4s' },
{ cls: 'top-[30px] left-[72%] h-7 w-[64px]', d: '.4s', f: '5.4s' },
]
const CLOUD_N: Record<Weather, number> = { clear: 0, partly: 2, cloudy: 3, rain: 3, snow: 3, sleet: 3 }
function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) {
const { open } = useSheet()
const { preview, setServerKind, setPreview } = useSky()
const mode: Mode = preview ?? 'now'
const setMode = (m: Mode) => setPreview(m === 'now' ? null : m)
const clock = useNow()
const t = kst(clock)
const kind = mode === 'now' ? (hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)) : mode
const nowKind = hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)
const kind = mode === 'now' ? nowKind : mode
// 화면 전체 하늘 배경도 같은 시간대로 맞춘다
useEffect(() => setServerKind(hero?.sky_mode ?? null), [hero?.sky_mode, setServerKind])
const slots = today?.slots ?? []
const slot = slots.length ? slotAt(slots, mode === 'now' ? t.h : PREVIEW[mode].hour) : undefined
// 지금은 /v1/feed hero 값을, 미리보기는 그 시각의 예보 칸을 쓴다
const temp = mode === 'now' && hero ? hero.temp_c : slot?.temp_c
const top1 = hero?.top1
const who = kind === 'night' ? 'bear' : 'rabbit'
// 그 시각 칸, 비어 있으면(지난 새벽 칸 등) 그 뒤 첫 예보 칸
// 지금은 가장 가까운 3시간 칸(17시면 18시 칸). 시간대는 그 시각 칸, 비어 있으면(지난 새벽 칸 등) 그 뒤 첫 예보 칸
const slotOf = (k: TimeKind | 'now') => {
if (k === 'now') {
const known = slots.filter((x) => x.temp_c != null)
const at = t.h + t.mi / 60
return known.length ? known.reduce((a, b) => (Math.abs(kst(b.at).h - at) < Math.abs(kst(a.at).h - at) ? b : a)) : undefined
}
const h = PREVIEW[k].hour
const s = slots.length ? slotAt(slots, h) : undefined
return s?.temp_c != null ? s : (slots.find((x) => kst(x.at).h > h && x.temp_c != null) ?? s)
}
const weather = weatherOf(slotOf(mode))
const slotScore = mode === 'now' ? undefined : hero?.weather_slots?.[SLOT_KEY[mode]]
const score = slotScore ?? hero?.weather_score
const slotTop = mode === 'now' ? undefined : ranked.find((g) => g.active)
const top1 = slotTop ?? hero?.top1
// 저녁(노을)부터는 가운데 동그라미가 오늘 밤 달 모양이 된다
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 tempChip = temp != null ? `${deg(temp)}${slot ? ` ${skyText(slot)}` : ''}` : null
const bubble = hero ? (hero.bubble ?? '오늘은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
// 말풍선 머리말은 칸 이름 그대로: 지금은 / 아침은 / 낮은 / 저녁은 / 밤은
const when = mode === 'now' || mode === nowKind ? '지금' : PREVIEW[mode].label
const bubble = slotTop ? (slotTop.score >= 70 ? `${when}은 ${slotTop.name}!` : `${when}은 쉬어 가요`) : hero ? (hero.bubble ?? '지금은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
const status = hero?.status ?? []
const rain = weather === 'rain' || weather === 'sleet'
const snow = weather === 'snow' || weather === 'sleet'
// 시안 A: 점수 해가 주인공. 위에 시간대 탭과 날짜, 가운데 큰 해, 아래 칩 한 줄과 캐릭터 말풍선(1위 각)
// 시안 D4-2: 가운데 해(점수)와 하늘 날씨, 결론 두 줄, 상태 한 줄, 아래 하루 흐름 칸(누르면 그 시간대 하늘로)
return (
<div className="b-hero relative mx-3 mt-1 overflow-hidden rounded-[28px] px-4 pt-3 pb-3" data-t={kind}>
<div className="b-hero relative mx-3 mt-1 overflow-hidden rounded-[28px] px-4 pt-3 pb-3" data-t={kind} data-sky={weather}>
<div className="b-stars pointer-events-none absolute inset-0" aria-hidden="true">
{STARS.map((s, i) => (
<i key={i} className="absolute size-[3px] rounded-full shadow-[0_0_6px_#fff]" style={s} />
@@ -105,19 +148,20 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
<span key={i} className="b-shoot" style={s} />
))}
</div>
<div className="relative z-[3] grid grid-cols-5 rounded-full bg-white/45 p-1" role="tablist" aria-label="시간대 배경 미리보기">
{MODES.map(([m, l]) => (
<button key={m} type="button" role="tab" aria-selected={mode === m} onClick={() => setMode(m)} className={cx('cursor-pointer rounded-full py-[5px] text-[13px] font-bold', mode === m ? 'bg-white text-(--ink) shadow-[0_2px_6px_rgb(40_48_74/0.12)]' : 'text-(--ink) opacity-70')}>
{l}
</button>
))}
</div>
<p className="relative z-[3] mt-2 mb-0 text-[14px] font-bold opacity-90">
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]} · <b className="font-bagel text-[19px] font-normal">{mode === 'now' ? `${String(t.h).padStart(2, '0')}:${String(t.mi).padStart(2, '0')}` : PREVIEW[mode].clock}</b>
{(rain || snow) && (
<div className="pointer-events-none absolute inset-0 z-[2]" aria-hidden="true">
{rain && DROPS.map((s, i) => <i key={i} className="b-drop" style={s} />)}
{snow && FLAKES.map((s, i) => <i key={i} className="b-flake" style={s} />)}
</div>
)}
<p className="relative z-[3] m-0 text-[14px] font-bold opacity-80">
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일
</p>
<div className="relative h-[196px]">
<span className="b-cloud b-fall top-3 left-[4%] h-8 w-[84px]" style={fall('.1s', '6s')} aria-hidden="true" />
<div className="b-sun b-fall absolute top-2 left-1/2 -ml-[90px] grid aspect-square w-[180px] place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
<div className="relative h-[146px]">
{CLOUDS.slice(0, CLOUD_N[weather]).map((c) => (
<span key={c.cls} className={cx('b-cloud b-fall z-[1]', c.cls)} style={fall(c.d, c.f)} aria-hidden="true" />
))}
<div className="b-sun b-fall absolute top-2 left-1/2 -ml-16 grid aspect-square w-32 place-items-center rounded-full text-center" style={fall('0s', '5.6s', '8px')}>
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
{moon && (
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
@@ -125,49 +169,52 @@ function Hero({ hero, today, feedLoad, todayLoad }: HeroProps) {
</svg>
)}
<span className={cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')}>
<small className="block font-jua text-[13px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : '오늘 날씨 점수'}</small>
<b className="block font-bagel text-[74px] leading-[0.95] font-normal">{heroVal(feedLoad, hero?.weather_score, 'w-[120px]')}</b>
<small className="block font-jua text-[12px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : `${slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}</small>
<b className="block font-bagel text-[52px] leading-[0.95] font-normal">{heroVal(feedLoad, score, 'w-[84px]')}</b>
</span>
</div>
<span className="b-cloud b-fall top-[140px] left-[58%] h-9 w-[96px]" style={fall('.25s', '6.4s')} aria-hidden="true" />
</div>
{/* 기온 + 서버가 고른 챙길 것(비·미세먼지·자외선·일교차 등)을 한 줄 세 칸으로. 휴대폰에서 두 줄로 넘치지 않게 칸 안에서 위아래로 */}
<div className="relative z-[3] mt-1 grid auto-cols-fr grid-flow-col gap-1.5">
<Stat label={mode === 'now' ? '지금' : PREVIEW[mode].label}>{heroVal(tempLoad, tempChip, 'w-12')}</Stat>
{hero?.stats?.length
? hero.stats.map((s) => (
<Stat key={s.label} label={s.label} tone={s.tone}>
{s.value}
</Stat>
))
: feedLoad === 'loading' && STAT_HOLD.map((k) => <Stat key={k} label="">{heroVal(feedLoad, null, 'w-12')}</Stat>)}
</div>
<div className="relative z-[3] mt-2 flex items-center gap-2">
<Ic name={who} alt={who === 'rabbit' ? '토끼' : '곰'} className="w-[44px] shrink-0 drop-shadow-[0_8px_10px_rgb(40_48_74/0.15)]" />
<div className="relative z-[3] text-center">
{top1 ? (
<button type="button" onClick={() => open({ type: 'gak', indexId: top1.index_id })} aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`} className="b-bubble flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-[18px] px-3 py-2 text-left">
<span className="min-w-0 flex-1 truncate font-jua text-[16px]">{bubble}</span>
<Ic name={top1.icon} className="w-7 shrink-0" />
<em className="font-bagel text-[17px] text-(--orange) not-italic">{top1.score}</em>
<button type="button" onClick={() => open({ type: 'gak', indexId: top1.index_id })} aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`} className="cursor-pointer font-jua text-[24px] leading-tight">
{bubble}
</button>
) : (
<span className="b-bubble min-w-0 flex-1 rounded-[18px] px-3 py-2 font-jua text-[16px]">{bubble ?? <Skel className="w-[120px]" />}</span>
<p className="m-0 font-jua text-[24px] leading-tight">{bubble ?? <Skel className="w-[160px]" />}</p>
)}
<p className="m-0 mt-0.5 text-[15px] font-bold opacity-80">{top1?.summary ?? (feedLoad === 'loading' ? <Skel className="w-[140px]" /> : null)}</p>
{/* 상태 한 줄: 습도·불쾌지수·자외선·미세먼지 단계 이름. 조심할 것만 색 */}
{status.length > 0 && (
<p className="m-0 mt-1.5 flex flex-wrap justify-center gap-x-1.5 font-jua text-[14px]">
{status.map((x, i) => (
<Fragment key={x.label}>
{i > 0 && <span className="opacity-30" aria-hidden="true">·</span>}
<span className={cx('whitespace-nowrap', x.tone === 'warn' && 'b-warn')}>
<span className={cx(x.tone !== 'warn' && 'opacity-75')}>{x.label}</span> <b className="font-normal">{x.value}</b>
</span>
</Fragment>
))}
</p>
)}
</div>
<div className="b-strip relative z-[3] mt-2.5 grid grid-cols-4 gap-1 rounded-[18px] p-[3px]" role="tablist" aria-label="하루 흐름, 누르면 그 시간대 하늘로">
{KINDS.map((k) => {
const isNow = k === nowKind
const s = slotOf(isNow ? 'now' : k)
const on = k === kind
return (
<button key={k} type="button" role="tab" aria-selected={on} onClick={() => setPreview(isNow ? null : k)} className={cx('flex cursor-pointer flex-col items-center rounded-[14px] py-1.5', on && 'b-strip-on')}>
<span className={cx('text-[13px] font-bold', on ? 'text-(--orange-deep)' : 'opacity-75')}>{isNow ? '지금' : PREVIEW[k].label}</span>
<Ic name={k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)]} className="my-0.5 h-[22px] w-[22px] object-contain" />
<b className="font-jua text-[15px] font-normal">{heroVal(todayLoad, s?.temp_c != null ? deg(s.temp_c) : null, 'w-7')}</b>
</button>
)
})}
</div>
</div>
)
}
/** 히어로 아래 한 칸: 작은 이름 위, 값 아래. tone 은 서버가 정한 상태(비·경고)로 색을 바꾼다 */
function Stat({ label, tone = 'normal', children }: { label: string; tone?: HeroStatData['tone']; children: ReactNode }) {
return (
<span className="b-stat flex min-w-0 flex-col items-center rounded-2xl px-1.5 pt-1.5 pb-2 text-center break-keep" data-tone={tone}>
<small className="text-[11.5px] font-bold opacity-75">{label}</small>
<b className="font-jua text-[14.5px] leading-tight font-normal">{children}</b>
</span>
)
}
const WANING = ['기우는 달', '하현달', '그믐달']
/**
@@ -185,15 +232,19 @@ function Stories({ items }: { items: TopIndex[] }) {
return (
<Rail label="오늘의 각 순위">
{items.map((g, i) => (
<button key={g.index_id} type="button" onClick={() => open({ type: 'gak', indexId: g.index_id })} aria-label={`${g.rank}위 ${g.name} ${g.score}점`} className="flex w-[72px] cursor-pointer flex-col items-center gap-1">
<span className={cx('relative size-[68px] rounded-full p-[3px]', g.score < 50 ? 'bg-[#d6deea]' : 'b-ring')}>
<button key={g.index_id} type="button" onClick={() => open({ type: 'gak', indexId: g.index_id })} aria-label={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, 지금 시간대 아님`} className={cx('flex w-[72px] cursor-pointer flex-col items-center gap-1', !g.active && 'opacity-55')}>
<span className={cx('relative size-[68px] rounded-full p-[3px]', !g.active || g.score < 50 ? 'bg-[#d6deea]' : 'b-ring')}>
<i className="grid size-full place-items-center rounded-full border-[3px] border-(--page) bg-(--page)">
<Ic name={g.icon} className="w-[42px]" />
</i>
{i < 3 && <Ic name={MEDALS[i]} className="absolute -right-1 -bottom-1 w-[25px]" />}
{i < 3 && g.active && <Ic name={MEDALS[i]} className="absolute -right-1 -bottom-1 w-[25px]" />}
</span>
<b className="font-jua text-[13px] font-normal whitespace-nowrap">{g.name}</b>
<em className="font-bagel text-[12.5px] leading-none text-(--orange) not-italic">{g.score}</em>
{g.active ? (
<em className="font-bagel text-[12.5px] leading-none text-(--orange) not-italic">{g.score}</em>
) : (
<small className="text-[11px] leading-none font-extrabold text-(--ink3)">지금 아님</small>
)}
</button>
))}
</Rail>
@@ -300,9 +351,11 @@ export function TodayPage() {
const { region } = useRegion()
const feed = useQuery(getFeedOptions({ query: { region: region.code } }))
const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }))
const { preview } = useSky()
const f = feed.data
const posts = f?.posts ?? []
const stories = f?.stories ?? []
const stories = atSlot(f?.stories ?? [], preview)
const sloted = preview != null && stories !== f?.stories
const bands = f?.bands
const nowAt = f?.hero?.now_at
const load = loadOf(feed)
@@ -314,14 +367,14 @@ export function TodayPage() {
// 디자인대로 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
const bandAt: [number, ReactNode][] = [
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} /> : null],
[6, bands?.top5?.length ? <TopBand key="top5" items={bands.top5} sub={nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} /> : null],
[6, bands?.top5?.length ? <TopBand key="top5" items={sloted ? stories.filter((g) => g.active) : bands.top5} sub={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} /> : null],
[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} /> : null],
]
return (
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
<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)} />
<Hero hero={f?.hero} today={today.data} ranked={stories} feedLoad={load} todayLoad={loadOf(today)} />
<Sec title="오늘의 각" sub="누르면 계산 근거를 보여 줘요" more={{ to: '/gak' }} />
{/* 실패 안내는 여기 한 번만, 각 줄 스켈레톤과 같은 크기로 */}
{stories.length ? <Stories items={stories} /> : load === 'loading' ? <StoriesSkel /> : <StateBox load={load} onRetry={() => feed.refetch()} empty="오늘 계산된 각이 없어요." hold={<StoriesSkel />} className="inset-x-3 top-3 bottom-1" />}
+1 -1
View File
@@ -292,7 +292,7 @@ export function WeekPage() {
{r.estimated && ' · 예상'}
</small>
<span className="mt-[5px] block h-1.5 overflow-hidden rounded-full bg-[#eef1f6]">
<s className="block h-full bg-[linear-gradient(90deg,#9be7c4,#1f9d62)]" style={{ width: `${r.score}%` }} />
<s className="b-keep-bg block h-full bg-[linear-gradient(90deg,#9be7c4,#1f9d62)]" style={{ width: `${r.score}%` }} />
</span>
</span>
<em className="flex items-center gap-1 font-jua text-base not-italic">
+83 -30
View File
@@ -129,7 +129,23 @@
}
}
/* 처음 불러오는 동안 캐릭터가 통통 뛴다 */
.b-hop {
animation: b-hop 0.9s cubic-bezier(0.3, 0, 0.4, 1) infinite;
transform-origin: 50% 100%;
}
@keyframes b-hop {
0%,
100% {
transform: translateY(0) scale(1.06, 0.94);
}
45% {
transform: translateY(-22px) scale(0.97, 1.03);
}
}
@media (prefers-reduced-motion: reduce) {
.b-hop,
.b-fall,
.b-heart-pop,
.b-like-bit,
@@ -170,39 +186,72 @@
.b-stars i {
background: #fff;
}
.b-stat {
background: rgb(255 255 255 / 0.72);
color: var(--ink);
box-shadow: inset 0 -5px 0 rgb(217 229 244 / 0.9);
/* 히어로 하루 흐름 칸: 한 판 위에 고른 칸만 흰 바탕 */
.b-strip {
background: rgb(255 255 255 / 0.42);
}
.b-hero[data-t='night'] .b-stat,
.b-hero[data-t='sunset'] .b-stat {
background: rgb(255 255 255 / 0.18);
color: #fff;
box-shadow: inset 0 -5px 0 rgb(255 255 255 / 0.12);
.b-hero[data-t='sunset'] .b-strip,
.b-hero[data-t='night'] .b-strip {
background: rgb(255 255 255 / 0.14);
}
.b-hero[data-t='sunset'] .b-stat {
background: rgb(30 16 80 / 0.2);
}
/* 히어로 칸 강조: 조심(노랑)·비(파랑). 시간대 배경과 상관없이 같은 색 */
.b-hero .b-stat[data-tone='warn'] {
background: #fff3d6;
color: var(--ink);
box-shadow: inset 0 -5px 0 #ffd98a;
}
.b-hero .b-stat[data-tone='rain'] {
background: #dcecff;
color: var(--ink);
box-shadow: inset 0 -5px 0 #a9cdf5;
}
.b-bubble {
.b-strip-on {
background: #fff;
color: var(--ink);
box-shadow: 0 8px 16px rgb(40 48 74 / 0.1);
color: #28304a; /* 밤엔 --ink 가 밝은 색이라 고정 */
box-shadow: 0 4px 12px rgb(40 48 74 / 0.1);
}
.b-hero[data-t='night'] .b-bubble {
background: rgb(30 34 70 / 0.85);
color: #fff;
/* 상태 한 줄에서 조심할 것. 밤·노을 배경에선 밝은 주황 */
.b-warn {
color: var(--orange-deep);
}
.b-hero[data-t='sunset'] .b-warn,
.b-hero[data-t='night'] .b-warn {
color: #ffb38a;
}
/* 흐리거나 비·눈 오는 아침·낮은 하늘을 잿빛으로 */
.b-hero[data-t='morning']:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']),
.b-hero[data-t='day']:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']) {
background: linear-gradient(180deg, #a9bbd0, #cbd7e4 55%, #eef2f7);
}
.b-hero:is([data-sky='cloudy'], [data-sky='rain'], [data-sky='snow'], [data-sky='sleet']) .b-sun {
filter: saturate(0.7) brightness(0.96);
}
.b-drop,
.b-flake {
position: absolute;
top: -24px;
animation: b-fallsky var(--dur) linear var(--dl) infinite;
}
.b-drop {
width: 2px;
height: 18px;
border-radius: 2px;
background: linear-gradient(transparent, rgb(80 130 200 / 0.7));
}
.b-hero[data-t='sunset'] .b-drop,
.b-hero[data-t='night'] .b-drop {
background: linear-gradient(transparent, rgb(220 230 255 / 0.7));
}
.b-flake {
width: 7px;
height: 7px;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 4px rgb(120 150 200 / 0.5);
}
@keyframes b-fallsky {
to {
transform: translate(var(--drift, -8px), 440px);
}
}
.b-flake {
--drift: 18px;
}
@media (prefers-reduced-motion: reduce) {
.b-drop,
.b-flake {
animation: none;
top: var(--top);
}
}
.b-orb-label {
text-shadow: 0 2px 0 rgb(255 255 255 / 0.7);
@@ -536,7 +585,7 @@
.b-app[data-t='night'] [class*='bg-white/'] {
background-color: rgb(34 42 92 / 0.85);
}
.b-app[data-t='night'] :is([class*='bg-[#f'], [class*='bg-[#e'], [class*='bg-[#d'], [class*='bg-[#c'], [class*='bg-[linear-gradient']) {
.b-app[data-t='night'] :is([class*='bg-[#f'], [class*='bg-[#e'], [class*='bg-[#d'], [class*='bg-[#c'], [class*='bg-[linear-gradient']):not(.b-keep-bg) {
background: var(--chip);
}
.b-app[data-t='night'] [class*='border-[#dfe5ee]'] {
@@ -595,6 +644,10 @@
background: linear-gradient(180deg, rgb(110 230 180 / 0.12), rgb(255 255 255 / 0));
}
.b-app[data-t='night'] img[data-dark] {
filter: drop-shadow(0 0 1px rgb(255 255 255 / 0.9)) drop-shadow(0 0 6px rgb(255 255 255 / 0.3));
}
/* 밤엔 메인 탭 동그라미 테두리를 막대 색에 맞춘다 */
.b-app[data-t='night'] .b-tab-main > span {
--tw-ring-color: rgb(18 24 60 / 0.9);
+5 -1
View File
@@ -1,6 +1,6 @@
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', 'mask', 'golf', 'jipkok', 'fishing', 'drive', 'kite', 'waterplay'])
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', 'mask', 'golf', 'jipkok', 'fishing', 'drive', 'kite', 'waterplay', 'riverwind', 'trot', 'pajeon', 'bingsu', 'blanket', 'indoordry', 'flower', 'bungeoppang', 'singing_rain'])
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert'])
/** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons). 'none'(데이터 없는 칸)은 그림 없음 */
@@ -43,6 +43,10 @@ export const fall = (d: string, f = '4.8s', amp?: string) => ({ '--d': d, '--f':
export const WEEKDAYS = ['일', '월', '화', '수', '목', '금', '토'] as const
// 달(1~12) → 계절 이름과 아이콘. 봄 3–5 · 여름 6–8 · 가을 9–11 · 겨울 12–2 (서버 각 제철 기준과 같다)
const SEASONS: [string, string][] = [['겨울', 'snow'], ['봄', 'garden'], ['여름', 'sun'], ['가을', 'maple']]
export const seasonOf = (month: number) => SEASONS[Math.floor((month % 12) / 3)]
const KST = new Intl.DateTimeFormat('en-US', { timeZone: 'Asia/Seoul', year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', hourCycle: 'h23', weekday: 'short' })
const WD_EN = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
+14 -4
View File
@@ -7,10 +7,13 @@ import { AVATAR_COLORS, iconSrc, moodEmoji, naverMap, type Load } from './lib'
type IcProps = { name: string; className?: string; alt?: string; style?: CSSProperties }
// 거의 검은 아이콘. 밤 화면에선 테두리 빛을 둘러 보이게 한다
const DARK_ICONS = new Set(['walk', 'dog'])
export function Ic({ name, className, alt = '', style }: IcProps) {
const src = iconSrc(name)
if (!src) return <span aria-hidden className={cx('block', className)} style={style} />
return <img src={src} alt={alt} className={cx('block', className)} style={style} decoding="async" />
return <img src={src} alt={alt} className={cx('block', className)} style={style} decoding="async" data-dark={DARK_ICONS.has(name) || undefined} />
}
/** 사진 출처 표기 (공공누리 조건). 사진 위에서도 읽히게 반투명 배경. 위치는 className 으로 */
@@ -209,13 +212,20 @@ export function MapLink({ place, children, className }: { place: string; childre
)
}
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null }[]; dark?: boolean }) {
/** 자외선 단계(1 낮음 ~ 5 위험) 칩 색 */
const LEVEL_CHIP = ['bg-[#1f9d62] text-white', 'bg-[#ffc21a] text-[#3a2a00]', 'bg-[#f0700a] text-white', 'bg-[#e03131] text-white', 'bg-[#8e3bc4] text-white']
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null; level?: number | 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)]')}>
<div key={r.label} className={cx('flex items-center 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.place ? <MapLink place={r.place}>{r.value}</MapLink> : r.value}</b>
{r.level ? (
<b className={cx('rounded-full px-2.5 py-[3px] font-jua text-[15px] font-normal', LEVEL_CHIP[r.level - 1])}>{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>