diff --git a/apps/web/src/components/BotActivity.tsx b/apps/web/src/components/BotActivity.tsx index f0fbe39..1be981d 100644 --- a/apps/web/src/components/BotActivity.tsx +++ b/apps/web/src/components/BotActivity.tsx @@ -3,14 +3,15 @@ import { useRoom } from '../net/socket'; /** * What the computers are doing right now (docs/06 Β§12.1): "πŸ€– 컴퓨터 1 생각 쀑…", "πŸ’¬ 컴퓨터 2 μž…λ ₯ 쀑…", and people - * typing ("πŸ’¬ 고양이 μž…λ ₯ 쀑…", `ch`: the room chat or the game's own public chat). + * typing ("πŸ’¬ 고양이 μž…λ ₯ 쀑…", `ch`: the room chat or the game's own public chat). `hide`: ids left out (라이어 κ²Œμž„: + * the computer typing its description is not typing in the chat). * Not announced to screen readers: the chat line or the move that follows is. */ -export function BotActivity({ room, only, ch }: { room: RoomView; only?: 'typing'; ch?: 'room' | 'game' }) { +export function BotActivity({ room, only, ch, hide }: { room: RoomView; only?: 'typing' | 'thinking'; ch?: 'room' | 'game'; hide?: string[] }) { const typing = useRoom((s) => s.typing); const me = useRoom((s) => s.me?.id); - const entries = Object.entries(room.botActivity ?? {}).filter(([, a]) => !only || a === only); - const people = ch ? Object.entries(typing).filter(([id, t]) => t.ch === ch && id !== me) : []; + const entries = Object.entries(room.botActivity ?? {}).filter(([id, a]) => (!only || a === only) && !hide?.includes(id)); + const people = ch && only !== 'thinking' ? Object.entries(typing).filter(([id, t]) => t.ch === ch && id !== me && !hide?.includes(id)) : []; if (!entries.length && !people.length) return null; const name = (id: string, fallback: string) => room.seats.find((s) => s?.user.id === id)?.user.nickname ?? room.spectators.find((u) => u.id === id)?.nickname ?? fallback; diff --git a/apps/web/src/games/liar/index.tsx b/apps/web/src/games/liar/index.tsx index d35c0d4..ee65bd0 100644 --- a/apps/web/src/games/liar/index.tsx +++ b/apps/web/src/games/liar/index.tsx @@ -16,6 +16,8 @@ import { cssEsc, useBanner, type BannerTone } from '../card-fx'; import { ChatMessage, nameHue, sameRun } from '../../components/ChatMessage'; import { useStickToBottom } from '../../lib/useStickToBottom'; import { keepFocus, useTypingSignal } from '../../lib/chat-input'; +import { useRoom } from '../../net/socket'; +import { BotActivity } from '../../components/BotActivity'; import type { BoardProps, GameUI, OptionsProps } from '../types'; import { helpNow } from './help'; import { quickStart } from './quick'; @@ -116,6 +118,7 @@ button.lg-tile { cursor: pointer; } .lg-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); flex-wrap: nowrap; } .lg-form .input { flex: 1; min-height: 44px; min-width: 0; } .lg-actions .lg-form { padding: 0; border: 0; } +.lg-chat .bot-activity { padding: 4px 10px 0; } .lg-why { padding: 8px 10px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--text-sub); font-weight: 600; margin: 0; } .lg-big { display: flex; flex-wrap: wrap; gap: 8px; } .lg-big .btn { flex: 1 1 auto; min-height: 52px; } @@ -434,6 +437,8 @@ function ChatBox({ v, players, me, act }: { v: LiarView; players: Record a.at - b.at || (a.k === b.k ? 0 : a.k === 'sys' ? -1 : 1)); const canWrite = !!v.my?.canChat; const typing = useTypingSignal('game', canWrite); + // Who is typing sits right above the input, inside the chat (not on the status row: `typingInChat`). + const room = useRoom((s) => s.room); const inputRef = useRef(null); const why = !me || !v.my ? 'κ΄€μ „ μ€‘μ—λŠ” μ±„νŒ…μ„ μ“Έ 수 μ—†μ–΄μš”.' : (v.my.chatWhy ?? ''); return ( @@ -453,6 +458,7 @@ function ChatBox({ v, players, me, act }: { v: LiarView; players: Record + {room && } {canWrite ? (
= { quickStart, helpNow, ownChat: true, + typingInChat: true, }; export default ui; diff --git a/apps/web/src/games/types.ts b/apps/web/src/games/types.ts index 2e707a1..d07152c 100644 --- a/apps/web/src/games/types.ts +++ b/apps/web/src/games/types.ts @@ -39,6 +39,8 @@ export interface GameUI { Rules: ComponentType<{ options?: O }>; /** The board has its own chat channels; the room chat panel is hidden while the game runs (λ§ˆν”Όμ•„). */ ownChat?: boolean; + /** The board's chat box shows who is typing in it ("μž…λ ₯ 쀑…"); the status row then shows only the computers thinking (라이어 κ²Œμž„). */ + typingInChat?: boolean; /** 30초 κ·œμΉ™ μš”μ•½: 3 cards shown the first time this device plays the game (docs/07 Β§5). */ quickStart?: QuickCard[]; /** [?] "μ§€κΈˆ ν•  수 μžˆλŠ” 것": the current situation in plain words for this viewer (docs/07 Β§5). */ diff --git a/apps/web/src/pages/RoomPage.tsx b/apps/web/src/pages/RoomPage.tsx index 6d51350..422f50c 100644 --- a/apps/web/src/pages/RoomPage.tsx +++ b/apps/web/src/pages/RoomPage.tsx @@ -710,7 +710,7 @@ function GameView({ room, ui, me, players, pending, slow }: { room: RoomView; ui {status} - + {ui.typingInChat ? : } {room.status === 'paused' && room.hostId === me.id && (