diff --git a/cryptide_project/src/Pages/InGame.tsx b/cryptide_project/src/Pages/InGame.tsx index da57d35..33010ce 100644 --- a/cryptide_project/src/Pages/InGame.tsx +++ b/cryptide_project/src/Pages/InGame.tsx @@ -72,6 +72,7 @@ const InGame = ({locale, changeLocale}) => { isDaily=false } + let isEasy: boolean = true const isEasytmp = params.get('easy'); if (isEasytmp == "false"){ diff --git a/cryptide_project/src/Pages/Lobby.css b/cryptide_project/src/Pages/Lobby.css index 60dfcf0..5fbe13c 100644 --- a/cryptide_project/src/Pages/Lobby.css +++ b/cryptide_project/src/Pages/Lobby.css @@ -59,4 +59,39 @@ .centerButton { display: flex; justify-content: center; +} + +.lobbyR{ + display: flex; + flex-direction: column; + align-items: center; +} + +.lobbyR *{ + margin: 20px 10px; +} + +.valuebutton{ + border-radius: 90px; + width: 50px; + height: 50px; + background-color: #fff; +} + +.nbNodeDiv{ + display: flex; + flex-direction: column; + justify-content: center; + + border: solid 2px whitesmoke; + border-radius: 15px; + + background-color: white; + + width: 70%; +} + +.nbNodeDiv div { + display: flex; + justify-content: center; } \ No newline at end of file diff --git a/cryptide_project/src/Pages/Lobby.tsx b/cryptide_project/src/Pages/Lobby.tsx index e77b8cd..0d27296 100644 --- a/cryptide_project/src/Pages/Lobby.tsx +++ b/cryptide_project/src/Pages/Lobby.tsx @@ -42,13 +42,16 @@ import { socket } from "../SocketConfig"; 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() { const theme=useTheme(); const navigate = useNavigate(); - - const [enteredNumber, setEnteredNumber] = useState(20); //@ts-ignore const handleNumberChange = (event) => { @@ -68,7 +71,14 @@ function Lobby() { socket.emit("lobby joined", room, new EasyBot("botId" + Math.floor(Math.random() * 1000), "Bot" + Math.floor(Math.random() * 100), "").toJson()) } - + //* nb Node + const [enteredNumber, setEnteredNumber] = useState(20); + + //@ts-ignore + const handleNumberChange = (event) => { + const newNumber = Math.max(20, Math.min(60, parseInt(event.target.value, 10))); + setEnteredNumber(newNumber); + }; useEffect(() => { if (first){ @@ -165,6 +175,21 @@ 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 (
@@ -197,7 +222,7 @@ function Lobby() {
-
+ {/*
param

Paramètre de la partie

@@ -206,20 +231,83 @@ function Lobby() {
  • paramètre super important pour la partie

  • paramètre super important pour la partie

  • paramètre super important pour la partie

  • -
  • Niveau des bots : Facile

  • {/* mettre un dropdown ou un swiper */} -
  • Thèmes : basique

  • {/* mettre un dropdown*/} +
  • Niveau des bots : Facile

  • +
  • Thèmes : basique

  • */} { //? mettre un timer pour chaques personne ? //? indice avancé ? ==> négation, voisin du 2e degré etc. } - + {/* */} {/*
    */} +
    +

    Bienvenue dans votre lobby !

    +

    Attendez que tous vos amis rejoignent avant de lancer la partie.

    + {/* Bouton pour copier le lien */} + + + {({ + placement: _placement, + arrowProps: _arrowProps, + show: _show, + popper: _popper, + hasDoneInitialMeasure: _hasDoneInitialMeasure, + ...props + }) => ( +
    + Lien copié +
    + )} +
    + +
    + +
    + + + +
    +
    + + +
    + {/*
    cible -
    +
    */}
    ); diff --git a/cryptide_project/src/Pages/Play.tsx b/cryptide_project/src/Pages/Play.tsx index 4b2cc93..9487d96 100644 --- a/cryptide_project/src/Pages/Play.tsx +++ b/cryptide_project/src/Pages/Play.tsx @@ -27,10 +27,7 @@ import Stub from '../model/Stub'; import SessionService from '../services/SessionService'; import { loadImageAsync } from '../ImageHelper'; - - import { Overlay, ToggleButton, ToggleButtonGroup } from 'react-bootstrap'; - import Button from 'react-bootstrap/Button'; import ButtonGroup from 'react-bootstrap/ButtonGroup'; @@ -44,7 +41,6 @@ function Play() { const target = useRef(null); - useEffect(() => { const fetchUserInformation = async () => { try {