From b81b4f60be8ab7a33f0da4019fdfcb637f2d0a9a Mon Sep 17 00:00:00 2001 From: EJClaw Date: Fri, 9 Oct 2026 00:16:10 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=A0=95=EB=A6=AC:=20?= =?UTF-8?q?=ED=95=9C=EB=88=88=EC=97=90=20=EB=93=A4=EC=96=B4=EC=98=A4?= =?UTF-8?q?=EA=B2=8C=20(=ED=99=88=20=EA=B2=8C=EC=9E=84=20=ED=83=80?= =?UTF-8?q?=EC=9D=BC=C2=B7=EC=A2=85=EB=A5=98=20=ED=83=AD,=20=EB=B0=A9=20?= =?UTF-8?q?=EC=95=88=20=EC=83=81=EB=8B=A8=20=EB=A7=89=EB=8C=80=20=ED=95=9C?= =?UTF-8?q?=20=EC=A4=84,=20=EB=8C=80=EA=B8=B0=EC=8B=A4=C2=B7=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=C2=B7=EC=84=A4=EC=A0=95=20=EA=B0=84=EC=86=8C=ED=99=94?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "한 화면에 정보가 너무 많아 한눈에 들어오지 않는다" 피드백. NN/g 점진적 공개, 토스 "한 화면 한 가지", BGA 화면 지침, Hick의 법칙을 참고해 docs/07 §1에 원칙 8번으로 정리하고 화면에 적용했다. - 홈·게임 목록: 게임 카드를 아이콘·이름·"2명 · 5~15분" 타일로 줄이고(설명·난이도는 게임 소개에만), 휴대폰 3열. [전체][판·주사위][카드·패][여럿이 파티] 탭. 휴대폰 홈 세로 길이 약 1/4. 휴대폰에서 [방 만들기]는 한 줄, [코드로 참여]·[컴퓨터와 연습]은 나란히. - 방 안: 사이트 상단 메뉴를 숨기고 방 막대 한 줄만(--site-h 변수, 방 안에서는 0). - 대기실: 초대 카드는 빈자리가 있을 때만, 버튼은 [링크 복사][공유하기/초대글 복사] 두 개 (QR은 빈자리 칸 "+ 빈자리 · 📷 QR로 초대"). PC 대기실의 규칙 전문 카드와 "바꾸면 바로 적용돼요" 제거. 게스트 경고는 시작 버튼 아래 한 줄로. - 채팅 빠른 반응은 한 줄(넘치면 옆으로). - 결과 창: 진한 버튼은 [한 판 더] 하나, [판 보기][▶ 다시 보기]는 한 줄. - 설정(/me): 항목 이름과 선택지를 한 줄에. - E2E: 다시 보기 링크 이름, 컴퓨터 상대의 "게임 중 홈으로"는 앱 안 이동으로. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/GameGrid.tsx | 53 +++++++--- apps/web/src/components/NicknameForm.tsx | 3 +- apps/web/src/games/marble/index.tsx | 2 +- apps/web/src/games/yacht/index.tsx | 2 +- apps/web/src/games/yut/index.tsx | 2 +- apps/web/src/lib/catalog-ui.ts | 7 ++ apps/web/src/pages/MePage.tsx | 4 +- apps/web/src/pages/RoomPage.tsx | 47 ++++----- apps/web/src/styles/global.css | 128 +++++++++++++++++++++-- docs/05-accounts-auth.md | 2 +- docs/06-lobby-rooms.md | 9 +- docs/07-ui-ux.md | 22 +++- docs/09-game-engine.md | 2 +- e2e/bots.e2e.ts | 8 +- e2e/replay.e2e.ts | 4 +- 15 files changed, 225 insertions(+), 70 deletions(-) diff --git a/apps/web/src/components/GameGrid.tsx b/apps/web/src/components/GameGrid.tsx index c505b56..566a473 100644 --- a/apps/web/src/components/GameGrid.tsx +++ b/apps/web/src/components/GameGrid.tsx @@ -1,24 +1,43 @@ +import { useState } from 'react'; import { Link } from 'react-router'; import type { CatalogEntry } from '@bg/shared/lite'; -import { GAME_ICON } from '../lib/catalog-ui'; +import { GAME_GROUPS, GAME_ICON } from '../lib/catalog-ui'; -export function GameGrid({ games, columns = 'repeat(auto-fill, minmax(200px, 1fr))' }: { games: CatalogEntry[]; columns?: string }) { +/** + * Game picker (docs/07 §3.3): small tiles with icon, name and one meta line. The one-line blurb and + * difficulty live on the game page, so 26 games fit on a phone in a few screens. A tab row narrows the list. + */ +export function GameGrid({ games }: { games: CatalogEntry[] }) { + const [group, setGroup] = useState('all'); + const groups = GAME_GROUPS.filter((g) => games.some((x) => g.ids.includes(x.id))); + const shown = group === 'all' ? games : games.filter((g) => GAME_GROUPS.find((x) => x.key === group)?.ids.includes(g.id)); return ( -
- {games.map((g) => ( - - - {GAME_ICON[g.id] ?? '🎲'} - - {g.nameKo} - {g.blurb} - - {g.minPlayers === g.maxPlayers ? `${g.minPlayers}명` : `${g.minPlayers}~${g.maxPlayers}명`} - {g.minutes}분 - {g.level} - - - ))} +
+ {groups.length > 1 && ( +
+ + {groups.map((g) => ( + + ))} +
+ )} +
+ {shown.map((g) => ( + + + {GAME_ICON[g.id] ?? '🎲'} + + {g.nameKo} + + {g.minPlayers === g.maxPlayers ? `${g.minPlayers}명` : `${g.minPlayers}~${g.maxPlayers}명`} · {g.minutes}분 + + + ))} +
); } diff --git a/apps/web/src/components/NicknameForm.tsx b/apps/web/src/components/NicknameForm.tsx index 9410b3f..8a0ce20 100644 --- a/apps/web/src/components/NicknameForm.tsx +++ b/apps/web/src/components/NicknameForm.tsx @@ -72,8 +72,9 @@ export function NicknameForm({ } /** Guests are deleted with their records a day after they leave the site (docs/05 §4). */ -export function GuestWarning() { +export function GuestWarning({ short }: { short?: boolean }) { const discord = useSession((s) => s.discordEnabled); + if (short) return

⚠️ 게스트 기록은 하루 동안 안 들어오면 지워져요.

; return (

⚠️ 게스트는 기록이 오래 저장되지 않아요. 사이트에 들어오지 않은 채 하루가 지나면 계정과 기록이 모두 지워져요. diff --git a/apps/web/src/games/marble/index.tsx b/apps/web/src/games/marble/index.tsx index 58530c4..d01a825 100644 --- a/apps/web/src/games/marble/index.tsx +++ b/apps/web/src/games/marble/index.tsx @@ -81,7 +81,7 @@ function useCompact(): boolean { const CSS = ` .mb-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; } -.mb-box { position: relative; width: 100%; max-width: min(100%, calc(100vh - 64px - 52px - 36px)); aspect-ratio: 1 / 1; } +.mb-box { position: relative; width: 100%; max-width: min(100%, calc(100vh - var(--site-h) - 52px - 36px)); aspect-ratio: 1 / 1; } @media (max-width: 1099px) { .mb-box { max-width: min(100%, 760px); } } .mb-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 16px; box-shadow: var(--shadow); background: var(--surface-2); touch-action: manipulation; user-select: none; } .mb-cell { cursor: pointer; outline: none; } diff --git a/apps/web/src/games/yacht/index.tsx b/apps/web/src/games/yacht/index.tsx index e0d46ad..c45b6e0 100644 --- a/apps/web/src/games/yacht/index.tsx +++ b/apps/web/src/games/yacht/index.tsx @@ -83,7 +83,7 @@ const CSS = ` @media (min-width: 1100px) { .yt-wrap { display: grid; grid-template-columns: 380px minmax(0, 1fr); align-items: start; max-height: 100%; } .yt-die { --s: 64px; } - .yt-sheet { max-height: calc(100vh - 64px - 52px - 40px); } + .yt-sheet { max-height: calc(100vh - var(--site-h) - 52px - 40px); } .yt-table th, .yt-table td { height: 34px; } .yt-cell { height: 30px; } } diff --git a/apps/web/src/games/yut/index.tsx b/apps/web/src/games/yut/index.tsx index 7ad3b1d..634178b 100644 --- a/apps/web/src/games/yut/index.tsx +++ b/apps/web/src/games/yut/index.tsx @@ -75,7 +75,7 @@ const CSS = ` .yut-ctrl { display: flex; flex-direction: column; gap: 12px; min-width: 0; } @media (min-width: 1100px) { .yut-wrap { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; } - .yut-board-box { max-width: min(100%, calc(100vh - 64px - 52px - 40px)); } + .yut-board-box { max-width: min(100%, calc(100vh - var(--site-h) - 52px - 40px)); } } .yut-chips { display: flex; flex-wrap: wrap; gap: 8px; } .yut-chip { min-width: 64px; min-height: 64px; border-radius: 14px; border: 3px solid var(--border); background: var(--surface); color: var(--text); diff --git a/apps/web/src/lib/catalog-ui.ts b/apps/web/src/lib/catalog-ui.ts index d79757d..14d47ea 100644 --- a/apps/web/src/lib/catalog-ui.ts +++ b/apps/web/src/lib/catalog-ui.ts @@ -29,3 +29,10 @@ export const GAME_ICON: Record = { /** Shown on the home screen so users know what's coming (docs/12-roadmap.md). */ export const UPCOMING: string[] = []; + +/** Tabs on the game picker (docs/07 §3.3). Games not listed here only show under 전체. */ +export const GAME_GROUPS: { key: string; label: string; ids: string[] }[] = [ + { key: 'board', label: '판·주사위', ids: ['omok', 'othello', 'chess', 'janggi', 'baduk', 'quoridor', 'yut', 'marble', 'yacht', 'las-vegas'] }, + { key: 'cards', label: '카드·패', ids: ['seotda', 'poker', 'one-card', 'gostop', 'dalmuti', 'splendor', 'cockroach-poker', 'ninety-nine', 'mahjong', 'rummikub', 'davinci-code'] }, + { key: 'party', label: '여럿이 파티', ids: ['bang', 'halli-galli', 'dobble', 'catchmind', 'mafia'] }, +]; diff --git a/apps/web/src/pages/MePage.tsx b/apps/web/src/pages/MePage.tsx index 6322c1e..a02e89b 100644 --- a/apps/web/src/pages/MePage.tsx +++ b/apps/web/src/pages/MePage.tsx @@ -12,7 +12,7 @@ import { toast } from '../store/toast'; function Seg({ value, options, onChange, label }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string }) { return ( -

+
{label}
{options.map(([k, l]) => ( @@ -62,7 +62,7 @@ export default function MePage() { updateSettings({ tapConfirm: v === 'on' })} /> diff --git a/apps/web/src/pages/RoomPage.tsx b/apps/web/src/pages/RoomPage.tsx index c44e034..0e7b31b 100644 --- a/apps/web/src/pages/RoomPage.tsx +++ b/apps/web/src/pages/RoomPage.tsx @@ -105,6 +105,11 @@ function Room({ code, me }: { code: string; me: PublicUser }) { }, [room]); useTurnTitle(ui, game?.view, me.id); + // Inside a room the room bar replaces the site header, so the board gets that height back. + useEffect(() => { + document.documentElement.classList.add('in-room'); + return () => document.documentElement.classList.remove('in-room'); + }, []); if (status === 'replaced') { return ( @@ -291,19 +296,17 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser }) const firstEmpty = room.seats.findIndex((s) => s === null); const wide = useWide(); - const invite = ( + // Only while a seat is empty: once everyone is in, the room bar's link button is enough. + const invite = firstEmpty >= 0 && (

친구에게 이 코드를 알려 주세요

-
- + {/* QR lives on the empty seat button ("+ 빈자리 · QR로 초대"), so this row stays two buttons. */} +
-
); @@ -349,7 +352,7 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser }) ) : (
{canAddBot && i === firstEmpty && (
{practice &&

🤖 연습 게임이에요. 기록에는 남지 않아요.

} - {me.kind === 'guest' && !practice && } {room.lockedOptions.length > 0 &&

🔒 일부 규칙은 관리자가 정해 두어서 바꿀 수 없어요.

} {isHost && wide && } @@ -430,17 +432,12 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser })
{invite} {wide ? settingsCard : seats} - {wide && ( -
-

규칙 요약

- -
- )} {!wide && settingsCard}
-
+
{wide && seats} {action} + {me.kind === 'guest' && !practice && } {wide && }
@@ -527,7 +524,6 @@ function SettingsForm({ room, ui, inline, onDone }: { room: RoomView; ui: GameUI return (
{room.lockedOptions.length > 0 &&

🔒 관리자가 고정한 규칙은 바꿔도 저장되지 않아요.

} -

바꾸면 바로 적용돼요.


@@ -675,14 +671,17 @@ function ResultPanel({ room, me, players, onLeave }: { room: RoomView; me: Publi {voted ? `다른 사람을 기다리는 중… (${room.rematchVotes.length}/${seated.length})` : `🔁 한 판 더 (${room.rematchVotes.length}/${seated.length})`} )} - - {room.lastGamePk && result.ranking.some((g) => g.includes(me.id)) && ( - - ▶ 처음부터 다시 보기 - - )} + {/* One primary action (한 판 더); the rest share one quieter row. */} +
+ + {room.lastGamePk && result.ranking.some((g) => g.includes(me.id)) && ( + + ▶ 다시 보기 + + )} +
diff --git a/apps/web/src/styles/global.css b/apps/web/src/styles/global.css index 5a577e1..969e1ad 100644 --- a/apps/web/src/styles/global.css +++ b/apps/web/src/styles/global.css @@ -370,7 +370,7 @@ label.field { .toasts { position: fixed; - top: calc(64px + env(safe-area-inset-top)); + top: calc(var(--site-h) + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; @@ -698,10 +698,27 @@ button.header-user { } } +/* Site header height, used by the sticky room bar and the viewport-fitting game layout. + Inside a room the room bar is the only top bar (docs/07 §3.4): one bar, not two. */ +:root { + --site-h: 64px; +} +@media (max-width: 719px) { + :root { + --site-h: 56px; + } +} +:root.in-room { + --site-h: 0px; +} +.in-room .site-header { + display: none; +} + /* Room bar under the site header */ .room-bar { position: sticky; - top: 64px; + top: var(--site-h); z-index: 25; height: 52px; background: var(--bg); @@ -717,9 +734,6 @@ button.header-user { gap: 12px; } @media (max-width: 719px) { - .room-bar { - top: 56px; - } .room-bar-inner { padding: 0 8px; } @@ -746,7 +760,7 @@ button.header-user { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; - height: calc(100vh - 64px - 52px); + height: calc(100vh - var(--site-h) - 52px); min-height: 560px; } .game-main { @@ -778,7 +792,7 @@ button.header-user { } .board-wrap { - max-width: min(100%, calc(100vh - 64px - 52px - 120px)); + max-width: min(100%, calc(100vh - var(--site-h) - 52px - 120px)); width: 100%; } @media (max-width: 1099px) { @@ -816,11 +830,18 @@ button.header-user { .chat-line strong { margin-right: 6px; } +/* One line of quick reactions; the rest scrolls sideways instead of stacking rows. */ .emote-row { display: flex; - flex-wrap: wrap; + flex-wrap: nowrap; + overflow-x: auto; + scrollbar-width: none; gap: 4px; } +.emote-row button { + flex: none; + white-space: nowrap; +} .emote-row button { border: 1px solid var(--border); background: var(--bg); @@ -859,6 +880,80 @@ button.header-user { } .game-card { transition: transform 0.12s ease, box-shadow 0.12s ease; + text-decoration: none; + color: inherit; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + gap: 6px; + padding: 18px 10px 16px; +} +/* Game picker tiles: icon, name, one meta line (docs/07 §3.3). */ +.game-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); + gap: 12px; +} +.game-card-icon { + font-size: 2.4rem; + line-height: 1.1; +} +.game-card-name { + font-size: 1.05rem; + word-break: keep-all; +} +.game-card-meta { + font-size: 0.85rem; + color: var(--text-sub); +} +.game-tabs { + flex-wrap: nowrap; + overflow-x: auto; + scrollbar-width: none; +} +.game-tabs button { + flex: none; +} +@media (max-width: 719px) { + .game-grid { + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 8px; + } + .game-card { + padding: 14px 4px 12px; + } + .game-card-icon { + font-size: 2rem; + } + .game-card-name { + font-size: 0.95rem; + } + .game-card-meta { + font-size: 0.75rem; + } + /* 방 만들기 full width, the two smaller actions side by side. */ + .home-actions { + grid-template-columns: 1fr 1fr; + gap: 10px; + } + .home-action { + min-height: 0; + padding: 14px 16px; + } + .home-action.primary { + grid-column: 1 / -1; + } + .home-action-icon { + font-size: 1.6rem; + margin-bottom: 4px; + } + .home-action-title { + font-size: 1.1rem; + } + .home-action-sub { + font-size: 0.85rem; + } } .phone-only { display: none; @@ -1257,3 +1352,20 @@ button.header-user { .data-table.compact td { padding: 8px 8px; } + +/* Settings: label and choices on one line (wraps under on narrow screens). */ +.setting-row { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 6px 12px; + padding: 6px 0; + border-top: 1px solid var(--border); +} +.setting-row:first-of-type { + border-top: 0; +} +.setting-row .segmented { + gap: 6px; +} diff --git a/docs/05-accounts-auth.md b/docs/05-accounts-auth.md index f268c0b..84c44ec 100644 --- a/docs/05-accounts-auth.md +++ b/docs/05-accounts-auth.md @@ -42,7 +42,7 @@ - 로그아웃: 세션 삭제 + 쿠키 삭제. 게스트가 로그아웃하면 게스트 계정을 지운다(방 자리, 전적, 세션 포함, 지난 대국 기록에는 '알 수 없음'으로 남음). 확인 창에서 지워진다고 알린다. - 게스트가 사이트를 닫고 하루(24시간) 동안 오지 않으면 같은 방식으로 지운다. 서버가 1분마다 `users.last_seen_at`(요청·소켓 종료 때 갱신)을 보고 정리하며, 소켓이 열려 있거나 방 자리를 갖고 있으면 건너뛴다. - 계정 페이지의 "모든 기기에서 로그아웃"은 그 사용자의 모든 세션 삭제. -- 게스트로 시작하는 곳(로그인 페이지, 이름 정하기 칸), 게스트의 /me, 게스트가 있는 대기실에 "⚠️ 게스트는 기록이 오래 저장되지 않아요. 사이트에 들어오지 않은 채 하루가 지나면 계정과 기록이 모두 지워져요." 경고를 보인다. +- 게스트로 시작하는 곳(로그인 페이지, 이름 정하기 칸), 게스트의 /me, 게스트가 있는 대기실(한 줄로 줄인 "⚠️ 게스트 기록은 하루 동안 안 들어오면 지워져요.")에 "⚠️ 게스트는 기록이 오래 저장되지 않아요. 사이트에 들어오지 않은 채 하루가 지나면 계정과 기록이 모두 지워져요." 경고를 보인다. ## 6. HTTP API | 메서드 | 경로 | 설명 | diff --git a/docs/06-lobby-rooms.md b/docs/06-lobby-rooms.md index 2504c6c..29f096e 100644 --- a/docs/06-lobby-rooms.md +++ b/docs/06-lobby-rooms.md @@ -31,13 +31,14 @@ 4. 옵션은 "기본 설정" 몇 개만 보이고 나머지는 "자세한 설정" 접기 안에 둔다. ## 5. 대기실 화면 (PC는 두 칸 배치 — `07-ui-ux.md` 3.4. 아래는 내용 순서이며 좁은 화면에서는 이 순서로 한 칸에 쌓인다) -1. **초대 카드**(가장 눈에 띄게): 큰 글씨 코드 `123 456` - - [코드 복사] [링크 복사] [공유하기](모바일: 공유 시트 → 카카오톡 등) [QR 보기](같은 공간의 가족이 폰으로 찍어서 입장) +1. **초대 카드**(가장 눈에 띄게, 빈자리가 있을 때만 — 다 차면 숨기고 방 막대의 🔗 링크 복사만 남긴다): 큰 글씨 코드 `123 456` + - [링크 복사] [공유하기](모바일: 공유 시트 → 카카오톡 등. 공유가 안 되는 PC는 [초대글 복사]) 두 개만. 코드는 크게 보이므로 따로 복사 버튼을 두지 않는다. QR(같은 공간의 가족이 폰으로 찍어서 입장)은 빈자리 칸 "+ 빈자리 · 📷 QR로 초대"를 누르면 뜬다. - 복사하면 버튼이 1.5초간 "복사했어요 ✓"로 바뀜 + 진동(지원 기기). - 공유 문구: "OO님이 오목 방에 초대했어요! 코드 123 456 · https://<도메인>/r/123456" -2. **자리 목록**: 게임 인원만큼 자리 칸. 각 칸: 프로필, 닉네임, 방장 왕관, 준비 체크, 연결 상태 점(초록/노랑/회색). 빈자리는 점선 "+ 초대하기"(누르면 초대 카드로 스크롤). +2. **자리 목록**: 게임 인원만큼 자리 칸. 각 칸: 프로필, 닉네임, 방장 왕관, 준비 체크, 연결 상태 점(초록/노랑/회색). 빈자리는 점선 "+ 빈자리 · 📷 QR로 초대"(누르면 QR. 아직 자리가 없는 사람에게는 "+ 여기 앉기"). - 닉네임(자리, 관전자 목록, 결과 화면)을 누르면 기록 카드가 뜬다: 이 게임의 판·승·패·무·승률, 이 방 전적, 전체 게임 합계. 패 = 판 - 승 - 무(1등이 아니면 패). 컴퓨터는 누를 수 없다. `GET /api/users/:id/stats`(로그인 필요). - - 게스트에게는 설정 카드에 "기록이 오래 저장되지 않고, 하루 동안 안 들어오면 계정과 기록이 지워진다"는 경고를 보인다(연습 방 제외). + - 게스트에게는 [게임 시작]/[준비하기] 아래에 한 줄로 "⚠️ 게스트 기록은 하루 동안 안 들어오면 지워져요."를 보인다(연습 방 제외). + - 규칙 설명은 대기실에 펼쳐 두지 않는다. 방 막대의 [📖 규칙]으로 본다. 3. **게임 설정 요약**: "오목 · 렌주룰 · 한 수 30초" + 방장에게만 [설정 바꾸기]. 4. **아래 고정 버튼**(엄지 닿는 곳): - 방장: [게임 시작] — 최소 인원이 안 되면 비활성 + "1명 더 필요해요" 안내. 모두 준비가 아니어도 시작 가능하되 "준비 안 된 사람이 있어요. 시작할까요?" 확인. diff --git a/docs/07-ui-ux.md b/docs/07-ui-ux.md index e04891b..dc43671 100644 --- a/docs/07-ui-ux.md +++ b/docs/07-ui-ux.md @@ -8,6 +8,12 @@ 5. **실수 방지.** 큰 결정(기권, 나가기, 올인, 다이)은 확인. 단, 매 턴 확인창은 금지(느려짐) — 대신 "두 번 눌러 확정" 옵션(바둑·오목 오착 방지, 기본 켜짐: 첫 탭은 미리보기 돌, 같은 곳을 다시 탭하면 착수). 6. **기다림을 보여 준다.** 남은 시간 링, "OO님이 생각 중…", 연결 상태. 7. **가볍게.** 장식 이미지 최소, 애니메이션은 짧게(150~250ms), `prefers-reduced-motion` 존중. +8. **한눈에 들어오게 (2026-10-09, "한 화면에 정보가 너무 많다" 피드백).** 참고: NN/g 점진적 공개(자주 쓰는 것만 첫 단계, 나머지는 이름이 분명한 두 번째 단계, 최대 2단계), 토스 "한 화면 한 가지", Board Game Arena 화면 지침(판이 가운데, 정보는 묶어서, 드문 정보는 버튼·접기 뒤로), Hick의 법칙(고를 것이 많으면 묶음 탭으로 나눈다). + - 같은 정보를 두 곳에 두지 않는다(방 안에서는 사이트 메뉴를 숨기고 방 막대 한 줄만, 대기실의 규칙 전문은 [📖 규칙]으로). + - 목록 카드는 이름 + 한 줄 정보만. 설명·난이도는 들어간 다음 화면에서. + - 지금 필요 없는 것은 숨긴다(자리가 다 차면 초대 카드, 처음부터 펼친 해시값 같은 세부 정보). + - 버튼은 화면마다 진한 것 하나. 나머지는 한 줄에 묶어 덜 진하게. + - 경고·안내 문구는 한 줄로 줄인다(전문은 처음 한 번, 로그인·이름 정하기·/me에서). ## 2. 디자인 토큰 ### 2.1 색 (밝은 테마 / 어두운 테마) @@ -66,17 +72,20 @@ │ [▶ 하던 게임으로 돌아가기] (있을 때만) │ │ [+ 방 만들기 (파란 큰 버튼)] [🔢 코드로 참여 → /j] [🤖 컴퓨터와 연습] │ ├──────────────────────────────────────────────────────────────────────────┤ -│ 게임 카드 격자 (4~5열, 카드에 인원·시간·난이도) │ +│ [전체] [판·주사위] [카드·패] [여럿이 파티] ← 종류 탭 │ +│ 게임 타일 격자 (PC 자동 열, 휴대폰 3열. 타일 = 아이콘·이름·"2명 · 5~15분") │ └──────────────────────────────────────────────────────────────────────────┘ ``` - 첫 화면에 다 넣지 않는다. 설명 글은 버튼 아래 한 줄만, 나머지는 탭이나 버튼을 눌러 들어간다. +- 게임 한 줄 소개와 난이도는 게임 소개(`/g/:id`)에만 둔다. 휴대폰에서 26개가 세 화면 남짓에 들어온다. +- 휴대폰: [+ 방 만들기]는 한 줄 전체, [코드로 참여]·[컴퓨터와 연습]은 그 아래 나란히. ### 3.4 대기실 (PC) ``` ┌──────────────────────────────┬────────────────────────────────┐ -│ 초대 카드(코드 크게, 복사·QR) │ 자리 목록(2~10칸 격자) │ -│ 게임 설정(펼쳐서 바로 수정 — 방장) │ 채팅(항상 보임) │ -│ 규칙 요약 │ [게임 시작] / [준비하기] │ +│ 초대 카드(빈자리 있을 때만) │ 자리 목록(2~10칸 격자) │ +│ 게임 설정(펼쳐서 바로 수정 — 방장) │ [게임 시작] / [준비하기] │ +│ │ 채팅(항상 보임) │ └──────────────────────────────┴────────────────────────────────┘ ``` @@ -95,6 +104,9 @@ - 카드 게임: 판 자리에 원형 테이블, 나는 항상 아래, 내 패는 판 아래쪽 넓게. - PC 조작: 마우스를 올리면 미리 보기 돌(반투명), 클릭 한 번에 착수(기본값). "두 번 눌러 확정"은 터치 기기의 기본값이고 설정에서 바꿀 수 있다. - 단축키: `Enter` 채팅 입력, `Esc` 창 닫기, 방향키+`Enter` 판 조작. +- 방 안(대기실·게임·결과)에서는 사이트 상단 메뉴를 숨기고 방 막대(← 홈 · 게임 이름 · 🔗 방 코드 · 📖 규칙 · ⚙️ 설정 · 🚪 나가기) 한 줄만 둔다. 판이 그만큼 커진다. 높이 계산은 CSS 변수 `--site-h`(방 안에서는 0)를 쓴다. +- 채팅의 빠른 반응(이모지·짧은 말)은 한 줄. 넘치면 옆으로 밀어 본다. +- 결과 창: 진한 버튼은 [🔁 한 판 더] 하나. [판 보기]·[▶ 다시 보기]는 한 줄에 나란히, [방 나가기]는 글자 버튼, 공정성 확인은 접어 둔다. ### 3.6 관리자 (PC) 왼쪽 사이드바(220px)에 메뉴, 오른쪽에 내용. 표는 PC에서 표 형태, 좁은 화면에서는 카드 목록. @@ -159,7 +171,7 @@ - 게임 상세 - 대기실(방장/참가자/관전자, 인원 부족/가득 참) - 게임 화면(내 차례/남의 차례/연결 끊김/자리 비움/일시 정지) -- 결과 화면(승/패/무승부, 한 판 더 투표 중, 처음부터 다시 보기) +- 결과 화면(승/패/무승부, 한 판 더 투표 중, ▶ 다시 보기) - 계정(게스트/디스코드, 내 게임 기록 목록 + [다시 보기]) - 다시 보기(`/replay/:gamePk`: 판은 읽기 전용, 처음/이전/재생·멈춤/다음/끝 + 슬라이더. PC는 오른쪽 칸, 폰은 아래 고정 막대. 못 보는 게임은 안내 문구, docs/09 §8) - 오류(방 없음, 방 가득 참, 서버 업데이트, 오프라인) diff --git a/docs/09-game-engine.md b/docs/09-game-engine.md index 3dc51bb..056ecdc 100644 --- a/docs/09-game-engine.md +++ b/docs/09-game-engine.md @@ -127,7 +127,7 @@ export interface GameUI { - **장면**: 스트리밍 행동(그림 맞히기 선)이 아닌 행동 하나가 한 장면. 첫 장면만 view 전체, 나머지는 앞 장면과의 차이(`packages/shared/src/view-patch.ts`)만 보낸다. 다시 만든 결과가 저장된 결과와 다르면 보여 주지 않는다. - **못 보는 경우**(410, 한국어 안내): 90일이 지나 로그가 지워짐, 그 뒤로 게임 규칙 버전(`stateVersion`)이 바뀜, 다시 만든 결과가 다름. - **API**: `GET /api/me/games?before=&limit=`(내가 끝까지 한 게임, 최신순), `GET /api/replays/:gamePk`. 다시 만든 결과는 잠깐(10분, 32개) 캐시하고, 한 번에 하나씩 조금씩 끊어 만들어 방 처리를 막지 않는다. -- **화면**: 게임의 `Board`/`Side`를 그대로 쓰되 읽기 전용(`act`는 아무것도 안 함, 판 안의 누르기·키 입력은 막음). 처음 / 이전 / 재생·멈춤 / 다음 / 끝 버튼, 슬라이더, "n번째 / 전체 n번", 장면 설명(누가 움직였는지, 자동 진행). 키보드 ←/→/Home/End. 들어가는 곳: 결과 화면 [처음부터 다시 보기](`RoomView.lastGamePk`), 내 정보 › 내 게임 기록 [다시 보기]. +- **화면**: 게임의 `Board`/`Side`를 그대로 쓰되 읽기 전용(`act`는 아무것도 안 함, 판 안의 누르기·키 입력은 막음). 처음 / 이전 / 재생·멈춤 / 다음 / 끝 버튼, 슬라이더, "n번째 / 전체 n번", 장면 설명(누가 움직였는지, 자동 진행). 키보드 ←/→/Home/End. 들어가는 곳: 결과 화면 [▶ 다시 보기](`RoomView.lastGamePk`), 내 정보 › 내 게임 기록 [다시 보기]. - **테스트**: 모든 게임을 실제 `Room`으로 끝까지(무작위 행동, 시간 초과, 나가기) 둔 뒤 다시 만든 상태·결과가 같은지, 모든 장면이 그 플레이어가 받은 view와 같은지(`replay.test.ts`), 권한(`replay-api.test.ts`), 브라우저(`e2e/replay.e2e.ts`). ## 9. 컴퓨터 상대 (`packages/games/src/bots/`, 06 §12) diff --git a/e2e/bots.e2e.ts b/e2e/bots.e2e.ts index da92714..8a259ea 100644 --- a/e2e/bots.e2e.ts +++ b/e2e/bots.e2e.ts @@ -111,9 +111,13 @@ try { const codeOf = (p: Page) => new URL(p.url()).pathname.split('/').pop()!; const userId = (nick: string) => app.db.query<{ id: string }, [string]>('SELECT id FROM users WHERE nickname = ?').get(nick)?.id; - await step('오목(게임 중): 사이트 로고로 홈·새로고침 → 자리는 남고 접속은 끊김, 사이트가 열려 있으면 30분 뒤 정리', async () => { + await step('오목(게임 중): 사이트 안에서 홈으로·새로고침 → 자리는 남고 접속은 끊김, 사이트가 열려 있으면 30분 뒤 정리', async () => { const code = codeOf(a); - await a.locator('.site-logo').click(); + // The room hides the site header (one top bar), so move within the app the way a back gesture would. + await a.evaluate(() => { + history.pushState({}, '', '/'); + dispatchEvent(new PopStateEvent('popstate')); + }); await a.waitForURL(`${ORIGIN}/`); const room = app.rooms.get(code)!; for (let i = 0; i < 50 && room.conns.size; i++) await Bun.sleep(20); diff --git a/e2e/replay.e2e.ts b/e2e/replay.e2e.ts index 01837bd..d061da0 100644 --- a/e2e/replay.e2e.ts +++ b/e2e/replay.e2e.ts @@ -121,7 +121,7 @@ try { await step('A(PC): 결과 화면 → 처음부터 다시 보기 → 한 수씩 넘기기', async () => { await a.waitForTimeout(400); // sheet animation - await a.getByRole('link', { name: /처음부터 다시 보기/ }).click(); + await a.getByRole('link', { name: '▶ 다시 보기' }).click(); await a.waitForURL(/\/replay\/[0-9A-Z]{26}$/); replayUrl = a.url(); await a.getByText('게임을 시작했어요.').waitFor(); @@ -236,7 +236,7 @@ try { await step('원카드 다시 보기: 각자 자기 카드만 보임', async () => { await a.waitForTimeout(400); - await a.getByRole('link', { name: /처음부터 다시 보기/ }).click(); + await a.getByRole('link', { name: '▶ 다시 보기' }).click(); await a.waitForURL(/\/replay\//); await a.getByText('게임을 시작했어요.').waitFor(); expectEq(await hand(a), liveA, "A's replay hand at the start");