Merge remote-tracking branch 'origin/demo_bourges' into testTodoS5

testTodoS5
Thomas Chazot 1 year ago
commit c692f7b2ad

@ -77,10 +77,10 @@ function App() {
<BrowserRouter> <BrowserRouter>
{hasNavbarVisible && <AppNavbar changeLocale={changeLocale} />} {hasNavbarVisible && <AppNavbar changeLocale={changeLocale} />}
<Routes> <Routes>
<Route path="/" element={<Home />} /> <Route path="/" element={<Play />} />
<Route path="/login" element={<Login />} /> <Route path="/login" element={<Login />} />
<Route path="/signup" element={<SignUp />} /> <Route path="/signup" element={<SignUp />} />
<Route path="/play" element={<Play/>} /> <Route path="/home" element={<Home/>} />
<Route path="/lobby" element={<Lobby/>} /> <Route path="/lobby" element={<Lobby/>} />
<Route path="/endgame" element={<EndGame/>} /> <Route path="/endgame" element={<EndGame/>} />
<Route path="/game" element={<InGame locale={locale} changeLocale={changeLocale}/>}/> <Route path="/game" element={<InGame locale={locale} changeLocale={changeLocale}/>}/>

@ -53,12 +53,15 @@ function AppNavbar({changeLocale}) {
<Navbar.Toggle aria-controls="basic-navbar-nav" /> <Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav"> <Navbar.Collapse id="basic-navbar-nav">
<Nav className="me-auto"> <Nav className="me-auto">
<NavDropdown title={<span style={{ color: theme.colors.text }}><FormattedMessage id="play" /></span>} className="navbar-title" id="basic-nav-dropdown"> <Nav.Link href="/" style={{ color: theme.colors.text }}>
<NavDropdown.Item href="play"><FormattedMessage id="play_solo" /> </NavDropdown.Item> Jouer
<NavDropdown.Divider /> </Nav.Link>
<NavDropdown.Item href="play"><FormattedMessage id="create_room" /> </NavDropdown.Item> <Nav.Link href="/home" style={{ color: theme.colors.text }}>
<NavDropdown.Item href="play"><FormattedMessage id="join" /> </NavDropdown.Item> Présentation
</NavDropdown> </Nav.Link>
<Nav.Link href="/info" style={{ color: theme.colors.text }}>
Info
</Nav.Link>
</Nav> </Nav>
<div className='leftdiv'> <div className='leftdiv'>
<Nav className="ml-auto navbar-title-dd"> <Nav className="ml-auto navbar-title-dd">
@ -70,7 +73,7 @@ function AppNavbar({changeLocale}) {
drop='down-centered' drop='down-centered'
> >
<NavDropdown.Item onClick={navigateToProfile}>Profil</NavDropdown.Item> <NavDropdown.Item onClick={navigateToProfile}>Profil</NavDropdown.Item>
<LanguageNavItem {/* <LanguageNavItem
countryCode="FR" countryCode="FR"
languageKey="languageSelector.french" languageKey="languageSelector.french"
onClick={() => changeLocale('fr')} onClick={() => changeLocale('fr')}
@ -79,7 +82,7 @@ function AppNavbar({changeLocale}) {
countryCode="GB" countryCode="GB"
languageKey="languageSelector.english" languageKey="languageSelector.english"
onClick={() => changeLocale('en')} onClick={() => changeLocale('en')}
/> /> */}
<NavDropdown.Divider /> <NavDropdown.Divider />
<NavDropdown.Item onClick={logout}>Déconnexion</NavDropdown.Item> <NavDropdown.Item onClick={logout}>Déconnexion</NavDropdown.Item>
</NavDropdown> </NavDropdown>
@ -93,7 +96,7 @@ function AppNavbar({changeLocale}) {
<BsFillPersonPlusFill /> <BsFillPersonPlusFill />
<FormattedMessage id="sign_up" /> <FormattedMessage id="sign_up" />
</Nav.Link> </Nav.Link>
<LangDropDown changeLocale={changeLocale}/> {/* <LangDropDown changeLocale={changeLocale}/> */}
</> </>
)} )}
</Nav> </Nav>

@ -55,7 +55,7 @@ const PlayerItemList:React.FC<MyPlayerItemListProps> =({ player, room }) => {
</Button> </Button>
)} )}
</div> </div>
{isBot && ( {/* {isBot && (
<ToggleButtonGroup type='radio' name={`options-${player.id}`} defaultValue={1}> <ToggleButtonGroup type='radio' name={`options-${player.id}`} defaultValue={1}>
<ToggleButton id={`tbg-radio-1-${player.id}`} value={1}> <ToggleButton id={`tbg-radio-1-${player.id}`} value={1}>
Facile Facile
@ -67,7 +67,7 @@ const PlayerItemList:React.FC<MyPlayerItemListProps> =({ player, room }) => {
Fort Fort
</ToggleButton> </ToggleButton>
</ToggleButtonGroup> </ToggleButtonGroup>
)} )} */}
</div> </div>
) )
} }

@ -32,11 +32,19 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
// <div className='LeaderBoardiv'> // <div className='LeaderBoardiv'>
<div className='LeaderBoardiv'> <div className='LeaderBoardiv'>
<Tabs style={{width:"100%"}} <Tabs style={{width:"100%"}}
defaultActiveKey="daily" defaultActiveKey="perso"
id="ScoreBoard" id="ScoreBoard"
className="mb-3"> className="mb-3">
<Tab eventKey="perso" title="Vos Stats" disabled = { !Player.pseudo.startsWith("Guest_") ? false : true}> <Tab eventKey="perso" title="Vos Stats">
<Container fluid>
{ Player.pseudo.startsWith("Guest_") ? (
<div className='guestDisplay'>
<h4>
<i>Veuillez vous connecter pour bénéficier des statistiques personnalisées.</i>
</h4>
</div>
) : (
<Container fluid>
<Row>Stats en solo :</Row> <Row>Stats en solo :</Row>
<Row> <Row>
<Col sm={10}>Partie Jouées :</Col> <Col sm={10}>Partie Jouées :</Col>
@ -65,8 +73,9 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
<Col className='leftRow'>{Player !== null ? Player.onlineStats.ratio : "0"}</Col> <Col className='leftRow'>{Player !== null ? Player.onlineStats.ratio : "0"}</Col>
</Row> </Row>
</Container> </Container>
)}
</Tab> </Tab>
<Tab eventKey="daily" title="Daily" {/* <Tab eventKey="daily" title="Daily"
style={{display:"flex", flexDirection:'column', alignItems:'center'}}> style={{display:"flex", flexDirection:'column', alignItems:'center'}}>
<img src={trophy} <img src={trophy}
height='100' height='100'
@ -101,10 +110,10 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
height='100' height='100'
width='100' width='100'
alt="Person2"/> alt="Person2"/>
</Tab> </Tab> */}
</Tabs> </Tabs>
<ButtonImgNav dest='/' img={share}/> {/* <ButtonImgNav dest='/' img={share}/> */}
</div> </div>
//</div> //</div>
); );

@ -15,14 +15,9 @@ import Replay from '../res/icon/replay.png';
import PersonStatus from '../Components/PersonStatus'; import PersonStatus from '../Components/PersonStatus';
import ButtonImgNav from '../Components/ButtonImgNav'; import ButtonImgNav from '../Components/ButtonImgNav';
import BigButtonNav from '../Components/BigButtonNav'; import BigButtonNav from '../Components/BigButtonNav';
import { Button } from 'react-bootstrap';
/* nav */
import { Link } from 'react-router-dom';
/* lang */
import { FormattedMessage } from 'react-intl';
import { useGame } from '../Contexts/GameContext'; import { useGame } from '../Contexts/GameContext';
import { map } from 'lodash';
import Player from '../model/Player'; import Player from '../model/Player';
@ -124,9 +119,6 @@ function EndGame() {
</div> </div>
<div className='bottomEnd'> <div className='bottomEnd'>
<div className='centerDivH' onClick={resetAll}>
<BigButtonNav dest="/play" img={Leave}/>
</div>
<div className="SoloContainer"> <div className="SoloContainer">
<div className='solostat'> <div className='solostat'>
{!IsDaily && <p>Nombre de coups : {nbCoup}</p> } {!IsDaily && <p>Nombre de coups : {nbCoup}</p> }
@ -143,9 +135,13 @@ function EndGame() {
} }
</div> </div>
</div> </div>
<div className='centerDivH'> {/* <div className='centerDivH'>
<BigButtonNav dest="/lobby" img={Replay}/> <BigButtonNav dest="/lobby" img={Replay}/>
</div> </div> */}
</div>
<div className='centerDivH' onClick={resetAll} style={{margin: "20px"}}>
<Button href='/'>Retour à l'accueil</Button>
</div> </div>
</div> </div>
)} )}

@ -1,10 +1,11 @@
.upperInfo{ .upperInfo{
display: flex; display: flex;
justify-content: center;
flex-direction: column; flex-direction: column;
justify-content: center;
align-items: center; align-items: center;
width: 30%; width: 35%;
height: 50px;
border-radius: 0px 0px 30px 30px; border-radius: 0px 0px 30px 30px;
border: solid; border: solid;
@ -12,9 +13,9 @@
background-color: white; background-color: white;
font-size: 30px; font-size: 25px;
top: 20px;; top: 0;
} }
#mainDiv{ #mainDiv{
@ -155,3 +156,20 @@
width: 20%; width: 20%;
overflow-y:auto; overflow-y:auto;
} }
#bottom-container {
/* Ajout du style pour le conteneur en bas à droite */
position: fixed;
bottom: 0;
right: 0;
margin: 20px;
}
.bottomRightButton {
/* Style pour le bouton en bas à droite */
position: absolute;
bottom: 0;
right: 0;
margin: 10px;
}

@ -46,9 +46,6 @@ import { Nav, NavDropdown, Spinner } from 'react-bootstrap';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Color from '../model/Color'; import Color from '../model/Color';
import { useGame } from '../Contexts/GameContext'; import { useGame } from '../Contexts/GameContext';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { NavLink } from 'react-router-dom';
import { last } from 'lodash';
import { socket } from '../SocketConfig'; import { socket } from '../SocketConfig';
import { Network } from 'vis-network'; import { Network } from 'vis-network';
import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript'; import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript';
@ -290,7 +287,7 @@ const InGame = ({locale, changeLocale}) => {
</div> </div>
} }
<div className='paramDiv'> {/* <div className='paramDiv'>
<button className='button' <button className='button'
style={{ style={{
backgroundColor: theme.colors.tertiary, backgroundColor: theme.colors.tertiary,
@ -299,7 +296,7 @@ const InGame = ({locale, changeLocale}) => {
onClick={handleChangeS}> onClick={handleChangeS}>
<img src={Param} alt="paramètres" height='40'/> <img src={Param} alt="paramètres" height='40'/>
</button> </button>
</div> </div> */}
@ -407,7 +404,7 @@ const InGame = ({locale, changeLocale}) => {
placement='end' placement='end'
scroll={true} scroll={true}
backdrop={false} backdrop={false}
style={{ height: '20%', width: '25%', top: '60vh' }}> style={{ height: '20%', width: '25%', top: '0' }}>
<Offcanvas.Header closeButton> <Offcanvas.Header closeButton>
<Offcanvas.Title>Indice</Offcanvas.Title> <Offcanvas.Title>Indice</Offcanvas.Title>
</Offcanvas.Header> </Offcanvas.Header>
@ -453,6 +450,12 @@ const InGame = ({locale, changeLocale}) => {
<ButtonImgNav dest="/endgame" img={Leave} text='endgame'/> <ButtonImgNav dest="/endgame" img={Leave} text='endgame'/>
</div> </div>
*/} */}
<div id="bottom-container">
{/* Ajout du bouton en bas à droite */}
<div className='bottomRightButton'>
<Button href='/'>Retour à l'accueil</Button>
</div>
</div>
</div> </div>
); );
}; };

@ -24,12 +24,13 @@ import Alert from 'react-bootstrap/Alert';
import MGlass from "../res/icon/magnifying-glass.png"; import MGlass from "../res/icon/magnifying-glass.png";
import Param from "../res/icon/param.png"; import Param from "../res/icon/param.png";
import Info from "../res/icon/infoGreen.png"; //todo changer la couleur de l'icon import Info from "../res/icon/infoGreen.png"; //todo changer la couleur de l'icon
import { useAuth } from '../Contexts/AuthContext';
import { useEffect } from 'react';
//@ts-ignore //@ts-ignore
function InfoPage({locale, changeLocale}) { function InfoPage({locale, changeLocale}) {
const theme = useTheme(); const theme = useTheme();
const {isLoggedIn, login, user, setUserData, manager } = useAuth();
const styles = { const styles = {
roux: { backgroundColor: ColorToHexa(Color.REDHEAD), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' }, roux: { backgroundColor: ColorToHexa(Color.REDHEAD), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' },
blond: { backgroundColor: ColorToHexa(Color.BLOND), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' }, blond: { backgroundColor: ColorToHexa(Color.BLOND), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' },
@ -37,6 +38,20 @@ function InfoPage({locale, changeLocale}) {
blanc: { backgroundColor: ColorToHexa(Color.WHITE), border: '1px solid #ccc', width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' }, blanc: { backgroundColor: ColorToHexa(Color.WHITE), border: '1px solid #ccc', width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' },
chatain: { backgroundColor: ColorToHexa(Color.BROWN), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' }, chatain: { backgroundColor: ColorToHexa(Color.BROWN), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' },
}; };
useEffect(() => {
if (user == null){
manager.userService.fetchUserInformation().then(([user, loggedIn]) =>{
if (user!=null){
if (loggedIn){
login()
setUserData(user)
}
}
})
}
}, [isLoggedIn]);
return ( return (
//! Il faudra possiblement faire une gestion des mode de jeu, pour modifier les regles en fonction de ce dernier. //! Il faudra possiblement faire une gestion des mode de jeu, pour modifier les regles en fonction de ce dernier.
<div className='infoPage'> <div className='infoPage'>

@ -60,3 +60,13 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.lobbyR{
display: flex;
flex-direction: column;
align-items: center;
}
.lobbyR *{
margin: 20px 10px;
}

@ -43,6 +43,11 @@ import { random } from 'lodash';
import SessionService from '../services/SessionService'; import SessionService from '../services/SessionService';
import { useRef } from 'react';
import Button from 'react-bootstrap/Button';
import Overlay from 'react-bootstrap/Overlay';
let gameStarted = false let gameStarted = false
function Lobby() { function Lobby() {
@ -159,6 +164,24 @@ function Lobby() {
socket.emit('network created', JSON.stringify(networkPerson, null, 2), JSON.stringify(choosenPerson), JSON.stringify(choosenIndices), room, start); socket.emit('network created', JSON.stringify(networkPerson, null, 2), JSON.stringify(choosenPerson), JSON.stringify(choosenIndices), room, start);
} }
const copyGameLink = () => {
setShow(!show)
const gameLink = "http://localhost:3000/lobby?room="+ room;
navigator.clipboard.writeText(gameLink)
.then(() => {
console.log('Lien copié avec succès !');
})
.catch((err) => {
console.error('Erreur lors de la copie du lien :', err);
});
};
const [show, setShow] = useState(false);
const target = useRef(null);
return ( return (
<div className='lobby-container'> <div className='lobby-container'>
<div className='left-part'> <div className='left-part'>
@ -191,22 +214,22 @@ function Lobby() {
<div className="lobby-vertical-divider" style={{backgroundColor: theme.colors.secondary}}></div> <div className="lobby-vertical-divider" style={{backgroundColor: theme.colors.secondary}}></div>
<div className='right-part'> <div className='right-part'>
<div className='title-param-div'> {/* <div className='title-param-div'>
<img src={param} alt="param"/> <img src={param} alt="param"/>
<h2>Paramètre de la partie</h2> <h2>Paramètre de la partie</h2>
</div> </div>
<ul> <ul> */}
<li><h4> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim</h4></li> {/* <li><h4> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim</h4></li>
<li><h4>paramètre super important pour la partie</h4></li> <li><h4>paramètre super important pour la partie</h4></li>
<li><h4>paramètre super important pour la partie</h4></li> <li><h4>paramètre super important pour la partie</h4></li>
<li><h4>paramètre super important pour la partie</h4></li> <li><h4>paramètre super important pour la partie</h4></li>
<li><h4>Niveau des bots : Facile </h4></li> {/* mettre un dropdown ou un swiper */} <li><h4>Niveau des bots : Facile </h4></li>
<li><h4>Thèmes : basique </h4></li> {/* mettre un dropdown*/} <li><h4>Thèmes : basique </h4></li> */}
{ {
//? mettre un timer pour chaques personne ? //? mettre un timer pour chaques personne ?
//? indice avancé ? ==> négation, voisin du 2e degré etc. //? indice avancé ? ==> négation, voisin du 2e degré etc.
} }
</ul> {/* </ul> */}
{/* <center > {/* <center >
<button className='buttonNabImg' onClick={StartGame}> <button className='buttonNabImg' onClick={StartGame}>
<img src={cible} alt="Button Image" height="50" width="50" /> <img src={cible} alt="Button Image" height="50" width="50" />
@ -214,13 +237,48 @@ function Lobby() {
</button> </button>
</center> */} </center> */}
<div className='centerDivH'> <div className='lobbyR'
style={{flexDirection:'column',
alignItems:'space-around'}}>
<h3>Bienvenue dans votre lobby !</h3>
<p>Attendez que tous vos amis rejoignent avant de lancer la partie.</p>
{/* Bouton pour copier le lien */}
<Button variant="primary" ref={target} onClick={copyGameLink}>
Inviter des amis
</Button>
<Overlay target={target.current} show={show} placement="top">
{({
placement: _placement,
arrowProps: _arrowProps,
show: _show,
popper: _popper,
hasDoneInitialMeasure: _hasDoneInitialMeasure,
...props
}) => (
<div
{...props}
style={{
position: 'absolute',
backgroundColor: theme.colors.secondary,
padding: '2px 10px',
color: 'white',
borderRadius: 3,
...props.style,
}}
>
Lien copié
</div>
)}
</Overlay>
<button className='button' onClick={StartGame} <button className='button' onClick={StartGame}
style={{ style={{
backgroundColor: theme.colors.tertiary, backgroundColor: theme.colors.tertiary,
borderColor: theme.colors.secondary borderColor: theme.colors.secondary,
width: 'auto',
height: 'auto'
}}> }}>
<img src={cible} alt="cible" height="40"/> Démarrer la partie !
</button> </button>
</div> </div>
</div> </div>

@ -36,8 +36,8 @@ const SignIn = () => {
setShowConfirmation(true); setShowConfirmation(true);
setTimeout(async () => { setTimeout(async () => {
await login(); await login();
navigate('/play'); // 3 secondes avant de rediriger vers la page de connexion navigate('/'); // 3 secondes avant de rediriger vers la page de connexion
}, 3000); }, 1250);
} }
} catch (error: any) { } catch (error: any) {
setError(error.message); setError(error.message);
@ -103,8 +103,8 @@ const SignIn = () => {
)} )}
{showConfirmation && ( {showConfirmation && (
<div className="alert alert-success" role="alert"> <div className="alert alert-success text-center" role="alert">
Connexion réussie ! Vous serez redirigé vers votre profil dans 3 secondes. Connexion réussie ! Vous allez être redirigé vers la page principale.
</div> </div>
)} )}
</div> </div>

@ -71,3 +71,17 @@
font-size:larger; font-size:larger;
} }
.guestDisplay{
display: flex;
justify-content: center;
align-items: center;
/* flex-direction: column; */
margin: 20px;
padding: 15px;
border: solid 1px whitesmoke;
border-radius: 15px;
background-color: white;
}

@ -250,7 +250,7 @@ function Play() {
<button onClick={createLobby} className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Créer une partie </button> <button onClick={createLobby} className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Créer une partie </button>
<button className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Rejoindre </button> {/* <button className="ButtonNav" style={{backgroundColor: theme.colors.primary, borderColor: theme.colors.secondary}}> Rejoindre </button> */}
</div> </div>
</div> </div>

@ -97,7 +97,7 @@ const Profile = () => {
} }
handleCloseDeleteModal(); handleCloseDeleteModal();
navigate("/play") navigate("/")
} else { } else {
console.error('Phrase de confirmation incorrecte.'); console.error('Phrase de confirmation incorrecte.');

@ -33,7 +33,7 @@ const SignUp = () => {
setShowConfirmation(true); setShowConfirmation(true);
setTimeout(() => { setTimeout(() => {
navigate('/login'); // 3 secondes avant de rediriger vers la page de connexion navigate('/login'); // 3 secondes avant de rediriger vers la page de connexion
}, 3000); }, 1250);
} }
} catch (error: any) { } catch (error: any) {
setError(error.message); setError(error.message);
@ -100,8 +100,8 @@ const SignUp = () => {
)} )}
{showConfirmation && ( {showConfirmation && (
<div className="alert alert-success" role="alert"> <div className="alert alert-success text-center" role="alert">
Inscription réussie ! Vous serez redirigé vers la page de connexion dans 3 secondes. Inscription réussie ! Vous serez redirigé vers la page de connexion.
</div> </div>
)} )}
</div> </div>

Loading…
Cancel
Save