mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
Improve Login/Join/Manager Input
This commit is contained in:
@@ -16,6 +16,12 @@ export default function ManagerPassword() {
|
||||
socket.emit("manager:createRoom", password)
|
||||
}
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
handleCreate()
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
socket.on("game:errorMessage", (message) => {
|
||||
toast.error(message)
|
||||
@@ -37,7 +43,9 @@ export default function ManagerPassword() {
|
||||
|
||||
<Form>
|
||||
<Input
|
||||
type="password"
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="Manager password"
|
||||
/>
|
||||
<Button onClick={() => handleCreate()}>Submit</Button>
|
||||
|
||||
@@ -13,6 +13,12 @@ export default function Room() {
|
||||
socket.emit("player:checkRoom", roomId)
|
||||
}
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
handleLogin()
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
socket.on("game:successRoom", (roomId) => {
|
||||
dispatch({ type: "JOIN", payload: roomId })
|
||||
@@ -27,6 +33,7 @@ export default function Room() {
|
||||
<Form>
|
||||
<Input
|
||||
onChange={(e) => setRoomId(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="PIN Code here"
|
||||
/>
|
||||
<Button onClick={() => handleLogin()}>Submit</Button>
|
||||
|
||||
@@ -16,6 +16,12 @@ export default function Username() {
|
||||
socket.emit("player:join", { username: username, room: player.room })
|
||||
}
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.key === "Enter") {
|
||||
handleJoin()
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
socket.on("game:successJoin", () => {
|
||||
dispatch({
|
||||
@@ -35,6 +41,7 @@ export default function Username() {
|
||||
<Form>
|
||||
<Input
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="Usernname here"
|
||||
/>
|
||||
<Button onClick={() => handleJoin()}>Submit</Button>
|
||||
|
||||
Reference in New Issue
Block a user