diff --git a/src/layout/pages/Room.tsx b/src/layout/pages/Room.tsx index e29262a..c11db28 100644 --- a/src/layout/pages/Room.tsx +++ b/src/layout/pages/Room.tsx @@ -41,6 +41,7 @@ const Room = () => { Players: [] }); const [chatMessages, setChatMessages] = React.useState([]); + const [chatInput, setChatInput] = React.useState(''); const websocket = useWebSocket(WS_URL, { onOpen: () => { @@ -87,10 +88,10 @@ const Room = () => { }); } - const handleChat = (Message: string) => { + const handleChat = (message: string) => { handleSend({ Type: "CHAT", - Payload: { Message } + Payload: message }); } @@ -99,6 +100,13 @@ const Room = () => {

Room {roomId}

Leave Room + setChatInput(e.target.value)} /> + +
    + {chatMessages.map((message, index) => ( +
  • {message.PlayerName}: {message.Message}
  • + ))} +
) }