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

testTodoS5
Thomas Chazot 7 months ago
commit c692f7b2ad

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

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

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

@ -32,11 +32,19 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
// <div className='LeaderBoardiv'>
<div className='LeaderBoardiv'>
<Tabs style={{width:"100%"}}
defaultActiveKey="daily"
defaultActiveKey="perso"
id="ScoreBoard"
className="mb-3">
<Tab eventKey="perso" title="Vos Stats" disabled = { !Player.pseudo.startsWith("Guest_") ? false : true}>
<Container fluid>
<Tab eventKey="perso" title="Vos Stats">
{ 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>
<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>
</Row>
</Container>
)}
</Tab>
<Tab eventKey="daily" title="Daily"
{/* <Tab eventKey="daily" title="Daily"
style={{display:"flex", flexDirection:'column', alignItems:'center'}}>
<img src={trophy}
height='100'
@ -101,10 +110,10 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {
height='100'
width='100'
alt="Person2"/>
</Tab>
</Tab> */}
</Tabs>
<ButtonImgNav dest='/' img={share}/>
{/* <ButtonImgNav dest='/' img={share}/> */}
</div>
//</div>
);

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

@ -1,10 +1,11 @@
.upperInfo{
display: flex;
justify-content: center;
flex-direction: column;
justify-content: center;
align-items: center;
width: 30%;
width: 35%;
height: 50px;
border-radius: 0px 0px 30px 30px;
border: solid;
@ -12,9 +13,9 @@
background-color: white;
font-size: 30px;
font-size: 25px;
top: 20px;;
top: 0;
}
#mainDiv{
@ -154,4 +155,21 @@
height: 250px;
width: 20%;
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 Color from '../model/Color';
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 { Network } from 'vis-network';
import {generateLatexCode, generateLatexCodeEnigme} from '../Script/LatexScript';
@ -290,7 +287,7 @@ const InGame = ({locale, changeLocale}) => {
</div>
}
<div className='paramDiv'>
{/* <div className='paramDiv'>
<button className='button'
style={{
backgroundColor: theme.colors.tertiary,
@ -299,7 +296,7 @@ const InGame = ({locale, changeLocale}) => {
onClick={handleChangeS}>
<img src={Param} alt="paramètres" height='40'/>
</button>
</div>
</div> */}
@ -407,7 +404,7 @@ const InGame = ({locale, changeLocale}) => {
placement='end'
scroll={true}
backdrop={false}
style={{ height: '20%', width: '25%', top: '60vh' }}>
style={{ height: '20%', width: '25%', top: '0' }}>
<Offcanvas.Header closeButton>
<Offcanvas.Title>Indice</Offcanvas.Title>
</Offcanvas.Header>
@ -453,6 +450,12 @@ const InGame = ({locale, changeLocale}) => {
<ButtonImgNav dest="/endgame" img={Leave} text='endgame'/>
</div>
*/}
<div id="bottom-container">
{/* Ajout du bouton en bas à droite */}
<div className='bottomRightButton'>
<Button href='/'>Retour à l'accueil</Button>
</div>
</div>
</div>
);
};

@ -24,12 +24,13 @@ import Alert from 'react-bootstrap/Alert';
import MGlass from "../res/icon/magnifying-glass.png";
import Param from "../res/icon/param.png";
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
function InfoPage({locale, changeLocale}) {
function InfoPage({locale, changeLocale}) {
const theme = useTheme();
const {isLoggedIn, login, user, setUserData, manager } = useAuth();
const styles = {
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' },
@ -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' },
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 (
//! Il faudra possiblement faire une gestion des mode de jeu, pour modifier les regles en fonction de ce dernier.
<div className='infoPage'>

@ -59,4 +59,14 @@
.centerButton {
display: flex;
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 { useRef } from 'react';
import Button from 'react-bootstrap/Button';
import Overlay from 'react-bootstrap/Overlay';
let gameStarted = false
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);
}
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 (
<div className='lobby-container'>
<div className='left-part'>
@ -191,22 +214,22 @@ function Lobby() {
<div className="lobby-vertical-divider" style={{backgroundColor: theme.colors.secondary}}></div>
<div className='right-part'>
<div className='title-param-div'>
{/* <div className='title-param-div'>
<img src={param} alt="param"/>
<h2>Paramètre de la partie</h2>
</div>
<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>
<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>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>Thèmes : basique </h4></li> {/* mettre un dropdown*/}
<li><h4>Niveau des bots : Facile </h4></li>
<li><h4>Thèmes : basique </h4></li> */}
{
//? mettre un timer pour chaques personne ?
//? indice avancé ? ==> négation, voisin du 2e degré etc.
}
</ul>
{/* </ul> */}
{/* <center >
<button className='buttonNabImg' onClick={StartGame}>
<img src={cible} alt="Button Image" height="50" width="50" />
@ -214,13 +237,48 @@ function Lobby() {
</button>
</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}
style={{
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>
</div>
</div>

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

@ -70,4 +70,18 @@
border-width: 2px;
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 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>

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

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

Loading…
Cancel
Save