front end elimination

This commit is contained in:
Quentin Roussel
2024-03-29 16:48:41 +01:00
parent 198acdc699
commit 3d6e469e5a
3 changed files with 20 additions and 7 deletions

View File

@@ -6,9 +6,15 @@ import { useTeamConnexion } from "@/context/teamConnexionContext";
export default function ActionDrawer() {
const [visible, setVisible] = useState(false);
const { sendCurrentPosition, name, captureCode } = useGame();
const [enemyCaptureCode, setEnemyCaptureCode] = useState("");
const { sendCurrentPosition, name, captureCode, capture } = useGame();
const {logout} = useTeamConnexion();
function handleCapture() {
capture(enemyCaptureCode);
setEnemyCaptureCode("");
}
return (
<div className={"fixed w-screen bottom-0 z-10 bg-gray-100 flex justify-center rounded-t-2xl transition-all duration-200 flex flex-col " + (visible ? "h-full" : "h-20")}>
<img src="/icons/arrow_up.png" className={"w-full object-scale-down h-ful max-h-20 transition-all cursor-pointer duration-200 " + (visible && "rotate-180")} onClick={() => setVisible(!visible)} />
@@ -43,8 +49,8 @@ export default function ActionDrawer() {
<GreenButton onClick={sendCurrentPosition}>See target info</GreenButton>
</div>
<div className="h-20 flex flex-row">
<TextInput inputMode="numeric" placeholder="Enemy code" onClick={(i) => { console.log(i) }} />
<GreenButton onClick={sendCurrentPosition}>Capture target</GreenButton>
<TextInput inputMode="numeric" placeholder="Enemy code" value={enemyCaptureCode} onChange={(e) => setEnemyCaptureCode(e.target.value)} />
<GreenButton onClick={handleCapture}>Capture target</GreenButton>
</div>
</div>
<div className="h-20">