diff --git a/TODO.md b/TODO.md index f51c9ff..bc16816 100644 --- a/TODO.md +++ b/TODO.md @@ -448,3 +448,11 @@ docs를 6개로 합칠 때 옛 내용을 그대로 옮겼다. 아래는 코드 | [ ] | **[결정 필요]** GA4 맞춤 측정기준(이벤트 범위) 추가 등록 — `icon`(today_icon)·`sheet`(sheet_open)·`from`·`method`·`content_type`·`round`(game) | 지금 등록된 건 `gak_name`·`platform`·`region_name` 뿐이라 오늘 탭 아이콘별·창별·게임 라운드별 사용을 GA에서 못 나눔. 등록 전 데이터는 소급 안 됨 | GA4 관리 → 맞춤 정의 | | [ ] | **[결정 필요]** '홈 화면에 추가' 카드 손보기 — 띄우는 조건(몇 번째 방문부터)·문구, 또는 빼기 | 10/22~10/28 테스트 트래픽 뺀 77명이 봤고 누른 사람 0 (앞 주 8명 중 1명 설치) | `frontend/src/b/installBanner.tsx` | + +## 기념일 꾸밈 (`frontend/src/b/holiday.ts`) + +| 상태 | 할 일 | 이유 | 관련 파일 | +|---|---|---|---| +| [ ] | `feat/halloween` main 병합 → 킹서버 배포(백엔드 `TalkTopic` 6~9 포함). 10/31 00시 전에 올라가야 할로윈이 켜짐 | 10/30 킹서버 작업 중이라 배포 보류 | `deploy.sh` | +| [ ] | 할로윈 타로·코디 카드 (`/daily-tarot 할로윈`, `/daily-ootd`) — 킹서버 게시라 보류 | 10/30 킹서버 작업 중 | | +| [ ] | 2028년부터 추석 날짜 추가 (음력이라 해마다 `ranges` 에 한 줄) | 2027-09-14~16만 들어 있음 | `frontend/src/b/holiday.ts` | diff --git a/backend/common/enums.py b/backend/common/enums.py index 799ed37..6f7d06d 100644 --- a/backend/common/enums.py +++ b/backend/common/enums.py @@ -125,6 +125,10 @@ class TalkTopic(CodeEnum): RAIN = 3 # 비·눈 FOLIAGE = 4 # 단풍·꽃 OUTFIT = 5 # 오늘 옷차림 + HALLOWEEN = 6 # 기념일 주제: 그 기간에만 고를 수 있다 (frontend holiday.ts) + PEPERO = 7 + CHRISTMAS = 8 + CHUSEOK = 9 class TalkReport(CodeEnum): diff --git a/docs/이벤트_추적.md b/docs/이벤트_추적.md index a104786..fbdf6d7 100644 --- a/docs/이벤트_추적.md +++ b/docs/이벤트_추적.md @@ -42,7 +42,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 | `terms_agree` | 댓글 쓰기 전 이용약관 동의 성공 | 없음 | `Sheets.tsx` `CommentsSheet` `agreeAndSend` | | `report` | 신고 성공 | `content_type: 'comment' \| 'talk'`, `reason`(신고 이유 번호) | `Sheets.tsx` `CommentMenu`, `talk.tsx` | | `block` | 차단 성공 | `content_type: 'comment' \| 'talk'` | `Sheets.tsx` `CommentMenu`, `talk.tsx` | -| `talk_post` | 이야기 글 올리기 성공 | `topic`(주제 번호), `with_image` | `talk.tsx` 글쓰기 `submit` | +| `talk_post` | 이야기 글 올리기 성공 | `topic`(주제 번호, 6~9 는 기념일: 할로윈·빼빼로데이·크리스마스·추석), `with_image` | `talk.tsx` 글쓰기 `submit` | | `feed_item_view` | 오늘 피드에 섞인 사람 글·행사 포스트가 처음 반쯤 보임 (한 장에 한 번) | `item_type: 'talk' \| 'event'`, `position`(피드에서 그 종류의 몇 번째) | `TodayPage.tsx` `Seen` | | `hero_day_switch` | 히어로 오늘/내일 스위치를 바꿈 | `day: 'today' \| 'tomorrow'` | `TodayPage.tsx` | | `shorts_open` | 쇼츠 페이지(/shorts/영상ID)로 들어옴 (오늘 화면 쇼츠 줄·공유 링크) | `video_id` | `Shorts.tsx` `ShortsPage` | @@ -58,7 +58,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화 | `today_icon` | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` | | `saju_input` | 날씨 사주 생년월일을 넣음 (생년월일 값은 보내지 않음) | `with_time` | `SajuPage.tsx` `BirthForm` | | `saju_view` | 날씨 사주 결과가 뜸 | `scene`(내 기운 이름), `score`, `strength`(신강·중화·신약), `top_element`(가장 센 오행) | `SajuPage.tsx` `Reading` | -| `game_start` | 구름 합치기 한 판의 첫 그림을 떨어뜨림 (페이지만 열고 안 한 사람과 구분) | `again`(다시 하기로 시작), `logged_in`, `wind_ms`(오늘 우리 구 풍속) | `CloudMergePage.tsx` `onUp` | +| `game_start` | 구름 합치기 한 판의 첫 그림을 떨어뜨림 (페이지만 열고 안 한 사람과 구분) | `again`(다시 하기로 시작), `logged_in`, `wind_ms`(오늘 우리 구 풍속), `theme`(그림: `basic`·`halloween`·`pepero`·`christmas`·`chuseok`, `holiday.ts`) | `CloudMergePage.tsx` `onUp` | | `game_round` | 구름 합치기 라운드를 깸 | `round`(깬 라운드), `score`(그때 총점), `logged_in`(각을 받는지) | `CloudMergePage.tsx` `onScore` | | `game_over` | 구름 합치기가 넘쳐서 끝남 | `round`(끝난 라운드), `score`, `best`(최고 기록 갱신), `drops`(떨어뜨린 횟수) | `CloudMergePage.tsx` `onOver` | diff --git a/frontend/public/b/icons/bat.png b/frontend/public/b/icons/bat.png new file mode 100644 index 0000000..edd6951 Binary files /dev/null and b/frontend/public/b/icons/bat.png differ diff --git a/frontend/public/b/icons/bell.png b/frontend/public/b/icons/bell.png new file mode 100644 index 0000000..f4d5f7e Binary files /dev/null and b/frontend/public/b/icons/bell.png differ diff --git a/frontend/public/b/icons/candy.png b/frontend/public/b/icons/candy.png new file mode 100644 index 0000000..239cab5 Binary files /dev/null and b/frontend/public/b/icons/candy.png differ diff --git a/frontend/public/b/icons/chocolate_bar.png b/frontend/public/b/icons/chocolate_bar.png new file mode 100644 index 0000000..e353f29 Binary files /dev/null and b/frontend/public/b/icons/chocolate_bar.png differ diff --git a/frontend/public/b/icons/christmas_tree.png b/frontend/public/b/icons/christmas_tree.png new file mode 100644 index 0000000..79af65b Binary files /dev/null and b/frontend/public/b/icons/christmas_tree.png differ diff --git a/frontend/public/b/icons/cookie.png b/frontend/public/b/icons/cookie.png new file mode 100644 index 0000000..b164a7e Binary files /dev/null and b/frontend/public/b/icons/cookie.png differ diff --git a/frontend/public/b/icons/dango.png b/frontend/public/b/icons/dango.png new file mode 100644 index 0000000..4062ef5 Binary files /dev/null and b/frontend/public/b/icons/dango.png differ diff --git a/frontend/public/b/icons/full_moon.png b/frontend/public/b/icons/full_moon.png new file mode 100644 index 0000000..1d29568 Binary files /dev/null and b/frontend/public/b/icons/full_moon.png differ diff --git a/frontend/public/b/icons/ghost.png b/frontend/public/b/icons/ghost.png new file mode 100644 index 0000000..30f7492 Binary files /dev/null and b/frontend/public/b/icons/ghost.png differ diff --git a/frontend/public/b/icons/heart_with_ribbon.png b/frontend/public/b/icons/heart_with_ribbon.png new file mode 100644 index 0000000..f3cc953 Binary files /dev/null and b/frontend/public/b/icons/heart_with_ribbon.png differ diff --git a/frontend/public/b/icons/jack_o_lantern.png b/frontend/public/b/icons/jack_o_lantern.png new file mode 100644 index 0000000..b957167 Binary files /dev/null and b/frontend/public/b/icons/jack_o_lantern.png differ diff --git a/frontend/public/b/icons/lollipop.png b/frontend/public/b/icons/lollipop.png new file mode 100644 index 0000000..ed00db4 Binary files /dev/null and b/frontend/public/b/icons/lollipop.png differ diff --git a/frontend/public/b/icons/love_letter.png b/frontend/public/b/icons/love_letter.png new file mode 100644 index 0000000..36b09cf Binary files /dev/null and b/frontend/public/b/icons/love_letter.png differ diff --git a/frontend/public/b/icons/moon_viewing.png b/frontend/public/b/icons/moon_viewing.png new file mode 100644 index 0000000..97e8ef6 Binary files /dev/null and b/frontend/public/b/icons/moon_viewing.png differ diff --git a/frontend/public/b/icons/pear.png b/frontend/public/b/icons/pear.png new file mode 100644 index 0000000..4cb20f0 Binary files /dev/null and b/frontend/public/b/icons/pear.png differ diff --git a/frontend/public/b/icons/ribbon.png b/frontend/public/b/icons/ribbon.png new file mode 100644 index 0000000..96d7195 Binary files /dev/null and b/frontend/public/b/icons/ribbon.png differ diff --git a/frontend/public/b/icons/skull.png b/frontend/public/b/icons/skull.png new file mode 100644 index 0000000..31ca9f4 Binary files /dev/null and b/frontend/public/b/icons/skull.png differ diff --git a/frontend/public/b/icons/snowflake.png b/frontend/public/b/icons/snowflake.png new file mode 100644 index 0000000..f3ffa39 Binary files /dev/null and b/frontend/public/b/icons/snowflake.png differ diff --git a/frontend/public/b/icons/snowman.png b/frontend/public/b/icons/snowman.png new file mode 100644 index 0000000..e641fae Binary files /dev/null and b/frontend/public/b/icons/snowman.png differ diff --git a/frontend/public/b/icons/socks.png b/frontend/public/b/icons/socks.png new file mode 100644 index 0000000..6f7fe96 Binary files /dev/null and b/frontend/public/b/icons/socks.png differ diff --git a/frontend/public/b/icons/spider.png b/frontend/public/b/icons/spider.png new file mode 100644 index 0000000..2724ec8 Binary files /dev/null and b/frontend/public/b/icons/spider.png differ diff --git a/frontend/public/b/icons/spider_web.png b/frontend/public/b/icons/spider_web.png new file mode 100644 index 0000000..4fa9a03 Binary files /dev/null and b/frontend/public/b/icons/spider_web.png differ diff --git a/frontend/public/b/icons/star.png b/frontend/public/b/icons/star.png new file mode 100644 index 0000000..e6ee8b0 Binary files /dev/null and b/frontend/public/b/icons/star.png differ diff --git a/frontend/public/b/icons/wrapped_gift.png b/frontend/public/b/icons/wrapped_gift.png new file mode 100644 index 0000000..3fc2377 Binary files /dev/null and b/frontend/public/b/icons/wrapped_gift.png differ diff --git a/frontend/src/b/CloudMergePage.tsx b/frontend/src/b/CloudMergePage.tsx index d6a1a79..1260639 100644 --- a/frontend/src/b/CloudMergePage.tsx +++ b/frontend/src/b/CloudMergePage.tsx @@ -10,7 +10,7 @@ import { slotAt } from '@nalssigak/shared/lib/weatherText' import { track } from '../lib/analytics' import { cx } from '../lib/utils' import { useAuth } from './authContext' -import { createGame, DROP_Y, H, LEVELS, LINE_Y, loadBest, randomLevel, roundTarget, saveBest, W, windDir, type Game } from './cloudMerge' +import { createGame, DROP_Y, H, HOLIDAY, LEVELS, LINE_Y, loadBest, randomLevel, roundTarget, saveBest, W, windDir, type Game } from './cloudMerge' import { useLevel } from './level' import { iconSrc } from './lib' import { useRegion } from './regionContext' @@ -213,7 +213,7 @@ export function CloudMergePage() { const onUp = (e: PointerEvent) => { const game = gameRef.current if (!game || over || performance.now() < coolRef.current) return - if (dropsRef.current === 0) track('game_start', { again: play > 0, logged_in: loggedIn, wind_ms: windMs }) + if (dropsRef.current === 0) track('game_start', { again: play > 0, logged_in: loggedIn, wind_ms: windMs, theme: HOLIDAY?.key ?? 'basic' }) dropsRef.current += 1 game.drop(nextRef.current, toX(e)) coolRef.current = performance.now() + 450 diff --git a/frontend/src/b/TalkPage.tsx b/frontend/src/b/TalkPage.tsx index 807d6a9..1e42290 100644 --- a/frontend/src/b/TalkPage.tsx +++ b/frontend/src/b/TalkPage.tsx @@ -5,7 +5,7 @@ import { cx } from '../lib/utils' import { useAuth } from './authContext' import { useSheet } from './sheetContext' import { FeedComposer, TalkCard } from './talk' -import { TOPICS, useMyTalks, useTopicTalks } from './talkState' +import { openTopics, TOPICS, useMyTalks, useTopicTalks } from './talkState' import { Rail, Sec } from './ui' type Tab = TalkTopic | 'all' | 'mine' @@ -34,7 +34,7 @@ export function TalkPage() { const topicList = useTopicTalks(tab === 'all' || tab === 'mine' ? undefined : tab) const mineList = useMyTalks(tab === 'mine' && loggedIn) const { talks, loaded, more, loadMore } = tab === 'mine' ? mineList : topicList - const tabs: (readonly [Tab, string])[] = [['all', '전체'], ...TOPICS, ['mine', '내 글']] + const tabs: (readonly [Tab, string])[] = [['all', '전체'], ...openTopics(), ['mine', '내 글']] const go = (k: Tab) => setParams(k === 'mine' ? { mine: '1' } : k === 'all' ? {} : { topic: String(k) }, { replace: true }) return ( diff --git a/frontend/src/b/cloudMerge.ts b/frontend/src/b/cloudMerge.ts index f7d01c6..d64655c 100644 --- a/frontend/src/b/cloudMerge.ts +++ b/frontend/src/b/cloudMerge.ts @@ -1,7 +1,8 @@ import Matter from 'matter-js' +import { currentHoliday } from './holiday' /** 작은 것부터 큰 것 순서. 같은 단계 둘이 닿으면 다음 단계로 합쳐지고, 해 둘은 사라지며 보너스 */ -export const LEVELS = [ +const BASE = [ { icon: 'muggy', name: '물방울', r: 15, color: '#d9f0ff' }, { icon: 'snow', name: '눈송이', r: 21, color: '#e4ecff' }, { icon: 'cloud', name: '구름', r: 28, color: '#f1f3f8' }, @@ -12,6 +13,10 @@ export const LEVELS = [ { icon: 'sun', name: '해', r: 78, color: '#ffd2a1' }, ] as const +/** 기념일엔 그림·이름만 그날 것으로 (크기·색·합치기 규칙은 그대로) */ +export const HOLIDAY = currentHoliday() +export const LEVELS = BASE.map((l, i) => (HOLIDAY ? { ...l, ...HOLIDAY.game[i] } : l)) + export const W = 360 export const H = 540 /** 이 선 위에 쌓인 채로 LOSE_MS 넘게 있으면 끝 */ diff --git a/frontend/src/b/holiday.ts b/frontend/src/b/holiday.ts new file mode 100644 index 0000000..2f9d4d3 --- /dev/null +++ b/frontend/src/b/holiday.ts @@ -0,0 +1,115 @@ +import { TalkTopic } from '@nalssigak/shared/api/client/types.gen' +import { kst } from '@nalssigak/shared/lib' + +/** 게임 8단계 그림을 바꾼다. 작은 것부터 큰 것 순서, 크기·색은 원래 단계 그대로 */ +type GamePiece = { icon: string; name: string } + +/** + * 기념일 꾸밈. 기간(KST, 양 끝 포함) 안에만 켜진다. 'MM-DD' 는 해마다, 'YYYY-MM-DD' 는 그해만(음력 기념일). + * 새 기념일: 여기에 한 줄 + TalkTopic(backend/common/enums.py) + 그림(public/b/icons, lib.ts OWN) + */ +export type Holiday = { + key: 'halloween' | 'pepero' | 'christmas' | 'chuseok' + name: string + ranges: readonly (readonly [string, string])[] + topic: TalkTopic + /** 글만 있는 사람 글 배경 (b.css b-bg-*) */ + bg: string + game: readonly GamePiece[] +} + +export const HOLIDAYS: readonly Holiday[] = [ + { + key: 'halloween', + name: '할로윈', + ranges: [['10-31', '11-01']], + topic: TalkTopic.HALLOWEEN, + bg: 'night', + game: [ + { icon: 'candy', name: '사탕' }, + { icon: 'lollipop', name: '막대사탕' }, + { icon: 'spider', name: '거미' }, + { icon: 'spider_web', name: '거미줄' }, + { icon: 'bat', name: '박쥐' }, + { icon: 'ghost', name: '유령' }, + { icon: 'skull', name: '해골' }, + { icon: 'jack_o_lantern', name: '호박등' }, + ], + }, + { + key: 'pepero', + name: '빼빼로데이', + ranges: [['11-11', '11-11']], + topic: TalkTopic.PEPERO, + bg: 'peach', + game: [ + { icon: 'candy', name: '사탕' }, + { icon: 'cookie', name: '쿠키' }, + { icon: 'chocolate_bar', name: '초콜릿' }, + { icon: 'ribbon', name: '리본' }, + { icon: 'love_letter', name: '편지' }, + { icon: 'red_heart', name: '하트' }, + { icon: 'heart_with_ribbon', name: '리본 하트' }, + { icon: 'wrapped_gift', name: '선물' }, + ], + }, + { + key: 'christmas', + name: '크리스마스', + ranges: [['12-24', '12-25']], + topic: TalkTopic.CHRISTMAS, + bg: 'mint', + game: [ + { icon: 'snowflake', name: '눈송이' }, + { icon: 'star', name: '별' }, + { icon: 'bell', name: '종' }, + { icon: 'socks', name: '양말' }, + { icon: 'cookie', name: '쿠키' }, + { icon: 'wrapped_gift', name: '선물' }, + { icon: 'snowman', name: '눈사람' }, + { icon: 'christmas_tree', name: '트리' }, + ], + }, + { + key: 'chuseok', + name: '추석', + ranges: [['2027-09-14', '2027-09-16']], + topic: TalkTopic.CHUSEOK, + bg: 'butter', + game: [ + { icon: 'chestnut', name: '밤' }, + { icon: 'pear', name: '배' }, + { icon: 'apple', name: '사과' }, + { icon: 'dango', name: '떡' }, + { icon: 'rabbit', name: '토끼' }, + { icon: 'maple', name: '단풍' }, + { icon: 'moon_viewing', name: '달맞이' }, + { icon: 'full_moon', name: '보름달' }, + ], + }, +] + +const pad = (n: number) => String(n).padStart(2, '0') + +function inRange([from, to]: readonly [string, string], y: number, md: string) { + const day = from.length === 10 ? `${y}-${md}` : md + return from <= day && day <= to +} + +/** 미리 보기 기념일: 주소의 ?holiday= 를 탭이 닫힐 때까지 기억 */ +function previewKey() { + const q = new URLSearchParams(location.search).get('holiday') + if (q) sessionStorage.setItem('holiday', q) + return q ?? sessionStorage.getItem('holiday') +} + +/** 오늘(KST) 켜진 기념일. ?holiday=christmas 로 미리 보기 */ +export function currentHoliday(now = new Date()): Holiday | undefined { + const preview = previewKey() + if (preview) return HOLIDAYS.find((h) => h.key === preview) + const { y, mo, d } = kst(now) + const md = `${pad(mo)}-${pad(d)}` + return HOLIDAYS.find((h) => h.ranges.some((r) => inRange(r, y, md))) +} + +export const holidayByTopic = (t?: number) => HOLIDAYS.find((h) => h.topic === t) diff --git a/frontend/src/b/lib.ts b/frontend/src/b/lib.ts index 3a3d1d8..d776039 100644 --- a/frontend/src/b/lib.ts +++ b/frontend/src/b/lib.ts @@ -2,7 +2,7 @@ import type { CSSProperties } from 'react' import { ARTICLE_LABEL } from '@nalssigak/shared/lib' 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', 'hangang', 'themepark', 'date', 'frizz', 'boiler', 'sunscreen', 'mosquito', 'tennis', 'hyodo', 'thanks', 'gift', 'party', 'game', 'selfie', 'sentimental', 'ginkgo']) -const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert', 'crystal_ball', 'yin_yang', 'tshirt', 'clapper', 'speech', 'droplet', 'leaf', 'rainbow', 'milky_way', 'shooting_star', 'alarm_clock', 'check_mark_button', 'sparkles', 'warning', 'locked', 'money_bag', 'red_heart', 'briefcase', 'spiral_calendar', 'two_hearts', 'sunrise']) +const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert', 'crystal_ball', 'yin_yang', 'tshirt', 'clapper', 'speech', 'droplet', 'leaf', 'rainbow', 'milky_way', 'shooting_star', 'alarm_clock', 'check_mark_button', 'sparkles', 'warning', 'locked', 'money_bag', 'red_heart', 'briefcase', 'spiral_calendar', 'two_hearts', 'sunrise', 'candy', 'lollipop', 'spider', 'spider_web', 'bat', 'ghost', 'skull', 'jack_o_lantern', 'cookie', 'chocolate_bar', 'ribbon', 'love_letter', 'heart_with_ribbon', 'wrapped_gift', 'snowflake', 'star', 'bell', 'socks', 'snowman', 'christmas_tree', 'pear', 'dango', 'moon_viewing', 'full_moon']) /** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons). 'none'(데이터 없는 칸)은 그림 없음 */ export function iconSrc(name: string) { diff --git a/frontend/src/b/talk.tsx b/frontend/src/b/talk.tsx index c466549..a572547 100644 --- a/frontend/src/b/talk.tsx +++ b/frontend/src/b/talk.tsx @@ -15,7 +15,8 @@ import { cx } from '../lib/utils' import { useAuth } from './authContext' import { kst } from '@nalssigak/shared/lib' import { useRegion } from './regionContext' -import { topicName, TOPICS, useMyTalks } from './talkState' +import { holidayByTopic } from './holiday' +import { openTopics, topicName, useMyTalks } from './talkState' import { useSheet } from './sheetContext' import { CameraIcon, CommentIcon, HeartIcon, SendIcon } from './svg' import { Avatar, TAP44 } from './ui' @@ -153,7 +154,7 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) { )}
- {TOPICS.map(([k, label]) => ( + {openTopics().map(([k, label]) => (
{menu !== 'closed' && } -
+
{src ? ( ) : ( diff --git a/frontend/src/b/talkState.ts b/frontend/src/b/talkState.ts index 698ec97..722f949 100644 --- a/frontend/src/b/talkState.ts +++ b/frontend/src/b/talkState.ts @@ -1,6 +1,7 @@ import { useInfiniteQuery } from '@tanstack/react-query' import { listMyTalksInfiniteOptions, listTalksInfiniteOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' import { TalkTopic } from '@nalssigak/shared/api/client/types.gen' +import { currentHoliday, HOLIDAYS } from './holiday' import { useRegion } from './regionContext' // 글 주제와 이름 @@ -10,9 +11,16 @@ export const TOPICS = [ [TalkTopic.RAIN, '비·눈'], [TalkTopic.FOLIAGE, '단풍·꽃'], [TalkTopic.OUTFIT, '오늘 옷차림'], + ...HOLIDAYS.map((h) => [h.topic, h.name] as const), ] as const export const topicName = (t?: number) => TOPICS.find(([k]) => k === t)?.[1] ?? '동네 이야기' +/** 지금 고를 수 있는 주제: 기념일 주제는 그 기간에만 */ +export function openTopics() { + const on = currentHoliday()?.topic + return TOPICS.filter(([k]) => !HOLIDAYS.some((h) => h.topic === k) || k === on) +} + /** 주제별 글 페이지 목록 (topic 없으면 전체) */ export function useTopicTalks(topic?: TalkTopic) { const { region } = useRegion() diff --git a/frontend/src/lib/analytics.ts b/frontend/src/lib/analytics.ts index a97c965..9fc42b5 100644 --- a/frontend/src/lib/analytics.ts +++ b/frontend/src/lib/analytics.ts @@ -1,4 +1,5 @@ import type { PinnedKey } from '../b/pinnedLike' +import type { Holiday } from '../b/holiday' import type { SheetState } from '../b/sheetContext' /** GA4로 보내는 이벤트와 값. 목록은 docs/이벤트_추적.md */ @@ -37,7 +38,7 @@ type Events = { today_icon: { icon: string } saju_input: { with_time: boolean } saju_view: { scene: string; score: number; strength: string; top_element: string } - game_start: { again: boolean; logged_in: boolean; wind_ms: number } + game_start: { again: boolean; logged_in: boolean; wind_ms: number; theme: 'basic' | Holiday['key'] } game_round: { round: number; score: number; logged_in: boolean } game_over: { round: number; score: number; best: boolean; drops: number } toss_intro_start: Record diff --git a/shared/api/client/types.gen.ts b/shared/api/client/types.gen.ts index 0cb1a0b..5238700 100644 --- a/shared/api/client/types.gen.ts +++ b/shared/api/client/types.gen.ts @@ -4574,7 +4574,23 @@ export const TalkTopic = { /** * OUTFIT */ - OUTFIT: 5 + OUTFIT: 5, + /** + * HALLOWEEN + */ + HALLOWEEN: 6, + /** + * PEPERO + */ + PEPERO: 7, + /** + * CHRISTMAS + */ + CHRISTMAS: 8, + /** + * CHUSEOK + */ + CHUSEOK: 9 } as const; /**