feat: 기념일엔 앱 배경도 바뀜 — 할로윈 주황·보라(밤엔 보라 밤하늘), 크리스마스 초록·빨강, 빼빼로 초코·분홍, 추석 노랑·달빛, 노치 색과 떠다니는 기념일 그림

This commit is contained in:
minaChoi committed 2026-10-30 10:46:56 +09:00
1 parent 26624f0888
commit cff44be771
3 files changed
+85 -4

No files matched your search

+28 -4
View File
@@ -6,9 +6,11 @@ import { cx } from '../lib/utils'
import { kindOfHour, kst, seasonOf, type TimeKind } from '@nalssigak/shared/lib'
import './b.css'
import { AuthProvider } from './auth'
import { iconSrc } from './lib'
import { RegionProvider } from './region'
import { useAuth } from './authContext'
import { preloadGoogle } from './googleScript'
import { currentHoliday } from './holiday'
import { LevelBadge, LevelWatcher } from './level'
import { useRegion } from './regionContext'
import { useSheet } from './sheetContext'
@@ -106,6 +108,18 @@ const SHOOTS = [
{ top: '14%', left: '96%', '--len': '120px', '--dur': '12s', '--dl': '9s' },
]
const HOLIDAY = currentHoliday()
/** 기념일에 하늘에 떠다니는 그림: 게임 그림 중 큰 것부터 */
const FLOATS = [
{ top: '9%', left: '6%', '--z': '46px', '--dur': '13s', '--dl': '0s' },
{ top: '17%', left: '82%', '--z': '40px', '--dur': '15s', '--dl': '2s' },
{ top: '38%', left: '88%', '--z': '34px', '--dur': '17s', '--dl': '4s' },
{ top: '46%', left: '3%', '--z': '38px', '--dur': '14s', '--dl': '1s' },
{ top: '66%', left: '84%', '--z': '44px', '--dur': '16s', '--dl': '3s' },
{ top: '78%', left: '8%', '--z': '36px', '--dur': '18s', '--dl': '5s' },
]
/** 화면 전체 하늘: 시간대별 색, 아주 느리게 일렁이는 색 덩어리, 밤에는 별 */
function SkyBg() {
const { kind } = useSky()
@@ -116,10 +130,11 @@ function SkyBg() {
return () => document.removeEventListener('visibilitychange', onVis)
}, [])
return (
<div className={cx('b-skybg pointer-events-none fixed inset-0 overflow-hidden', hidden && 'b-paused')} data-t={kind} aria-hidden="true">
<div className={cx('b-skybg pointer-events-none fixed inset-0 overflow-hidden', hidden && 'b-paused')} data-t={kind} data-h={HOLIDAY?.key} aria-hidden="true">
{(['morning', 'day', 'sunset', 'night'] as const).map((k) => (
<div key={k} className={cx('b-sky-lay absolute inset-0', `b-sky-${k}`)} />
))}
{HOLIDAY && <div className="b-sky-lay b-sky-holiday absolute inset-0" />}
<span className="b-blob b-blob-1" />
<span className="b-blob b-blob-2" />
<span className="b-blob b-blob-3" />
@@ -131,6 +146,13 @@ function SkyBg() {
<span key={i} className="b-shoot" style={s} />
))}
</div>
{HOLIDAY && (
<div className="b-holiday-fx absolute inset-0">
{FLOATS.map((s, i) => (
<img key={i} src={iconSrc(HOLIDAY.game[HOLIDAY.game.length - 1 - (i % 4)].icon) ?? ''} alt="" style={s} />
))}
</div>
)}
</div>
)
}
@@ -183,6 +205,8 @@ const NOTCH_BG: Record<TimeKind, string> = {
night: '#0e1433',
}
const notchBg = (kind: TimeKind) => (kind === 'night' ? (HOLIDAY?.nightNotch ?? NOTCH_BG.night) : (HOLIDAY?.notch ?? NOTCH_BG[kind]))
/** 처음 들어올 때만: 첫 데이터를 다 받을 때까지 하늘 위에 캐릭터와 '날씨 불러오는 중…'. 한 번 사라지면 다시 안 뜬다 */
function FirstLoad() {
const fetching = useIsFetching()
@@ -207,7 +231,7 @@ function FirstLoad() {
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)` }}
style={{ backgroundColor: `color-mix(in srgb, ${notchBg(kind)} 72%, transparent)` }}
>
<Ic name={kind === 'night' ? 'bear' : 'rabbit'} className="b-hop w-[88px]" />
<p className="m-0 font-jua text-[19px]">날씨 불러오는 중…</p>
@@ -255,7 +279,7 @@ function Shell() {
if (pathname === to) window.scrollTo({ top: 0, behavior: 'smooth' })
}
useEffect(() => {
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', NOTCH_BG[kind])
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', notchBg(kind))
}, [kind])
return (
@@ -264,7 +288,7 @@ function Shell() {
<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" />
<div className="fixed inset-x-0 top-0 z-[19] h-[env(safe-area-inset-top,0px)] transition-colors duration-1400" style={{ backgroundColor: notchBg(kind) }} aria-hidden="true" />
<div className="relative mx-auto min-h-dvh max-w-[440px] overflow-x-clip pb-[calc(104px+env(safe-area-inset-bottom,0px))]">
<TopBar />
<main className="relative z-[1]">