mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
parent
8240de0a44
commit
5b41f24404
2 changed files with 20 additions and 7 deletions
|
|
@ -111,6 +111,12 @@ const JoinRoom: React.FC = () => {
|
||||||
webSocketService.submitAnswer(answerData);
|
webSocketService.submitAnswer(answerData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
handleSocket();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (isWaitingForTeacher) {
|
if (isWaitingForTeacher) {
|
||||||
return (
|
return (
|
||||||
<div className='room'>
|
<div className='room'>
|
||||||
|
|
@ -167,7 +173,8 @@ const JoinRoom: React.FC = () => {
|
||||||
onChange={(e) => setRoomName(e.target.value)}
|
onChange={(e) => setRoomName(e.target.value)}
|
||||||
placeholder="Numéro de la salle"
|
placeholder="Numéro de la salle"
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth={true}
|
||||||
|
onKeyDown={handleReturnKey}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -177,7 +184,8 @@ const JoinRoom: React.FC = () => {
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
placeholder="Nom d'utilisateur"
|
placeholder="Nom d'utilisateur"
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth={true}
|
||||||
|
onKeyDown={handleReturnKey}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import { useNavigate, Link } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
// JoinRoom.tsx
|
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import './Login.css';
|
import './Login.css';
|
||||||
|
|
@ -38,6 +36,11 @@ const Login: React.FC = () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoginContainer
|
<LoginContainer
|
||||||
|
|
@ -51,7 +54,8 @@ const Login: React.FC = () => {
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
placeholder="Adresse courriel"
|
placeholder="Adresse courriel"
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth={true}
|
||||||
|
onKeyDown={handleKeyPress} // Add this line as well
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -62,7 +66,8 @@ const Login: React.FC = () => {
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
placeholder="Mot de passe"
|
placeholder="Mot de passe"
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth={true}
|
||||||
|
onKeyDown={handleKeyPress} // Add this line as well
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue