Merge pull request #263 from ets-cfuhrman-pfe/fuhrmanator/issue262
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Failing after 53s
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Failing after 51s
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Failing after 18s
Tests / tests (client) (push) Failing after 1m26s
Tests / tests (server) (push) Failing after 1m1s

Touche retour équivaut à un clique sur le bouton
This commit is contained in:
Christopher (Cris) Fuhrman 2025-02-28 08:53:34 -05:00 committed by GitHub
commit 2a8913fadc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 7 deletions

View file

@ -111,6 +111,12 @@ const JoinRoom: React.FC = () => {
webSocketService.submitAnswer(answerData); webSocketService.submitAnswer(answerData);
}; };
const handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter' && username && roomName) {
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

View file

@ -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 handleReturnKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter' && email && password) {
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={handleReturnKey} // 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={handleReturnKey} // Add this line as well
/> />
<LoadingButton <LoadingButton