diff --git a/traque-front/app/admin/page.js b/traque-front/app/admin/page.js index c36c8bc..8e22c46 100644 --- a/traque-front/app/admin/page.js +++ b/traque-front/app/admin/page.js @@ -23,7 +23,7 @@ export default function AdminPage() { changeState(GameState.PLAYING)}>Start game {gameState == GameState.PLACEMENT &&
} - {gameState == GameState.SETUP && } + {(gameState == GameState.SETUP || gameState == GameState.PLACEMENT) && } ) } \ No newline at end of file diff --git a/traque-front/components/admin/zoneSelector.jsx b/traque-front/components/admin/zoneSelector.jsx index dfe9387..b769a5d 100644 --- a/traque-front/components/admin/zoneSelector.jsx +++ b/traque-front/components/admin/zoneSelector.jsx @@ -56,6 +56,6 @@ export function ZoneSelector() {

Interval between reductions

setReductionInterval(e.target.value)}> - Save + Apply } \ No newline at end of file diff --git a/traque-front/components/team/actionDrawer.jsx b/traque-front/components/team/actionDrawer.jsx index bade8b8..13c00a3 100644 --- a/traque-front/components/team/actionDrawer.jsx +++ b/traque-front/components/team/actionDrawer.jsx @@ -3,6 +3,7 @@ import { useEffect, useState } from "react" import BlueButton, { GreenButton, RedButton } from "../util/button"; import TextInput from "../util/textInput"; import { useTeamConnexion } from "@/context/teamConnexionContext"; +import { EnemyTeamModal } from "./enemyTeamModal"; export default function ActionDrawer() { const [visible, setVisible] = useState(false); @@ -10,6 +11,8 @@ export default function ActionDrawer() { const { sendCurrentPosition, name, captureCode, capture, locationSendDeadline, penalties } = useGame(); const {logout} = useTeamConnexion(); const [timeLeftBeforePenalty, setTimeLeftBeforePenalty] = useState(0); + const [enemyModalVisible, setEnemyModalVisible] = useState(false); + useEffect(() => { const interval = setInterval(() => { console.log(locationSendDeadline) @@ -54,7 +57,7 @@ export default function ActionDrawer() {
Target
- See target info + setEnemyModalVisible(true)}>See target info
setEnemyCaptureCode(e.target.value)} /> @@ -66,6 +69,7 @@ export default function ActionDrawer() {
} + setEnemyModalVisible(false)} /> ) } \ No newline at end of file diff --git a/traque-front/components/team/enemyTeamModal.jsx b/traque-front/components/team/enemyTeamModal.jsx new file mode 100644 index 0000000..b4eda3b --- /dev/null +++ b/traque-front/components/team/enemyTeamModal.jsx @@ -0,0 +1,32 @@ +import useGame from "@/hook/useGame"; +import { RedButton } from "../util/button"; +import { useEffect, useRef } from "react"; + +export function EnemyTeamModal({ visible, onClose }) { + const { teamId, enemyName } = useGame(); + const imageRef = useRef(null); + + useEffect(() => { + if (visible) { + refreshImage(); + } + }, [visible]); + + function refreshImage() { + imageRef.current.src = SERVER_URL + "/photo/enemy?team=" + teamId.toString() + "&t=" + new Date().getTime(); + } + + const SERVER_URL = "https://" + process.env.NEXT_PUBLIC_SOCKET_HOST + ":" + process.env.NEXT_PUBLIC_SOCKET_PORT; + return (visible && + <> +
+
+

{enemyName}

+ + Close +
+ + + ) +} \ No newline at end of file diff --git a/traque-front/components/team/waitingScreen.jsx b/traque-front/components/team/waitingScreen.jsx index 346dcd7..907ad51 100644 --- a/traque-front/components/team/waitingScreen.jsx +++ b/traque-front/components/team/waitingScreen.jsx @@ -23,7 +23,6 @@ export function WaitingScreen() { } function refreshImage() { - imageRef.current.src = ""; imageRef.current.src = SERVER_URL + "/photo/my?team=" + teamId.toString() + "&t=" + new Date().getTime(); } diff --git a/traque-front/hook/useGame.jsx b/traque-front/hook/useGame.jsx index 41c093d..5418ca3 100644 --- a/traque-front/hook/useGame.jsx +++ b/traque-front/hook/useGame.jsx @@ -22,6 +22,7 @@ export default function useGame() { sendCurrentPosition, capture, enemyPosition: teamInfos?.enemyLocation || null, + enemyName: teamInfos?.enemyName || null, currentPosition: teamInfos?.currentLocation || null, startingArea: teamInfos?.startingArea || null, captureCode: teamInfos?.captureCode || null,