diff --git a/.drone.yml b/.drone.yml index 5855957..f8710ca 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,7 +47,7 @@ steps: password: from_secret: SECRET_REGISTRY_PASSWORD environment: - REACT_APP_BASE_PATH: "/containers/Crypteam-website" + BASEPATH: "/containers/Crypteam-website" #depends_on: [ build ] diff --git a/cryptide_project/Dockerfile b/cryptide_project/Dockerfile index 591738e..64757e5 100644 --- a/cryptide_project/Dockerfile +++ b/cryptide_project/Dockerfile @@ -30,3 +30,4 @@ EXPOSE 80 # Définissez ENTRYPOINT pour démarrer Nginx lorsque le conteneur est lancé ENTRYPOINT ["nginx", "-g", "daemon off;"] +# \ No newline at end of file diff --git a/cryptide_project/src/App.tsx b/cryptide_project/src/App.tsx index be4588a..c3a0ab6 100644 --- a/cryptide_project/src/App.tsx +++ b/cryptide_project/src/App.tsx @@ -41,8 +41,9 @@ import messagesEn from './Translations/en.json'; /* Gestion d' erreur */ import ErrorBoundary from './Error/ErrorBoundary'; import ErrorPage from './Error/ErrorPage'; +import DeducCheck from './Pages/DeducCheck'; -const basePath = process.env.REACT_APP_BASE_PATH || ''; +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; const messages = { fr: messagesFr, @@ -86,7 +87,8 @@ function App() { } /> }/> } /> - } /> + } /> + } /> } /> }/> {/* }/> */} diff --git a/cryptide_project/src/Components/GraphContainer.tsx b/cryptide_project/src/Components/GraphContainer.tsx index 83697dd..f16c253 100644 --- a/cryptide_project/src/Components/GraphContainer.tsx +++ b/cryptide_project/src/Components/GraphContainer.tsx @@ -67,8 +67,7 @@ let cptBug = 0 let cptUseEffect = 0 let testPlayers: Player[] = [] -const basePath = process.env.REACT_APP_BASE_PATH || ''; - +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; const MyGraphComponent: React.FC = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme, setPlayerIndex, askedWrong, setAskedWrong, importToPdf, setImportToPdf}) => { let cptTour: number = 0 @@ -1020,7 +1019,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS catch(error){ console.log(error); } - navigate(`${basePath}/endgame?solo=true+${isDaily}`) + navigate(`${basePath}/endgame?solo=true&daily=${isDaily}`) } } diff --git a/cryptide_project/src/Components/LobbyContainer.tsx b/cryptide_project/src/Components/LobbyContainer.tsx index 797cef5..edebe08 100644 --- a/cryptide_project/src/Components/LobbyContainer.tsx +++ b/cryptide_project/src/Components/LobbyContainer.tsx @@ -20,7 +20,7 @@ interface LobbyContainerProps { //? mettre un "nbplayermax" si le nombre de joueur max peut etre fixé ? } -const basePath = process.env.REACT_APP_BASE_PATH || ''; +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; const LobbyContainer: React.FC = ({roomNum, HeadPlayer, nbPlayer, setFirst, started}) => { const theme=useTheme(); diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx index 5921026..bd94a74 100644 --- a/cryptide_project/src/Components/NavBar.tsx +++ b/cryptide_project/src/Components/NavBar.tsx @@ -25,8 +25,7 @@ import { useTheme } from '../Style/ThemeContext'; import { useAuth } from '../Contexts/AuthContext'; import { useNavigate } from 'react-router-dom'; -const basePath = process.env.REACT_APP_BASE_PATH || ''; - +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; // @ts-ignore function AppNavbar({changeLocale}) { @@ -53,13 +52,13 @@ function AppNavbar({changeLocale}) { diff --git a/cryptide_project/src/Error/ErrorPage.tsx b/cryptide_project/src/Error/ErrorPage.tsx index dc3da66..ad90cde 100644 --- a/cryptide_project/src/Error/ErrorPage.tsx +++ b/cryptide_project/src/Error/ErrorPage.tsx @@ -6,8 +6,7 @@ import './ErrorStyle.css'; import { FormattedMessage } from 'react-intl'; import { Button } from 'react-bootstrap'; -const basePath = process.env.REACT_APP_BASE_PATH || ''; - +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; //@ts-ignore function ErrorPage({ code = "", msg = "Something is wrong"}) { diff --git a/cryptide_project/src/Pages/DeducCheck.tsx b/cryptide_project/src/Pages/DeducCheck.tsx new file mode 100644 index 0000000..9ac3a33 --- /dev/null +++ b/cryptide_project/src/Pages/DeducCheck.tsx @@ -0,0 +1,120 @@ +import React from 'react'; + +/* Style */ +import './DeducGrid.css'; +import { useTheme } from '../Style/ThemeContext'; + +/* Component */ + +/* Boostrap */ +import Table from 'react-bootstrap/Table'; +import Form from 'react-bootstrap/Form'; + +/* lang */ +import { FormattedMessage } from 'react-intl'; + +/* model */ +import Stub from '../model/Stub'; + +import { useGame } from '../Contexts/GameContext'; +import { positionToEmoji } from '../ColorHelper'; + +function DeducCheck() { + const theme = useTheme(); + //const indices = Stub.GenerateIndice(); + + const params = new URLSearchParams(window.location.search); + + const NbPlayer = params.get('nbPlayer'); + const actualPlayerIndex = params.get('actualId') ?? '0'; + + //const { actualPlayerIndex, players } = useGame(); + + // let playerstmp + // if (players.length == 0) playerstmp = ["1", "2", "3", "4", "5", "4"]; + // else { playerstmp = players} + + //* Gestion players + const playerList = Array.from({ length: parseInt(NbPlayer ?? '1') }, (_, index) => (index + 1).toString()); + const playerColors = playerList.map((_, index) => positionToEmoji(index, true)); + const players = playerColors.filter((_, index) => index !== parseInt(actualPlayerIndex ?? '0')); + + + + // const players = [ + // "🔵", + // "🟢", + // "🟡", + // "🟣", + // "🔴" + //] + //console.log(players) + // console.log(playerColors) + // console.log(actualPlayerIndex) + + //* Gestion indices + const indices = Stub.GenerateIndice(); + + const halfLength = Math.ceil(indices.length / 2); + const firstHalfIndices = indices.slice(0, halfLength); + const secondHalfIndices = indices.slice(halfLength); + + + return ( +
+
+ {/* Premier tableau */} + + + + + {players.map((player, index) => ( + + ))} + + + + {firstHalfIndices.map((indice, rowIndex) => ( + + + {players.map((player, colIndex) => ( + + ))} + + ))} + +
Indices{player}
{indice.ToString("fr")} + {/* */} + +
+ + {/* Deuxième tableau */} + + + + + {players.map((player, index) => ( + + ))} + + + + {secondHalfIndices.map((indice, rowIndex) => ( + + + {players.map((player, colIndex) => ( + + ))} + + ))} + +
Indices{player}
{indice.ToString("fr")} + {/* */} + +
+
+
+ ); +} + +export default DeducCheck; diff --git a/cryptide_project/src/Pages/Home.tsx b/cryptide_project/src/Pages/Home.tsx index bc28c69..3e4d9ae 100644 --- a/cryptide_project/src/Pages/Home.tsx +++ b/cryptide_project/src/Pages/Home.tsx @@ -13,6 +13,9 @@ import { socket } from '../SocketConfig'; import JSONParser from '../JSONParser'; +const basePath = process.env.REACT_APP_BASE_PATH || '/containers/Crypteam-website'; + + // @ts-ignore function Home() { const theme=useTheme(); @@ -100,7 +103,7 @@ function Home() { {/*


Kwanchai Moriya

*/} {/* */}
- { @@ -68,7 +68,7 @@ const InGame = ({locale, changeLocale}) => { if (cptNavigation % 2 == 0){ if (navigationType.toString() == "POP"){ socket.emit("player quit") - navigate(`${basePath}/play`) + navigate(`/${basePath}/play`) } } @@ -280,8 +280,10 @@ const InGame = ({locale, changeLocale}) => { const [SwitchEnabled, setSwitchEnabled] = useState(false) const allIndices = Stub.GenerateIndice() - const { indice, players } = useGame(); + const { indice, players, actualPlayerIndex} = useGame(); + const nbPlayer = players.length; + const navdeduc = '/deduc?actualId=' + actualPlayerIndex + '&nbPlayer=' + nbPlayer; return (
@@ -375,12 +377,9 @@ const InGame = ({locale, changeLocale}) => { info - {/* */} {!IsSolo && - +