채팅을 따로 분리해 속도 제한 없이: 방 채팅·마피아·라이어·그림 맞히기(그리기 전) 채팅의 줄 간격 제한(chat-pace)과 브라우저 대기열을 없애 치는 대로 바로 보냄. 서버 연결당 공용 한도(초당 20개)를 채팅·입력 중 신호가 같이 써서 빠르게 치면 15번째 줄부터 조용히 사라지던 문제도: 채팅은 별도 한도(초당 50, 최대 200, 매크로 도배 방지용)로 분리. 게임 채팅은 보내는 동안 게임 버튼을 잠그지 않음(pending 미설정)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 08:58:17 +09:00
parent 13a89a645e
commit 4d1deb8346
26 changed files with 122 additions and 162 deletions

View File

@@ -15,7 +15,7 @@ import { haptic, sfx, sounds, tone } from '../../lib/feedback';
import { cssEsc, useBanner, type BannerTone } from '../card-fx';
import { ChatMessage, nameHue, sameRun } from '../../components/ChatMessage';
import { useStickToBottom } from '../../lib/useStickToBottom';
import { useChatOutbox, useTypingSignal } from '../../lib/chat-input';
import { useTypingSignal } from '../../lib/chat-input';
import type { BoardProps, GameUI, OptionsProps } from '../types';
import { helpNow } from './help';
import { quickStart } from './quick';
@@ -426,7 +426,7 @@ const runKey = (l: Line | undefined) => l && { from: l.k === 'chat' ? l.from : n
function ChatBox({ v, players, me, act }: { v: LiarView; players: Record<string, PublicUser>; me: string | null; act: (a: unknown) => void }) {
const [text, setText] = useState('');
const { ref: listRef, pin } = useStickToBottom<HTMLDivElement>();
const send = useChatOutbox((t: string) => act({ type: 'chat', text: t }));
const send = (t: string) => act({ type: 'chat', text: t });
const lines: Line[] = [
...v.events.filter((e) => e.t !== 'phase' || e.kind === 'discussion' || e.kind === 'vote' || e.kind === 'guess').map((e) => ({ k: 'sys' as const, e, at: e.at })),
...v.chat.map((m) => ({ k: 'chat' as const, text: m.text, from: m.from, key: `c${m.n}`, at: m.at })),

View File

@@ -15,7 +15,7 @@ import { haptic, noise, sfx, sounds, tone } from '../../lib/feedback';
import { useBanner, type BannerTone } from '../card-fx';
import { ChatMessage, sameRun } from '../../components/ChatMessage';
import { useStickToBottom } from '../../lib/useStickToBottom';
import { useChatOutbox, useTypingSignal } from '../../lib/chat-input';
import { useTypingSignal } from '../../lib/chat-input';
import type { BoardProps, GameUI, OptionsProps } from '../types';
import { helpNow } from './help';
import { quickStart } from './quick';
@@ -458,8 +458,8 @@ function ChatBox({ v, players, me, act }: { v: MafiaView; players: Record<string
const [text, setText] = useState('');
const [seen, setSeen] = useState<Record<string, number>>({});
const { ref: listRef, pin } = useStickToBottom<HTMLDivElement>();
// Lines typed quickly all go out at once (only a flood waits; the game refuses faster ones).
const send = useChatOutbox<{ channel: Channel; text: string }>((m) => act({ type: 'chat', ...m }));
// Every line goes out the moment it is typed (no pace limit).
const send = (m: { channel: Channel; text: string }) => act({ type: 'chat', ...m });
const cur: Channel = tabs.includes(tab) ? tab : 'day';
// Day → 전체; night → the first private channel I may write in (only on my own screen).
const phaseKey = `${v.day}-${v.phase.kind}`;