혼자인 대기실에서 브라우저 뒤로가기(홈)로 나가면 빈 방이 10분 동안 남던 문제: 다른 사람이 없고 게임 전이면 detach를 나가기로 처리해 방을 바로 닫음. 방 안 📖 규칙도 팝업으로(규칙 페이지로 넘어가며 방을 떠나지 않게), e2e/room-back.e2e.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,8 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
|
||||
// 설정 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), []);
|
||||
// 규칙 too: going to /rules would leave the room page (and, alone in a lobby, the room itself).
|
||||
const [rulesOpen, setRulesOpen] = useState(false);
|
||||
// [한 판 더] takes me back to this room's lobby after game N (kept per tab so a reload stays there).
|
||||
const lobbyKey = `bg:lobby:${code}`;
|
||||
const [lobbyAfter, setLobbyAfter] = useState<number | null>(() => Number(sessionStorage.getItem(lobbyKey)) || null);
|
||||
@@ -217,7 +219,7 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
|
||||
</span>
|
||||
)}
|
||||
<VolumeControl className="btn btn-ghost btn-sm rb-btn" label />
|
||||
<button className="btn btn-ghost btn-sm rb-btn" onClick={() => nav(`/rules/${room.gameId}`)} aria-label="규칙 보기">
|
||||
<button className="btn btn-ghost btn-sm rb-btn" onClick={() => setRulesOpen(true)} aria-haspopup="dialog" aria-label="규칙 보기">
|
||||
<span className="rb-ico">📖</span>
|
||||
<span className="rb-lbl">규칙</span>
|
||||
</button>
|
||||
@@ -247,6 +249,16 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
|
||||
</Sheet>
|
||||
)}
|
||||
{settingsOpen && <SettingsPopup onClose={closeSettings} />}
|
||||
{rulesOpen && (
|
||||
<Sheet onClose={() => setRulesOpen(false)} label={`${gameName(room.gameId)} 규칙`}>
|
||||
<h2>{gameName(room.gameId)} 규칙</h2>
|
||||
<GameNotice gameId={room.gameId} />
|
||||
{ui ? <ui.Rules options={room.options} /> : <p className="muted">불러오는 중…</p>}
|
||||
<button type="button" className="btn btn-secondary btn-block" onClick={() => setRulesOpen(false)}>
|
||||
닫기
|
||||
</button>
|
||||
</Sheet>
|
||||
)}
|
||||
{leaveAsk && (
|
||||
<ConfirmSheet
|
||||
title="방에서 나갈까요?"
|
||||
|
||||
Reference in New Issue
Block a user