PC 창을 줄였을 때(720~1099px)도 채팅: 옆 채팅 칸이 없는 폭이면 방 막대에 💬 채팅 버튼(전에는 휴대폰 폭에서만 보여 이 구간엔 채팅이 아예 없었음). 넓은 폭에선 버튼과 시트를 숨김. chat.e2e.ts에 900/760px 확인 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-14 09:32:16 +09:00
parent 92aebb6a19
commit e0139f412e
2 changed files with 24 additions and 7 deletions

View File

@@ -95,6 +95,8 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
const [ui, setUi] = useState<GameUI | null>(null);
const [leaveAsk, setLeaveAsk] = useState(false);
const [chatOpen, setChatOpen] = useState(false);
// Under 1100px there is no chat column (Lobby/GameView), so the bar carries a 💬 button — phones and narrowed PC windows alike.
const wide = useWide();
// 설정 opens as a popup over the room: going to /me would unmount the room and detach from it.
const [settingsOpen, setSettingsOpen] = useState(false);
const closeSettings = useCallback(() => setSettingsOpen(false), []);
@@ -213,11 +215,7 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
className="btn btn-ghost btn-sm rb-btn"
/>
<span style={{ flex: 1 }} />
{!roomChatClosed && (
<span className="phone-only">
<ChatButton onOpen={() => setChatOpen(true)} />
</span>
)}
{!roomChatClosed && !wide && <ChatButton onOpen={() => setChatOpen(true)} />}
<VolumeControl className="btn btn-ghost btn-sm rb-btn" label />
<button className="btn btn-ghost btn-sm rb-btn" onClick={() => setRulesOpen(true)} aria-haspopup="dialog" aria-label="규칙 보기">
<span className="rb-ico">📖</span>
@@ -240,7 +238,7 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
)}
{room.status === 'finished' && result && game && !backInLobby && <ResultPanel room={room} me={me} players={players} onLeave={doLeave} onAgain={toLobby} />}
<EmoteBubbles room={room} />
{chatOpen && !roomChatClosed && (
{chatOpen && !roomChatClosed && !wide && (
<Sheet onClose={() => setChatOpen(false)} label="채팅">
<ChatPanel room={room} me={me} />
<button className="btn btn-secondary btn-block" onClick={() => setChatOpen(false)}>

View File

@@ -1,7 +1,7 @@
/**
* E2E: the room chat stays at the newest line (also after more than 100 lines, when the list is full), lets the reader
* scroll up without jumping, shows who said what as a name line + bubble, and has no "가리기" button any more.
* PC lobby + PC in-game side panel + phone chat sheet (unread badge past 100 lines too).
* PC lobby + PC in-game side panel + phone chat sheet (unread badge past 100 lines too) + narrowed PC window (720–1099px) chat button.
* Run: E2E_PORT=4641 bun e2e/chat.e2e.ts (needs apps/web/dist built)
*/
import { chromium, type Page } from 'playwright-core';
@@ -222,6 +222,25 @@ try {
await sheet.getByRole('button', { name: '닫기' }).click();
});
await step('PC 창을 줄여도(720~1099px) 채팅 버튼으로 채팅을 볼 수 있음', async () => {
for (const width of [900, 760]) {
await a.setViewportSize({ width, height: 900 });
await a.waitForTimeout(150);
if (await a.locator('.chat-panel').count()) throw new Error(`${width}px: unexpected inline chat panel`);
await a.locator('.room-bar').getByRole('button', { name: /^채팅/ }).click();
const sheet = a.getByRole('dialog', { name: '채팅' });
await sheet.locator('.chat-line', { hasText: '치는 중 계속' }).waitFor();
await say(a, `줄인 창 ${width}`);
await sheet.locator('.chat-line', { hasText: `줄인 창 ${width}` }).waitFor();
if (width === 900) await a.screenshot({ path: join(SHOTS, 'chat-sheet-pc-narrow.png') });
await sheet.getByRole('button', { name: '닫기' }).click();
}
// Wide again: the side panel is back and the bar button goes away.
await a.setViewportSize({ width: 1440, height: 900 });
await a.locator('.chat-panel').first().waitFor();
if (await a.locator('.room-bar').getByRole('button', { name: /^채팅/ }).count()) throw new Error('chat button still on the wide bar');
});
await step('소리 크기: 방 막대 오른쪽 위, 기본 50, 0~100', async () => {
const btn = a.locator('.room-bar').getByRole('button', { name: /^소리 크기/ });
if ((await btn.getAttribute('aria-label')) !== '소리 크기 50') throw new Error(`default: ${await btn.getAttribute('aria-label')}`);