화면 정리: 한눈에 들어오게 (홈 게임 타일·종류 탭, 방 안 상단 막대 한 줄, 대기실·결과·설정 간소화)

"한 화면에 정보가 너무 많아 한눈에 들어오지 않는다" 피드백. 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 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-09 00:16:10 +09:00
parent 19c163f4d2
commit b81b4f60be
15 changed files with 225 additions and 70 deletions

View File

@@ -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<string>('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 (
<div style={{ display: 'grid', gridTemplateColumns: columns, gap: 16 }}>
{games.map((g) => (
<Link key={g.id} to={`/g/${g.id}`} className="card game-card" style={{ textDecoration: 'none', color: 'inherit', display: 'flex', flexDirection: 'column', gap: 8, padding: 20 }}>
<span style={{ fontSize: '3rem', lineHeight: 1 }} aria-hidden>
{GAME_ICON[g.id] ?? '🎲'}
</span>
<strong style={{ fontSize: '1.25rem' }}>{g.nameKo}</strong>
<span className="muted">{g.blurb}</span>
<span className="row small" style={{ gap: 6, marginTop: 'auto' }}>
<span className="badge">{g.minPlayers === g.maxPlayers ? `${g.minPlayers}명` : `${g.minPlayers}~${g.maxPlayers}명`}</span>
<span className="badge">{g.minutes}분</span>
<span className="badge">{g.level}</span>
</span>
</Link>
))}
<div className="stack" style={{ gap: 14 }}>
{groups.length > 1 && (
<div className="segmented game-tabs" role="group" aria-label="게임 종류">
<button type="button" aria-pressed={group === 'all'} onClick={() => setGroup('all')}>
전체
</button>
{groups.map((g) => (
<button key={g.key} type="button" aria-pressed={group === g.key} onClick={() => setGroup(g.key)}>
{g.label}
</button>
))}
</div>
)}
<div className="game-grid">
{shown.map((g) => (
<Link key={g.id} to={`/g/${g.id}`} className="card game-card">
<span className="game-card-icon" aria-hidden>
{GAME_ICON[g.id] ?? '🎲'}
</span>
<strong className="game-card-name">{g.nameKo}</strong>
<span className="game-card-meta">
{g.minPlayers === g.maxPlayers ? `${g.minPlayers}명` : `${g.minPlayers}~${g.maxPlayers}명`} · {g.minutes}분
</span>
</Link>
))}
</div>
</div>
);
}

View File

@@ -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 <p className="guest-warning small" role="note">⚠️ 게스트 기록은 하루 동안 안 들어오면 지워져요.</p>;
return (
<p className="guest-warning small" role="note">
⚠️ 게스트는 기록이 오래 저장되지 않아요. 사이트에 들어오지 않은 채 하루가 지나면 계정과 기록이 모두 지워져요.

View File

@@ -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; }

View File

@@ -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; }
}

View File

@@ -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);

View File

@@ -29,3 +29,10 @@ export const GAME_ICON: Record<string, string> = {
/** 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'] },
];

View File

@@ -12,7 +12,7 @@ import { toast } from '../store/toast';
function Seg<T extends string>({ value, options, onChange, label }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string }) {
return (
<div className="stack" style={{ gap: 6 }}>
<div className="setting-row">
<strong>{label}</strong>
<div className="segmented" role="group" aria-label={label}>
{options.map(([k, l]) => (
@@ -62,7 +62,7 @@ export default function MePage() {
<Seg
label="돌·카드 놓기"
value={settings.tapConfirm ? 'on' : 'off'}
options={[['on', '두 번 눌러 확정(실수 방지)'], ['off', '한 번에 놓기']]}
options={[['on', '두 번 눌러 놓기'], ['off', '한 번에 놓기']]}
onChange={(v) => updateSettings({ tapConfirm: v === 'on' })}
/>
</section>

View File

@@ -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 && (
<section className="card stack" style={{ textAlign: 'center' }} aria-label="초대하기">
<p className="muted">친구에게 이 코드를 알려 주세요</p>
<p style={{ fontSize: '3.2rem', fontWeight: 800, lineHeight: 1.1 }}>
<CodeLabel code={room.code} />
</p>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(140px, 1fr))', gap: 8 }}>
<CopyButton text={room.code} label="🔢 코드 복사" />
{/* QR lives on the empty seat button ("+ 빈자리 · QR로 초대"), so this row stays two buttons. */}
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
<CopyButton text={url} label="🔗 링크 복사" />
<ShareButton title={`${gName} 같이 해요`} text={shareText} url={url} />
<button className="btn btn-secondary" onClick={() => setQr(true)}>
📷 QR 보기
</button>
</div>
</section>
);
@@ -349,7 +352,7 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser })
) : (
<div key={i} className="row" style={{ gap: 8, flexWrap: 'nowrap' }}>
<button className="card row" style={{ flex: 1, border: '2px dashed var(--border)', boxShadow: 'none', cursor: 'pointer', minHeight: 76, justifyContent: 'center', color: 'var(--text-sub)' }} onClick={() => (mySeat < 0 ? socket.send({ t: 'seat', seat: i }) : setQr(true))}>
{mySeat < 0 ? '+ 여기 앉기' : '+ 빈자리 · 친구 초대하기'}
{mySeat < 0 ? '+ 여기 앉기' : '+ 빈자리 · 📷 QR로 초대'}
</button>
{canAddBot && i === firstEmpty && (
<button className="btn btn-secondary" style={{ minHeight: 76 }} onClick={() => socket.send({ t: 'addBot', seat: i })}>
@@ -392,7 +395,6 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser })
)}
</div>
{practice && <p className="small">🤖 연습 게임이에요. 기록에는 남지 않아요.</p>}
{me.kind === 'guest' && !practice && <GuestWarning />}
{room.lockedOptions.length > 0 && <p className="muted small">🔒 일부 규칙은 관리자가 정해 두어서 바꿀 수 없어요.</p>}
<GameNotice gameId={room.gameId} />
{isHost && wide && <SettingsForm room={room} ui={ui} inline />}
@@ -430,17 +432,12 @@ function Lobby({ room, ui, me }: { room: RoomView; ui: GameUI; me: PublicUser })
<div className="stack" style={{ gap: 20 }}>
{invite}
{wide ? settingsCard : seats}
{wide && (
<section className="card stack">
<h2>규칙 요약</h2>
<ui.Rules options={room.options} />
</section>
)}
{!wide && settingsCard}
</div>
<div className="stack" style={{ gap: 16, position: wide ? 'sticky' : undefined, top: 140 }}>
<div className="stack" style={{ gap: 16, position: wide ? 'sticky' : undefined, top: 76 }}>
{wide && seats}
{action}
{me.kind === 'guest' && !practice && <GuestWarning short />}
{wide && <ChatPanel room={room} me={me} />}
</div>
</div>
@@ -527,7 +524,6 @@ function SettingsForm({ room, ui, inline, onDone }: { room: RoomView; ui: GameUI
return (
<div className="stack" style={{ gap: 14 }}>
{room.lockedOptions.length > 0 && <p className="muted small">🔒 관리자가 고정한 규칙은 바꿔도 저장되지 않아요.</p>}
<p className="muted small">바꾸면 바로 적용돼요.</p>
<ui.Options value={options} onChange={changeOptions} />
<hr style={{ border: 0, borderTop: '1px solid var(--border)', width: '100%' }} />
<div style={{ display: 'grid', gridTemplateColumns: inline ? 'repeat(2, minmax(0, 1fr))' : '1fr', gap: 12 }}>
@@ -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})`}
</button>
)}
<button className="btn btn-secondary btn-block" onClick={() => setHidden(true)}>
판 다시 보기
</button>
{room.lastGamePk && result.ranking.some((g) => g.includes(me.id)) && (
<Link className="btn btn-secondary btn-block" to={`/replay/${room.lastGamePk}`}>
▶ 처음부터 다시 보기
</Link>
)}
{/* One primary action (한 판 더); the rest share one quieter row. */}
<div className="row" style={{ gap: 8, flexWrap: 'nowrap' }}>
<button className="btn btn-secondary" style={{ flex: 1 }} onClick={() => setHidden(true)}>
판 보기
</button>
{room.lastGamePk && result.ranking.some((g) => g.includes(me.id)) && (
<Link className="btn btn-secondary" style={{ flex: 1 }} to={`/replay/${room.lastGamePk}`}>
▶ 다시 보기
</Link>
)}
</div>
<button className="btn btn-ghost btn-block" onClick={onLeave}>
방 나가기
</button>

View File

@@ -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;
}