feat: 오늘 탭 아이콘 줄에 날씨 게임(/game) 연결, 오늘 코디 빼기, 오늘 타로는 잠시 숨김

- feat/weather-game(구름 합치기) 브랜치를 합쳐 아이콘에서 바로 열림
- 오늘 코디 아이콘·창과 그걸 위해 넣은 GET /v1/card/latest 를 걷어냄
- 오늘 타로는 features.ts HIDDEN 으로 숨김 (아이콘 줄·각 모으는 법에서 빠짐, 안내 문구에서도 타로를 뺌)
This commit is contained in:
minaChoi committed 2026-10-28 15:55:00 +09:00
1 parent 4cfcbcf7ea
commit e4834fd24e
15 files changed
+18 -183

No files matched your search

+1 -1
View File
@@ -292,7 +292,7 @@ function Locked({ locks }: { locks: SajuLock[] }) {
<div className="min-w-0 flex-1">
<p className="m-0 font-jua text-[16px]">{loggedIn ? `다음에 열려요: ${next.name}` : '각을 모으면 차례로 열려요'}</p>
<p className="m-0 text-xs font-bold text-(--ink2)">
{loggedIn ? `Lv.${next.level}에서 열려요${close ? ` · ${level.next_points! - level.points}각 남았어요` : ''}` : '출석·타로·좋아요로 모은 각은 로그인해야 쌓여요'}
{loggedIn ? `Lv.${next.level}에서 열려요${close ? ` · ${level.next_points! - level.points}각 남았어요` : ''}` : '출석·사주·좋아요로 모은 각은 로그인해야 쌓여요'}
</p>
</div>
<button type="button" onClick={() => open(loggedIn ? { type: 'level' } : { type: 'login', why: 'level' })} className="shrink-0 cursor-pointer rounded-full bg-(--ink) px-3 py-1.5 text-xs font-extrabold text-white">
+2 -4
View File
@@ -37,7 +37,6 @@ import { InstallSheet } from './installBanner'
import { ARTICLE_CAT, SHEET_CLOSE_MS, SHEET_OPEN_MS } from './lib'
import { MixSheet, MyGakSheet } from './myGak'
import { TarotSheet } from './fortune'
import { OotdSheet } from './todayIcons'
import { LevelCard, LevelSheet, LevelUpSheet, useShareReward } from './level'
import { ownPage, useRegion } from './regionContext'
import { WeatherWhySheet } from './weatherWhy'
@@ -90,7 +89,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
)
}
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', tarot: '오늘 타로', ootd: '오늘 코디', level: '내 레벨', levelUp: '레벨이 올랐어요', gameHelp: '구름 합치기 하는 법' } as const
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', tarot: '오늘 타로', level: '내 레벨', levelUp: '레벨이 올랐어요', gameHelp: '구름 합치기 하는 법' } as const
/** 아래에서 올라오는 창: 네이티브 <dialog>라 ESC·포커스 가두기·포커스 되돌리기가 기본으로 된다 */
function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void }) {
@@ -178,7 +177,6 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
{shown.type === 'install' && <InstallSheet />}
{shown.type === 'weatherWhy' && <WeatherWhySheet d={shown.why} />}
{shown.type === 'tarot' && <TarotSheet />}
{shown.type === 'ootd' && <OotdSheet />}
{shown.type === 'level' && <LevelSheet />}
{shown.type === 'levelUp' && <LevelUpSheet level={shown.level} />}
{shown.type === 'talk' && <TalkSheet talk={shown.talk} />}
@@ -1045,7 +1043,7 @@ function LoginSheet({ onDone, onLoggedIn, why }: { onDone: () => void; onLoggedI
return (
<Body>
<div className="flex flex-col gap-2.5">
<p className="text-center text-sm font-semibold text-(--ink2)">{why === 'level' ? '로그인하면 출석·타로·사주로 각이 쌓여 레벨이 올라요.' : '글쓰기는 로그인한 뒤에 할 수 있어요.'}</p>
<p className="text-center text-sm font-semibold text-(--ink2)">{why === 'level' ? '로그인하면 출석·사주·좋아요로 각이 쌓여 레벨이 올라요.' : '글쓰기는 로그인한 뒤에 할 수 있어요.'}</p>
<GoogleButton
onResult={(res) => {
setError('')
+2
View File
@@ -0,0 +1,2 @@
/** 잠시 숨긴 기능 (아이콘 줄·각 모으는 법에서 뺀다). 다시 보이려면 여기서 지운다 */
export const HIDDEN = new Set<string>(['tarot'])
+2 -1
View File
@@ -4,6 +4,7 @@ import { attendMutation, myLevelOptions, myLevelQueryKey, sharedMutation } from
import type { ResLevel } from '@nalssigak/shared/api/client/types.gen'
import { cx } from '../lib/utils'
import { useAuth } from './authContext'
import { HIDDEN } from './features'
import { useSheet } from './sheetContext'
import { Ic } from './ui'
@@ -133,7 +134,7 @@ export function LevelSheet() {
<section>
<h4 className="m-0 mb-2 text-sm font-extrabold">오늘 받을 수 있는 각</h4>
<ul className="m-0 list-none rounded-2xl bg-white p-0 shadow-[inset_0_-4px_0_var(--shade)]">
{(level.today ?? []).map((a) => {
{(level.today ?? []).filter((a) => !HIDDEN.has(a.action)).map((a) => {
const done = a.earned >= a.cap
return (
<li key={a.action} className="flex items-center gap-2.5 border-b border-[#eef1f6] px-3.5 py-2.5 text-[13.5px] font-bold last:border-0">
-1
View File
@@ -22,7 +22,6 @@ export type SheetState =
| { type: 'weatherWhy'; why: WeatherWhyPayload }
| { type: 'talk'; talk: TalkData }
| { type: 'tarot' }
| { type: 'ootd' }
| { type: 'level' }
| { type: 'levelUp'; level: number }
| { type: 'gameHelp' }
+4 -63
View File
@@ -1,13 +1,9 @@
import { useState, type ReactNode } from 'react'
import { type ReactNode } from 'react'
import { Link } from 'react-router'
import { useQuery } from '@tanstack/react-query'
import { getPostOptions, latestCardOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
import { kst } from '@nalssigak/shared/lib'
import { track } from '../lib/analytics'
import { HIDDEN } from './features'
import { useFoliage } from './foliage'
import { useTarotBadge } from './fortune'
import { PostCard, PostCardSkel } from './Post'
import { useRegion } from './regionContext'
import { sajuSeenToday } from './SajuPage'
import { useSheet } from './sheetContext'
import { Ic, Rail } from './ui'
@@ -15,34 +11,6 @@ import { Ic, Rail } from './ui'
/** 오늘 탭 '내 각' 줄 자리 (아이콘에서 거기로 내려간다) */
export const MY_GAK_ID = 'my-gak'
const OOTD_SEEN = 'nalssigak.b.ootdSeen'
function readSeen() {
try {
return Number(localStorage.getItem(OOTD_SEEN)) || null
} catch {
// 사파리 프라이빗 모드 등에서는 저장소를 못 쓴다 → 매번 새로 보는 것으로
return null
}
}
function markSeen(postId: number) {
try {
localStorage.setItem(OOTD_SEEN, String(postId))
} catch (e) {
console.warn('[ootd] 본 코디를 저장하지 못함', e)
}
}
function isToday(iso?: string | null) {
if (!iso) return false
const a = kst(iso)
const b = kst(new Date())
return a.y === b.y && a.mo === b.mo && a.d === b.d
}
const useLatestOotd = () => useQuery({ ...latestCardOptions({ query: { template: 'ootd' } }), staleTime: 10 * 60_000 })
type Item = { key: string; label: string; icon: string; badge?: ReactNode; to?: string; onClick?: () => void }
const Dot = () => <span className="absolute -top-0.5 -right-0.5 size-[11px] rounded-full border-2 border-white bg-[#ff4d4f]" />
@@ -51,10 +19,7 @@ const Dot = () => <span className="absolute -top-0.5 -right-0.5 size-[11px] roun
export function TodayIcons() {
const { open } = useSheet()
const tarot = useTarotBadge()
const ootd = useLatestOotd().data
const [seen, setSeen] = useState(readSeen)
const { inSeason } = useFoliage()
const newOotd = !!ootd?.post_id && isToday(ootd.published_at) && seen !== ootd.post_id
const items: Item[] = [
{
@@ -69,24 +34,12 @@ export function TodayIcons() {
onClick: () => open({ type: 'tarot' }),
},
{ key: 'saju', label: '날씨 사주', icon: 'yin_yang', badge: sajuSeenToday() ? null : <Dot />, to: '/saju' },
{
key: 'ootd',
label: '오늘 코디',
icon: 'tshirt',
badge: newOotd ? <Dot /> : null,
onClick: () => {
if (ootd?.post_id) {
markSeen(ootd.post_id)
setSeen(ootd.post_id)
}
open({ type: 'ootd' })
},
},
{ key: 'game', label: '날씨 게임', icon: 'game', to: '/game' },
...(inSeason ? [{ key: 'foliage', label: '단풍 지도', icon: 'maple', to: '/foliage' }] : []),
{ key: 'shorts', label: '쇼츠', icon: 'clapper', to: '/shorts' },
{ key: 'myGak', label: '내 각', icon: 'rabbit', onClick: () => document.getElementById(MY_GAK_ID)?.scrollIntoView({ behavior: 'smooth', block: 'start' }) },
{ key: 'talk', label: '동네 이야기', icon: 'speech', to: '/talk' },
]
].filter((it) => !HIDDEN.has(it.key))
const tile = (it: Item) => (
<>
@@ -124,15 +77,3 @@ export function TodayIcons() {
)
}
/** 오늘 코디 창: 오늘 피드에 올린 코디 카드 (오늘 것이 없으면 안내) */
export function OotdSheet() {
const { region } = useRegion()
const latest = useLatestOotd()
const postId = latest.data?.post_id
const today = isToday(latest.data?.published_at)
const post = useQuery({ ...getPostOptions({ path: { post_id: postId ?? 0 }, query: { region: region.code } }), enabled: !!postId && today })
if (latest.isPending || (postId && today && post.isPending)) return <PostCardSkel />
if (!postId || !today || !post.data?.post) return <p className="m-0 px-4 py-10 text-center text-[14px] font-semibold text-(--ink2)">아직 오늘 코디가 없어요</p>
return <PostCard post={post.data.post} />
}