Fix display bug

This commit is contained in:
Mathias Wagner 2025-03-01 17:22:59 +01:00
parent 2ea81493ba
commit 7996905f30

View File

@ -104,6 +104,10 @@ export const WaitingRoom = () => {
}); });
}; };
const handleRoomJoined = (code) => {
setRoomCode(code);
};
const cleanupHostStatus = on("host-status", handleHostStatus); const cleanupHostStatus = on("host-status", handleHostStatus);
const cleanupUserInfo = on("user-info", handleUserInfo); const cleanupUserInfo = on("user-info", handleUserInfo);
const cleanupRoomUsers = on("room-users", handleRoomUsers); const cleanupRoomUsers = on("room-users", handleRoomUsers);
@ -115,6 +119,7 @@ export const WaitingRoom = () => {
const cleanupGameStarted = on("game-started", handleGameStarted); const cleanupGameStarted = on("game-started", handleGameStarted);
const cleanupPlaylistOptions = on("playlist-options", handlePlaylistOptions); const cleanupPlaylistOptions = on("playlist-options", handlePlaylistOptions);
const cleanupVotesUpdated = on("playlist-votes-updated", handleVotesUpdated); const cleanupVotesUpdated = on("playlist-votes-updated", handleVotesUpdated);
const cleanupRoomJoined = on("room-joined", handleRoomJoined);
setMessages([{ setMessages([{
system: true, system: true,
@ -133,6 +138,7 @@ export const WaitingRoom = () => {
cleanupGameStarted(); cleanupGameStarted();
cleanupPlaylistOptions(); cleanupPlaylistOptions();
cleanupVotesUpdated(); cleanupVotesUpdated();
cleanupRoomJoined();
}; };
}, [on, send, socket, setCurrentState]); }, [on, send, socket, setCurrentState]);
@ -240,13 +246,15 @@ export const WaitingRoom = () => {
<span>Zurück zur Startseite</span> <span>Zurück zur Startseite</span>
</button> </button>
<h1>Warteraum</h1> <h1>Warteraum</h1>
<div className="room-code-container"> {roomCode && (
<div className="room-code" onClick={copyRoomCode}> <div className="room-code-container">
Code: <span className="code">{roomCode}</span> <div className="room-code" onClick={copyRoomCode}>
<FontAwesomeIcon icon={copied ? faCheck : faCopy} className={copied ? "copied" : ""} /> Code: <span className="code">{roomCode}</span>
<FontAwesomeIcon icon={copied ? faCheck : faCopy} className={copied ? "copied" : ""} />
</div>
<div className="copy-hint">{copied ? "Kopiert!" : "Klicken zum Kopieren"}</div>
</div> </div>
<div className="copy-hint">{copied ? "Kopiert!" : "Klicken zum Kopieren"}</div> )}
</div>
</div> </div>
<div className="waiting-room-layout"> <div className="waiting-room-layout">