설정을 팝업으로: 방 안에서 설정을 열어도 방에서 나가지 않게 방 막대·헤더 계정 메뉴의 ⚙️ 설정을 화면 설정 팝업으로(설정 페이지와 같은 화면 설정 공용, 헤더 팝업에는 내 계정·기록 링크), e2e/settings.e2e.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
/** 방: 대기실 ↔ 게임 ↔ 결과를 한 주소에서 전환 (docs/06 §5–§9). */
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router';
|
||||
import { BOT_BANDS, BOT_PICKS, BOT_PICK_LABEL, bandOf, botChatRequired, botsAllowed, formatRoomCode, isBotId, luckLabel, type PublicUser, type RoomView } from '@bg/shared/lite';
|
||||
import { Avatar, CodeLabel, ConfirmSheet, CopyButton, ShareButton, Sheet, TopBar } from '../components/ui';
|
||||
import { GuestWarning, NicknameForm } from '../components/NicknameForm';
|
||||
import { GameNotice, gameName } from '../components/GameNotice';
|
||||
import { QrModal } from '../components/QrModal';
|
||||
import { SettingsPopup } from '../components/SettingsPopup';
|
||||
import { api, type RoomPreview } from '../net/api';
|
||||
import { socket, useRoom } from '../net/socket';
|
||||
import { useSession } from '../store/session';
|
||||
@@ -94,6 +95,9 @@ 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);
|
||||
// 설정 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), []);
|
||||
// [한 판 더] 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 +221,7 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
|
||||
<span className="rb-ico">📖</span>
|
||||
<span className="rb-lbl">규칙</span>
|
||||
</button>
|
||||
<button className="btn btn-ghost btn-sm rb-btn" onClick={() => nav('/me')} aria-label="글자 크기 · 소리 설정">
|
||||
<button className="btn btn-ghost btn-sm rb-btn" onClick={() => setSettingsOpen(true)} aria-haspopup="dialog" aria-label="글자 크기 · 소리 설정">
|
||||
<span className="rb-ico">⚙️</span>
|
||||
<span className="rb-lbl">설정</span>
|
||||
</button>
|
||||
@@ -242,6 +246,7 @@ function Room({ code, me }: { code: string; me: PublicUser }) {
|
||||
</button>
|
||||
</Sheet>
|
||||
)}
|
||||
{settingsOpen && <SettingsPopup onClose={closeSettings} />}
|
||||
{leaveAsk && (
|
||||
<ConfirmSheet
|
||||
title="방에서 나갈까요?"
|
||||
|
||||
Reference in New Issue
Block a user