From 9b05d184ce29a33263c9ee9aed01ae1323b902f0 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Wed, 29 Nov 2023 16:28:33 +0100 Subject: [PATCH] changement de logique pour le partage du lien, cela devrait marcher sur Mac :test_tube: --- cryptide_project/src/Pages/Lobby.tsx | 78 ++++++++++++++++++---------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/cryptide_project/src/Pages/Lobby.tsx b/cryptide_project/src/Pages/Lobby.tsx index 04c724e..8332d01 100644 --- a/cryptide_project/src/Pages/Lobby.tsx +++ b/cryptide_project/src/Pages/Lobby.tsx @@ -179,6 +179,18 @@ function Lobby() { }); }; + const textAreaRef = useRef(null); + const linkToCopy = "http://localhost:3000/lobby?room="+ room + const handleCopyClick = () => { + setShow(!show) + if(textAreaRef.current != null){ + textAreaRef.current.select(); + document.execCommand('copy'); + } + }; + + + const [show, setShow] = useState(false); const target = useRef(null); @@ -238,34 +250,44 @@ function Lobby() { */}
-

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 - }) => ( -
+ style={{flexDirection:'column', + alignItems:'space-around'}}> +

Bienvenue dans votre lobby !

+

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

+ {/* Bouton pour copier le lien */} + {/* */} +
+