feat: 기념일엔 앱 배경도 바뀜 — 할로윈 주황·보라(밤엔 보라 밤하늘), 크리스마스 초록·빨강, 빼빼로 초코·분홍, 추석 노랑·달빛, 노치 색과 떠다니는 기념일 그림
This commit is contained in:
1 parent
26624f0888
commit
cff44be771
3 files changed
+85
-4
No files matched your search
@@ -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]">
|
||||
|
||||
@@ -456,6 +456,54 @@
|
||||
.b-skybg[data-t='night'] .b-sky-night {
|
||||
opacity: 1;
|
||||
}
|
||||
/* 기념일 하늘 (holiday.ts): 낮·아침·노을은 기념일 색, 밤은 할로윈만 바꾼다 */
|
||||
.b-skybg[data-h]:not([data-t='night']) .b-sky-holiday {
|
||||
opacity: 1;
|
||||
}
|
||||
.b-skybg[data-h='halloween'] .b-sky-holiday {
|
||||
background: linear-gradient(180deg, #ff9f4a 0%, #ffb36b 30%, #c69bff 75%, #8f6ae0 100%);
|
||||
}
|
||||
.b-skybg[data-h='halloween'][data-t='night'] .b-sky-holiday {
|
||||
background: linear-gradient(180deg, #1c1030 0%, #34184f 55%, #4a2148 100%);
|
||||
opacity: 1;
|
||||
}
|
||||
.b-skybg[data-h='pepero'] .b-sky-holiday {
|
||||
background: linear-gradient(180deg, #d9a07a 0%, #f2c9a8 35%, #ffc2d4 100%);
|
||||
}
|
||||
.b-skybg[data-h='christmas'] .b-sky-holiday {
|
||||
background: linear-gradient(180deg, #7fcf9c 0%, #c3ebcf 35%, #ffb3b3 100%);
|
||||
}
|
||||
.b-skybg[data-h='chuseok'] .b-sky-holiday {
|
||||
background: linear-gradient(180deg, #ffd166 0%, #ffe6a3 35%, #c9c4ff 100%);
|
||||
}
|
||||
.b-skybg[data-h='halloween'] {
|
||||
--b1: #ff9d4d;
|
||||
--b2: #c39bff;
|
||||
--b3: #ffcf73;
|
||||
--bo: 0.5;
|
||||
}
|
||||
.b-skybg[data-h='christmas'] {
|
||||
--b1: #8fd6a8;
|
||||
--b2: #ffa8a8;
|
||||
--b3: #fff1b0;
|
||||
--bo: 0.45;
|
||||
}
|
||||
.b-holiday-fx img {
|
||||
position: absolute;
|
||||
width: var(--z);
|
||||
height: var(--z);
|
||||
opacity: 0.9;
|
||||
animation: b-holiday-float var(--dur) ease-in-out var(--dl) infinite alternate;
|
||||
}
|
||||
@keyframes b-holiday-float {
|
||||
50% { transform: translate3d(8px, -16px, 0) rotate(8deg); }
|
||||
100% { transform: translate3d(-6px, 10px, 0) rotate(-6deg); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.b-holiday-fx img {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
.b-skybg[data-t='morning'] {
|
||||
--b1: #ffc39b;
|
||||
--b2: #bfe5ff;
|
||||
|
||||
@@ -15,12 +15,18 @@ export type Holiday = {
|
||||
topic: TalkTopic
|
||||
/** 글만 있는 사람 글 배경 (b.css b-bg-*) */
|
||||
bg: string
|
||||
/** 낮 하늘 맨 위 색 = 노치 띠 색. 하늘 그라데이션은 b.css .b-skybg[data-h] */
|
||||
notch: string
|
||||
/** 밤 하늘도 바꾸는 기념일만 */
|
||||
nightNotch?: string
|
||||
game: readonly GamePiece[]
|
||||
}
|
||||
|
||||
export const HOLIDAYS: readonly Holiday[] = [
|
||||
{
|
||||
key: 'halloween',
|
||||
notch: '#ffad62',
|
||||
nightNotch: '#1c1030',
|
||||
name: '할로윈',
|
||||
ranges: [['10-31', '11-01']],
|
||||
topic: TalkTopic.HALLOWEEN,
|
||||
@@ -38,6 +44,7 @@ export const HOLIDAYS: readonly Holiday[] = [
|
||||
},
|
||||
{
|
||||
key: 'pepero',
|
||||
notch: '#e2b08e',
|
||||
name: '빼빼로데이',
|
||||
ranges: [['11-11', '11-11']],
|
||||
topic: TalkTopic.PEPERO,
|
||||
@@ -55,6 +62,7 @@ export const HOLIDAYS: readonly Holiday[] = [
|
||||
},
|
||||
{
|
||||
key: 'christmas',
|
||||
notch: '#95d8ac',
|
||||
name: '크리스마스',
|
||||
ranges: [['12-24', '12-25']],
|
||||
topic: TalkTopic.CHRISTMAS,
|
||||
@@ -72,6 +80,7 @@ export const HOLIDAYS: readonly Holiday[] = [
|
||||
},
|
||||
{
|
||||
key: 'chuseok',
|
||||
notch: '#ffd77e',
|
||||
name: '추석',
|
||||
ranges: [['2027-09-14', '2027-09-16']],
|
||||
topic: TalkTopic.CHUSEOK,
|
||||
|
||||
Reference in new issue
Block a user