From 03e0e8ed84d25ae59f8725018dde9a4801597ca8 Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sun, 18 Oct 2026 01:25:13 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EC=96=B4=20=EA=B2=8C?= =?UTF-8?q?=EC=9E=84:=20"=EC=9E=85=EB=A0=A5=20=EC=A4=91=E2=80=A6"=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=EB=A5=BC=20=EC=98=A4=EB=A5=B8=EC=AA=BD=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EC=A4=84=EC=97=90=EC=84=9C=20=ED=86=A0?= =?UTF-8?q?=EB=A1=A0=20=EC=B1=84=ED=8C=85=20=EC=B9=B8=20=EC=95=88(?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EC=B9=B8=20=EB=B0=94=EB=A1=9C=20=EC=9C=84)?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GameUI.typingInChat: 게임 채팅 칸이 입력 중 표시를 맡고, 상태 줄은 컴퓨터 "생각 중"만 보인다 - BotActivity: only='thinking', hide(설명 차례인 컴퓨터는 채팅이 아니라 설명을 치는 중이라 빼기) - e2e: 토론 중 입력하면 다른 사람 화면의 토론 채팅 칸 안에만 "입력 중"이 보이는지 확인 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/BotActivity.tsx | 9 +++++---- apps/web/src/games/liar/index.tsx | 7 +++++++ apps/web/src/games/types.ts | 2 ++ apps/web/src/pages/RoomPage.tsx | 2 +- e2e/games.e2e.ts | 8 ++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) 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 && (