From 8a1946fa0946e938bcd079311a7e8d0351a4c342 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Tue, 5 Dec 2023 17:08:58 +0100 Subject: [PATCH 01/11] =?UTF-8?q?Scoreboard=20Service=20+=20Controller=20q?= =?UTF-8?q?ui=20permet=20r=C3=A9cup=C3=A9rer=20DailyMastermind=20+=20Affic?= =?UTF-8?q?hage=20du=20dailyMastermind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controllers/ScoreboardController.js | 29 +++++++++++ .../server/api/routes/AuthRoutes.js | 4 ++ .../server/api/services/DatabaseService.js | 27 ++++++++++ .../src/Components/ScoreBoard.tsx | 52 +++++++++++-------- .../src/services/ScoreboardService.tsx | 28 ++++++++++ .../src/services/SessionService.tsx | 1 - 6 files changed, 119 insertions(+), 22 deletions(-) create mode 100644 cryptide_project/server/api/controllers/ScoreboardController.js create mode 100644 cryptide_project/src/services/ScoreboardService.tsx diff --git a/cryptide_project/server/api/controllers/ScoreboardController.js b/cryptide_project/server/api/controllers/ScoreboardController.js new file mode 100644 index 0000000..51812fd --- /dev/null +++ b/cryptide_project/server/api/controllers/ScoreboardController.js @@ -0,0 +1,29 @@ +const path = require('path'); +const DatabaseService = require(path.resolve(__dirname, '../services/DatabaseService')); + +const ENIGME_FACILE = "enigme_facile"; +const ENIGME_MOYEN = "enigme_moyenne"; +const ENIGME_DIFFICILE = "enigme_difficile"; + +class SessionController { + static async getDailyMastermind(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const dailyMastermindStats = await db.getDailyMastermindStats(); + + res.status(200).json({ dailyMastermindStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + } + finally{ + await db.disconnect(); + } + } +} + +module.exports = SessionController; \ No newline at end of file diff --git a/cryptide_project/server/api/routes/AuthRoutes.js b/cryptide_project/server/api/routes/AuthRoutes.js index 3e053e0..1642035 100644 --- a/cryptide_project/server/api/routes/AuthRoutes.js +++ b/cryptide_project/server/api/routes/AuthRoutes.js @@ -2,6 +2,7 @@ const express = require('express'); const router = express.Router(); const AuthController = require('../controllers/AuthController'); const SessionController = require('../controllers/SessionController'); +const ScoreboardController = require('../controllers/ScoreboardController'); // Routes pour l'authentification router.post('/auth/signup', AuthController.signUp); @@ -20,4 +21,7 @@ router.post('/session/addHardEnigmaStats', SessionController.addHardEnigmaStats) router.post('/session/addOnlineStats', SessionController.addOnlineStats); router.put('/session/updatePseudo', SessionController.UpdatePseudo); +// Routes pour le scoreboard +router.get('/scoreboard/getDailyMastermind', ScoreboardController.getDailyMastermind); + module.exports = router; diff --git a/cryptide_project/server/api/services/DatabaseService.js b/cryptide_project/server/api/services/DatabaseService.js index e8baba2..7cc35b8 100644 --- a/cryptide_project/server/api/services/DatabaseService.js +++ b/cryptide_project/server/api/services/DatabaseService.js @@ -127,6 +127,33 @@ class DatabaseService { }); } + // ------------------------------------------------------------- + // ------------------- STATS GENERALES ------------------------- + // ------------------------------------------------------------- + + // Récupérer les 10 meilleurs scores de la journée + async getDailyMastermindStats() { + return new Promise((resolve, reject) => { + // Obtenez la date actuelle au format AAAA-MM-JJ + const currentDate = new Date().toISOString().slice(0, 10); + + this.client.all( + 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score DESC LIMIT 10', + "mastermind", + currentDate, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } + + + // ------------------------------------------------------------- // ------------------- STATS MASTERMIND ------------------------ // ------------------------------------------------------------- diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 3dbe23c..15f63ee 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect, useState} from 'react'; /* Style */ import '../Pages/Play.css'; @@ -22,13 +22,33 @@ import Col from 'react-bootstrap/Col'; import ButtonImgNav from './ButtonImgNav'; import User from '../model/User'; -/* Types */ +/* Services */ +import ScoreboardService from '../services/ScoreboardService'; //@ts-ignore const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { const theme=useTheme(); - console.log(Player); + const [dailyMastermindStats, setDailyMastermindStats] = useState(null); + + // Récupérer les records daily et weekly + useEffect(() => { + async function fetchDailyMastermindStats() { + try { + const result = await ScoreboardService.getDailyMastermindStats(); + console.log(result); + setDailyMastermindStats(result); + } catch (error) { + console.error(error); + } + } + + fetchDailyMastermindStats(); + }, []); + + useEffect(() => { + console.log("Updated dailyMastermindStats:", dailyMastermindStats); + }, [dailyMastermindStats]); return ( //
@@ -133,27 +153,17 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { width='100' alt="Person2"/> - - Partie Jouées : - 10 - - - Partie gagnées : - 2 - - - Pions posés : - 2 - -
- - Partie solo : - 21 + {dailyMastermindStats !== null ? (dailyMastermindStats.dailyMastermindStats.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.score} + )) + ) : ( - Nombre de coups moyen : - 19 + No data + )}
diff --git a/cryptide_project/src/services/ScoreboardService.tsx b/cryptide_project/src/services/ScoreboardService.tsx new file mode 100644 index 0000000..9e5427f --- /dev/null +++ b/cryptide_project/src/services/ScoreboardService.tsx @@ -0,0 +1,28 @@ +import {ADRESSE_DBSERVER} from '../AdressSetup'; + +class ScoreboardService { + static async getDailyMastermindStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyMastermind', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } +} + +export default ScoreboardService; \ No newline at end of file diff --git a/cryptide_project/src/services/SessionService.tsx b/cryptide_project/src/services/SessionService.tsx index e17de92..f555132 100644 --- a/cryptide_project/src/services/SessionService.tsx +++ b/cryptide_project/src/services/SessionService.tsx @@ -165,7 +165,6 @@ class SessionService { throw error; } } - } export default SessionService; From 78dd03cefa8a0ad78feb584d7e58fe7af59cbb26 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Wed, 6 Dec 2023 11:02:07 +0100 Subject: [PATCH 02/11] ajout dans le scoreboard des stats daily/weekly multijoueur + correctif pour affichage quand pas de data --- .../api/controllers/ScoreboardController.js | 68 ++++++++++- .../server/api/routes/AuthRoutes.js | 7 +- .../server/api/services/DatabaseService.js | 74 +++++++++++- .../src/Components/ScoreBoard.tsx | 106 +++++++++++++++--- .../src/services/ScoreboardService.tsx | 78 +++++++++++++ 5 files changed, 313 insertions(+), 20 deletions(-) diff --git a/cryptide_project/server/api/controllers/ScoreboardController.js b/cryptide_project/server/api/controllers/ScoreboardController.js index 51812fd..6010beb 100644 --- a/cryptide_project/server/api/controllers/ScoreboardController.js +++ b/cryptide_project/server/api/controllers/ScoreboardController.js @@ -6,6 +6,10 @@ const ENIGME_MOYEN = "enigme_moyenne"; const ENIGME_DIFFICILE = "enigme_difficile"; class SessionController { + // --------------------------------------------------- + // ----------------- GET DAILY STATS ----------------- + // --------------------------------------------------- + static async getDailyMastermind(req, res){ const db = new DatabaseService(); @@ -14,7 +18,68 @@ class SessionController { const dailyMastermindStats = await db.getDailyMastermindStats(); - res.status(200).json({ dailyMastermindStats }); + res.status(200).json({ tab : dailyMastermindStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getDailyOnline(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const dailyOnlineStats = await db.getDailyOnlineStats(); + + res.status(200).json({ tab : dailyOnlineStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + } + finally{ + await db.disconnect(); + } + } + + // --------------------------------------------------- + // ---------------- GET WEEKLY STATS ----------------- + // --------------------------------------------------- + + static async getWeeklyMastermind(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const weeklyMastermindStats = await db.getWeeklyMastermindStats(); + + res.status(200).json({ tab : weeklyMastermindStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getWeeklyOnline(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const weeklyOnlineStats = await db.getWeeklyOnlineStats(); + + res.status(200).json({ tab : weeklyOnlineStats }); } catch(error){ console.error(error); @@ -24,6 +89,7 @@ class SessionController { await db.disconnect(); } } + } module.exports = SessionController; \ No newline at end of file diff --git a/cryptide_project/server/api/routes/AuthRoutes.js b/cryptide_project/server/api/routes/AuthRoutes.js index 1642035..9622c3b 100644 --- a/cryptide_project/server/api/routes/AuthRoutes.js +++ b/cryptide_project/server/api/routes/AuthRoutes.js @@ -21,7 +21,12 @@ router.post('/session/addHardEnigmaStats', SessionController.addHardEnigmaStats) router.post('/session/addOnlineStats', SessionController.addOnlineStats); router.put('/session/updatePseudo', SessionController.UpdatePseudo); -// Routes pour le scoreboard +// Routes pour le daily scoreboard router.get('/scoreboard/getDailyMastermind', ScoreboardController.getDailyMastermind); +router.get('/scoreboard/getDailyOnline', ScoreboardController.getDailyOnline); +// Routes pour le weekly scoreboard +router.get('/scoreboard/getWeeklyMastermind', ScoreboardController.getWeeklyMastermind); +router.get('/scoreboard/getWeeklyOnline', ScoreboardController.getWeeklyOnline); + module.exports = router; diff --git a/cryptide_project/server/api/services/DatabaseService.js b/cryptide_project/server/api/services/DatabaseService.js index 7cc35b8..7c8e9c2 100644 --- a/cryptide_project/server/api/services/DatabaseService.js +++ b/cryptide_project/server/api/services/DatabaseService.js @@ -127,16 +127,16 @@ class DatabaseService { }); } - // ------------------------------------------------------------- - // ------------------- STATS GENERALES ------------------------- - // ------------------------------------------------------------- + // --------------------------------------------------------------- + // ------------------- STATS JOURNALIERE ------------------------- + // --------------------------------------------------------------- - // Récupérer les 10 meilleurs scores de la journée async getDailyMastermindStats() { return new Promise((resolve, reject) => { // Obtenez la date actuelle au format AAAA-MM-JJ const currentDate = new Date().toISOString().slice(0, 10); + // Récupérer les 5 meilleurs scores de la journée this.client.all( 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score DESC LIMIT 10', "mastermind", @@ -151,8 +151,74 @@ class DatabaseService { ); }); } + + async getDailyOnlineStats() { + return new Promise((resolve, reject) => { + const currentDate = new Date().toISOString().slice(0, 10); + this.client.all( + 'SELECT pseudo, COUNT(*) AS wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? AND win = ? GROUP BY users.idUser ORDER BY wins DESC LIMIT 10', + "multijoueur", currentDate, 1, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } + + + // --------------------------------------------------------------- + // ------------------- STATS HEBDOMADAIRE ------------------------ + // --------------------------------------------------------------- + + async getWeeklyMastermindStats() { + return new Promise((resolve, reject) => { + const currentDate = new Date().toISOString().slice(0, 10); + const currentDay = new Date().getDay(); + const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); + + this.client.all( + 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY score DESC LIMIT 10', + "mastermind", + firstDayOfWeek, + currentDate, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } + + async getWeeklyOnlineStats() { + return new Promise((resolve, reject) => { + const currentDate = new Date().toISOString().slice(0, 10); + const currentDay = new Date().getDay(); + const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); + this.client.all( + 'SELECT pseudo, COUNT(*) as wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? AND win = ? ORDER BY wins DESC LIMIT 10', + "multijoueur", + firstDayOfWeek, + currentDate, + 1, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } // ------------------------------------------------------------- // ------------------- STATS MASTERMIND ------------------------ diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 15f63ee..9d504e6 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -29,26 +29,51 @@ import ScoreboardService from '../services/ScoreboardService'; const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { const theme=useTheme(); + // DAILY STATS const [dailyMastermindStats, setDailyMastermindStats] = useState(null); + const [dailyEasyEnigmaStats, setDailyEasyEnigmaStats] = useState(null); + const [dailyMediumEnigmaStats, setDailyMediumEnigmaStats] = useState(null); + const [dailyHardEnigmaStats, setDailyHardEnigmaStats] = useState(null); + const [dailyOnlineStats, setDailyOnlineStats] = useState(null); - // Récupérer les records daily et weekly + // WEEKLY STATS + const [weeklyMastermindStats, setWeeklyMastermindStats] = useState(null); + const [weeklyEasyEnigmaStats, setWeeklyEasyEnigmaStats] = useState(null); + const [weeklyMediumEnigmaStats, setWeeklyMediumEnigmaStats] = useState(null); + const [weeklyHardEnigmaStats, setWeeklyHardEnigmaStats] = useState(null); + const [weeklyOnlineStats, setWeeklyOnlineStats] = useState(null); + + // Récupérer les records daily useEffect(() => { - async function fetchDailyMastermindStats() { + async function fetchDailyStats() { try { - const result = await ScoreboardService.getDailyMastermindStats(); - console.log(result); - setDailyMastermindStats(result); + const resultMM = await ScoreboardService.getDailyMastermindStats(); + const resultOL = await ScoreboardService.getDailyOnlineStats(); + console.log(resultMM); + console.log(resultOL); + setDailyMastermindStats(resultMM); + setDailyOnlineStats(resultOL); + } catch (error) { + console.error(error); + } + } + + async function fetchWeeklyStats() { + try{ + const resultWMM = await ScoreboardService.getWeeklyMastermindStats(); + const resultOL = await ScoreboardService.getWeeklyOnlineStats(); + console.log(resultWMM); + console.log(resultOL); + setWeeklyMastermindStats(resultWMM); + setWeeklyOnlineStats(resultOL); } catch (error) { console.error(error); } } - - fetchDailyMastermindStats(); + + fetchDailyStats(); + fetchWeeklyStats(); }, []); - - useEffect(() => { - console.log("Updated dailyMastermindStats:", dailyMastermindStats); - }, [dailyMastermindStats]); return ( //
@@ -153,13 +178,33 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { width='100' alt="Person2"/> - {dailyMastermindStats !== null ? (dailyMastermindStats.dailyMastermindStats.map((stats: any, index: number) => ( + MasterMind : + {dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => ( {stats.pseudo} {stats.score} - )) - ) : ( + )) : ( + + No data + + )) : ( + + No data + + )} +
+ Multijoueur : + {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.wins} + + )) : ( + + No data + + )) : ( No data @@ -171,6 +216,39 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { height='100' width='100' alt="Person2"/> + + MasterMind : + {weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.score} + + )) : ( + + No data + + )) : ( + + No data + + )} +
+ Multijoueur : + {weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.wins} + + )) : ( + + No data + + )) : ( + + No data + + )} +
diff --git a/cryptide_project/src/services/ScoreboardService.tsx b/cryptide_project/src/services/ScoreboardService.tsx index 9e5427f..cf7f72d 100644 --- a/cryptide_project/src/services/ScoreboardService.tsx +++ b/cryptide_project/src/services/ScoreboardService.tsx @@ -1,6 +1,11 @@ import {ADRESSE_DBSERVER} from '../AdressSetup'; class ScoreboardService { + + // ------------------------------ GET ------------------------------ + // ----------------------------- DAILY ----------------------------- + // ----------------------------- STATS ----------------------------- + static async getDailyMastermindStats() { try { const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyMastermind', { @@ -23,6 +28,79 @@ class ScoreboardService { throw error; } } + + static async getDailyOnlineStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyOnline', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + + // ------------------------------ GET ------------------------------ + // ----------------------------- WEEKLY ---------------------------- + // ----------------------------- STATS ----------------------------- + + static async getWeeklyMastermindStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyMastermind', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + + static async getWeeklyOnlineStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyOnline', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } } export default ScoreboardService; \ No newline at end of file From b9f1f99e0b11e2f05fe94ead14d409df84f89527 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Wed, 6 Dec 2023 12:59:48 +0100 Subject: [PATCH 03/11] =?UTF-8?q?Correctif=20apport=C3=A9=20pour=20le=20fo?= =?UTF-8?q?nctionnement=20du=20temps=20lors=20d'une=20partie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controllers/ScoreboardController.js | 46 ++++++++++++-- .../server/api/routes/AuthRoutes.js | 3 + .../server/api/services/DatabaseService.js | 41 ++++++++++++ .../src/Components/GraphContainer.tsx | 32 +++++++--- .../src/Components/ScoreBoard.tsx | 63 ++++++++++++++++--- .../src/services/ScoreboardService.tsx | 46 ++++++++++++++ 6 files changed, 210 insertions(+), 21 deletions(-) diff --git a/cryptide_project/server/api/controllers/ScoreboardController.js b/cryptide_project/server/api/controllers/ScoreboardController.js index 6010beb..4854986 100644 --- a/cryptide_project/server/api/controllers/ScoreboardController.js +++ b/cryptide_project/server/api/controllers/ScoreboardController.js @@ -22,7 +22,26 @@ class SessionController { } catch(error){ console.error(error); - res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyMastermind.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getDailyEasyEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const dailyEasyEnigmaStats = await db.getDailyEnigmaStats(ENIGME_FACILE); + + res.status(200).json({ tab : dailyEasyEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyEasyEnigma.' }); } finally{ await db.disconnect(); @@ -41,7 +60,7 @@ class SessionController { } catch(error){ console.error(error); - res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyOnline' }); } finally{ await db.disconnect(); @@ -64,7 +83,26 @@ class SessionController { } catch(error){ console.error(error); - res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyMastermind.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getWeeklyEasyEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const weeklyEasyEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_FACILE); + + res.status(200).json({ tab : weeklyEasyEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyEasyEnigma.' }); } finally{ await db.disconnect(); @@ -83,7 +121,7 @@ class SessionController { } catch(error){ console.error(error); - res.status(500).json({ error: 'Erreur lors de la récupération du scoreboard.' }); + res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyOnline' }); } finally{ await db.disconnect(); diff --git a/cryptide_project/server/api/routes/AuthRoutes.js b/cryptide_project/server/api/routes/AuthRoutes.js index 9622c3b..5d0ad78 100644 --- a/cryptide_project/server/api/routes/AuthRoutes.js +++ b/cryptide_project/server/api/routes/AuthRoutes.js @@ -23,9 +23,12 @@ router.put('/session/updatePseudo', SessionController.UpdatePseudo); // Routes pour le daily scoreboard router.get('/scoreboard/getDailyMastermind', ScoreboardController.getDailyMastermind); +router.get('/scoreboard/getDailyEasyEnigma', ScoreboardController.getDailyEasyEnigma); router.get('/scoreboard/getDailyOnline', ScoreboardController.getDailyOnline); + // Routes pour le weekly scoreboard router.get('/scoreboard/getWeeklyMastermind', ScoreboardController.getWeeklyMastermind); +router.get('/scoreboard/getWeeklyEasyEnigma', ScoreboardController.getWeeklyEasyEnigma); router.get('/scoreboard/getWeeklyOnline', ScoreboardController.getWeeklyOnline); diff --git a/cryptide_project/server/api/services/DatabaseService.js b/cryptide_project/server/api/services/DatabaseService.js index 7c8e9c2..7074dee 100644 --- a/cryptide_project/server/api/services/DatabaseService.js +++ b/cryptide_project/server/api/services/DatabaseService.js @@ -152,6 +152,25 @@ class DatabaseService { }); } + async getDailyEnigmaStats(enigmaLevel) { + return new Promise((resolve, reject) => { + const currentDate = new Date().toISOString().slice(0, 10); + + this.client.all( + 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY time DESC LIMIT 10', + enigmaLevel, + currentDate, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } + async getDailyOnlineStats() { return new Promise((resolve, reject) => { const currentDate = new Date().toISOString().slice(0, 10); @@ -197,6 +216,28 @@ class DatabaseService { }); } + async getWeeklyEnigmaStats(enigmaLevel) { + return new Promise((resolve, reject) => { + const currentDate = new Date().toISOString().slice(0, 10); + const currentDay = new Date().getDay(); + const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); + + this.client.all( + 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY time DESC LIMIT 10', + enigmaLevel, + firstDayOfWeek, + currentDate, + (err, result) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + } + async getWeeklyOnlineStats() { return new Promise((resolve, reject) => { const currentDate = new Date().toISOString().slice(0, 10); diff --git a/cryptide_project/src/Components/GraphContainer.tsx b/cryptide_project/src/Components/GraphContainer.tsx index c823c92..78b3cb5 100644 --- a/cryptide_project/src/Components/GraphContainer.tsx +++ b/cryptide_project/src/Components/GraphContainer.tsx @@ -66,6 +66,8 @@ let firstPlayer = 0 let cptBug = 0 let cptUseEffect = 0 let testPlayers: Player[] = [] +let testTemps = 0 +let testFirst = false const MyGraphComponent: React.FC = ({onNodeClick, handleShowTurnBar, handleTurnBarTextChange, playerTouched, setPlayerTouched, changecptTour, solo, isDaily, isEasy, addToHistory, showLast, setNetwork, setNetworkEnigme, setPlayerIndex, askedWrong, setAskedWrong, importToPdf, setImportToPdf}) => { @@ -75,7 +77,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS let initMtn = 0 const {isLoggedIn, user, manager} = useAuth(); - const { indices, indice, person, personNetwork, setNodeIdData, players, setPlayersData, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex, setTurnPlayerIndexData, setWinnerData, dailyEnigme, setNbCoupData, settempsData, setNetworkDataData, setSeedData, nodesC} = useGame(); + const { indices, indice, person, personNetwork, setNodeIdData, players, setPlayersData, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex, setTurnPlayerIndexData, setWinnerData, dailyEnigme, setNbCoupData, settempsData, setNetworkDataData, setSeedData, nodesC, temps} = useGame(); const params = new URLSearchParams(window.location.search); const navigate = useNavigate(); @@ -84,10 +86,16 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS const [elapsedTime, setElapsedTime] = useState(0); useEffect(() => { + if (testFirst){ + testTemps = 0 + endgame = false + testFirst = false + } // Démarrez le timer au montage du composant const intervalId = setInterval(() => { setElapsedTime((prevElapsedTime) => prevElapsedTime + 0.5); settempsData(elapsedTime) + testTemps += 0.5 cptBug ++ if (cptBug > 10){ @@ -99,6 +107,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS // Vérifiez si la durée est écoulée, puis arrêtez le timer if (endgame) { clearInterval(intervalId); + testTemps = 0 } }, 500); @@ -762,7 +771,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS setLastIndex(-1) setPlayerTouched(-1) setWinnerData(winner) - setElapsedTime(0) + first = true cptHistory = 0 @@ -779,10 +788,10 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS // console.log("nbGames: " + user.onlineStats.nbGames + " nbWins: " + user.onlineStats.nbWins); if(winner.id === currentPlayer.id){ // Ajouter une victoire - manager.userService.addOnlineStats(user.pseudo, 1, elapsedTime); + manager.userService.addOnlineStats(user.pseudo, 1, testTemps - 0.5); } else{ - manager.userService.addOnlineStats(user.pseudo, 0, elapsedTime); + manager.userService.addOnlineStats(user.pseudo, 0, testTemps - 0.5); } } else{ @@ -795,6 +804,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS console.log(e); } finally{ + setElapsedTime(0) socket.off("end game") socket.off("asked all") socket.off("opacity activated") @@ -970,6 +980,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS if (person != undefined){ let index =0 let works = true + const statsTime = elapsedTime; for (const i of indices){ const tester = IndiceTesterFactory.Create(i) const test = tester.Works(person) @@ -990,26 +1001,25 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS } cptTour ++; setNbCoupData(cptTour) - setElapsedTime(0) - endgame = true try{ + console.log("time: " + testTemps) if(user && isLoggedIn){ if(solo){ if(isDaily){ // TODO: verif difficulté et add les stats // TODO: verif pour facile et difficile, si réussi en one shot ou non if(isEasy){ - manager.userService.addEasyEnigmaStats(user.pseudo, 1, elapsedTime); + manager.userService.addEasyEnigmaStats(user.pseudo, 1, testTemps - 0.5); } else{ - manager.userService.addHardEnigmaStats(user.pseudo, 1, elapsedTime); + manager.userService.addHardEnigmaStats(user.pseudo, 1, testTemps - 0.5); } } else{ // add stats mastermind if(user && user.mastermindStats){ - manager.userService.addMastermindStats(user.pseudo, cptTour, elapsedTime); + manager.userService.addMastermindStats(user.pseudo, cptTour, testTemps - 0.5); } } } @@ -1018,7 +1028,9 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS catch(error){ console.log(error); } - + testFirst = true + setElapsedTime(0) + endgame = true navigate("/endgame?solo=true&daily=" + isDaily) } diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 9d504e6..e3ad3d4 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -49,10 +49,13 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { try { const resultMM = await ScoreboardService.getDailyMastermindStats(); const resultOL = await ScoreboardService.getDailyOnlineStats(); - console.log(resultMM); - console.log(resultOL); + const resultEF = await ScoreboardService.getDailyEasyEnigmaStats(); + + console.log(resultEF); + setDailyMastermindStats(resultMM); setDailyOnlineStats(resultOL); + setDailyEasyEnigmaStats(resultEF); } catch (error) { console.error(error); } @@ -60,12 +63,15 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { async function fetchWeeklyStats() { try{ - const resultWMM = await ScoreboardService.getWeeklyMastermindStats(); + const resultMM = await ScoreboardService.getWeeklyMastermindStats(); const resultOL = await ScoreboardService.getWeeklyOnlineStats(); - console.log(resultWMM); - console.log(resultOL); - setWeeklyMastermindStats(resultWMM); + const resultEF = await ScoreboardService.getWeeklyEasyEnigmaStats(); + + console.log(resultEF); + + setWeeklyMastermindStats(resultMM); setWeeklyOnlineStats(resultOL); + setWeeklyEasyEnigmaStats(resultEF); } catch (error) { console.error(error); } @@ -193,7 +199,9 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { No data )} +
+ Multijoueur : {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( @@ -209,6 +217,27 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { No data )} + +
+ + Enigme facile : + {dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.time} + + )) : ( + + No data + + )) : ( + + No data + + )} + +
+
@@ -248,6 +277,26 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { No data )} + +
+ + Enigme facile : + {weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => ( + + {stats.pseudo} + {stats.time} + + )) : ( + + No data + + )) : ( + + No data + + )} + +
@@ -258,4 +307,4 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { ); } -export default ScoreBoard; +export default ScoreBoard; \ No newline at end of file diff --git a/cryptide_project/src/services/ScoreboardService.tsx b/cryptide_project/src/services/ScoreboardService.tsx index cf7f72d..3251182 100644 --- a/cryptide_project/src/services/ScoreboardService.tsx +++ b/cryptide_project/src/services/ScoreboardService.tsx @@ -29,6 +29,29 @@ class ScoreboardService { } } + static async getDailyEasyEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyEasyEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + static async getDailyOnlineStats() { try { const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyOnline', { @@ -79,6 +102,29 @@ class ScoreboardService { } } + static async getWeeklyEasyEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyEasyEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + static async getWeeklyOnlineStats() { try { const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyOnline', { From 10edfb1f4f0fce0604d3f2d35f68fd7925440a0a Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Wed, 6 Dec 2023 13:40:03 +0100 Subject: [PATCH 04/11] =?UTF-8?q?page=20info=20contient=20l'=C3=A9tat=20de?= =?UTF-8?q?=20la=20session=20pour=20navbar=20dynamique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cryptide_project/src/Pages/InfoPage.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cryptide_project/src/Pages/InfoPage.tsx b/cryptide_project/src/Pages/InfoPage.tsx index dadd9ac..d44b36f 100644 --- a/cryptide_project/src/Pages/InfoPage.tsx +++ b/cryptide_project/src/Pages/InfoPage.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; /* Style */ import '../Style/Global.css'; @@ -24,11 +24,26 @@ import Alert from 'react-bootstrap/Alert'; import MGlass from "../res/icon/magnifying-glass.png"; import Param from "../res/icon/param.png"; import Info from "../res/icon/infoGreen.png"; //todo changer la couleur de l'icon +import { useAuth } from '../Contexts/AuthContext'; + //@ts-ignore function InfoPage({locale, changeLocale}) { - const theme = useTheme(); + const {isLoggedIn, login, user, setUserData, manager } = useAuth(); + + useEffect(() => { + if (user == null){ + manager.userService.fetchUserInformation().then(([user, loggedIn]) =>{ + if (user!=null){ + if (loggedIn){ + login() + setUserData(user) + } + } + }) + } + }, [isLoggedIn]); const styles = { roux: { backgroundColor: ColorToHexa(Color.REDHEAD), width: '15px', height: '15px', display: 'inline-block', marginRight: '5px' }, From e878d6e281b98192c4ec17f997ff4679bff70e71 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Wed, 6 Dec 2023 13:48:55 +0100 Subject: [PATCH 05/11] Modif affichage stats scoreboard + modif DESC to ASC dans DBService --- .../server/api/services/DatabaseService.js | 12 ++++++------ cryptide_project/src/Components/ScoreBoard.tsx | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cryptide_project/server/api/services/DatabaseService.js b/cryptide_project/server/api/services/DatabaseService.js index 7074dee..8742bfc 100644 --- a/cryptide_project/server/api/services/DatabaseService.js +++ b/cryptide_project/server/api/services/DatabaseService.js @@ -138,7 +138,7 @@ class DatabaseService { // Récupérer les 5 meilleurs scores de la journée this.client.all( - 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score DESC LIMIT 10', + 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY score ASC LIMIT 10', "mastermind", currentDate, (err, result) => { @@ -157,7 +157,7 @@ class DatabaseService { const currentDate = new Date().toISOString().slice(0, 10); this.client.all( - 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY time DESC LIMIT 10', + 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? ORDER BY time ASC LIMIT 10', enigmaLevel, currentDate, (err, result) => { @@ -176,7 +176,7 @@ class DatabaseService { const currentDate = new Date().toISOString().slice(0, 10); this.client.all( - 'SELECT pseudo, COUNT(*) AS wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? AND win = ? GROUP BY users.idUser ORDER BY wins DESC LIMIT 10', + 'SELECT pseudo, COUNT(*) AS wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) = ? AND win = ? GROUP BY users.idUser ORDER BY wins ASC LIMIT 10', "multijoueur", currentDate, 1, (err, result) => { if (err) { @@ -201,7 +201,7 @@ class DatabaseService { const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); this.client.all( - 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY score DESC LIMIT 10', + 'SELECT pseudo, score FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY score ASC LIMIT 10', "mastermind", firstDayOfWeek, currentDate, @@ -223,7 +223,7 @@ class DatabaseService { const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); this.client.all( - 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY time DESC LIMIT 10', + 'SELECT pseudo, time FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? ORDER BY time ASC LIMIT 10', enigmaLevel, firstDayOfWeek, currentDate, @@ -245,7 +245,7 @@ class DatabaseService { const firstDayOfWeek = new Date(new Date().setDate(new Date().getDate() - currentDay)).toISOString().slice(0, 10); this.client.all( - 'SELECT pseudo, COUNT(*) as wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? AND win = ? ORDER BY wins DESC LIMIT 10', + 'SELECT pseudo, COUNT(*) as wins FROM users INNER JOIN games ON users.idUser = games.idUser WHERE gameType = ? AND SUBSTR(playedDate, 1, 10) BETWEEN ? AND ? AND win = ? ORDER BY wins ASC LIMIT 10', "multijoueur", firstDayOfWeek, currentDate, diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index e3ad3d4..7d3e617 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -187,7 +187,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { MasterMind : {dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.score} )) : ( @@ -205,7 +205,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { Multijoueur : {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.wins} )) : ( @@ -223,7 +223,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { Enigme facile : {dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.time} )) : ( @@ -249,7 +249,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { MasterMind : {weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.score} )) : ( @@ -265,7 +265,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { Multijoueur : {weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.wins} )) : ( @@ -283,7 +283,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { Enigme facile : {weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => ( - {stats.pseudo} + {index+1}.{stats.pseudo} {stats.time} )) : ( From 472d94ebe169c2a7381ea5acc32e741ca1120d17 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Thu, 7 Dec 2023 16:53:56 +0100 Subject: [PATCH 06/11] =?UTF-8?q?Modif=20bouton=20pour=20jouer=20+=20Carou?= =?UTF-8?q?sel=20pour=20les=20stats=20sur=20les=20diff=C3=A9rentes=20parti?= =?UTF-8?q?es=20(Nous,=20Daily,=20Weekly)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cryptide_project/package-lock.json | 147 +++++ cryptide_project/package.json | 6 + .../api/controllers/SessionController.js | 2 - cryptide_project/src/Components/NavBar.tsx | 65 +-- .../src/Components/ScoreBoard.css | 15 + .../src/Components/ScoreBoard.tsx | 503 ++++++++++-------- cryptide_project/src/Pages/LoginForm.tsx | 8 +- cryptide_project/src/Pages/NewPlay.tsx | 34 +- cryptide_project/src/Pages/Play.css | 97 ++-- cryptide_project/src/Pages/Profile.css | 1 - cryptide_project/src/Pages/Profile.tsx | 32 +- cryptide_project/src/Pages/SignUpForm.tsx | 1 - cryptide_project/yarn.lock | 112 +++- 13 files changed, 655 insertions(+), 368 deletions(-) create mode 100644 cryptide_project/src/Components/ScoreBoard.css diff --git a/cryptide_project/package-lock.json b/cryptide_project/package-lock.json index f52d070..208c662 100644 --- a/cryptide_project/package-lock.json +++ b/cryptide_project/package-lock.json @@ -26,8 +26,11 @@ "jspdf": "^2.5.1", "jszip": "^3.10.1", "lodash": "^4.17.21", + "nuka-carousel": "^7.0.0", + "pure-react-carousel": "^1.30.1", "react": "^18.2.0", "react-bootstrap": "^2.9.1", + "react-carousel": "^4.3.0", "react-country-flag": "^3.1.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0", @@ -35,7 +38,9 @@ "react-router-dom": "^6.18.0", "react-router-hash-link": "^2.4.3", "react-scripts": "5.0.1", + "react-slick": "^0.29.0", "react-switch": "^7.0.0", + "slick-carousel": "^1.8.1", "socket.io": "^4.7.2", "socket.io-client": "^4.7.2", "sqlite3": "^5.1.6", @@ -46,6 +51,7 @@ "devDependencies": { "@types/file-saver": "^2.0.7", "@types/react-router-hash-link": "^2.4.9", + "@types/react-slick": "^0.23.12", "@types/uuid": "^9.0.7", "babel-jest": "^29.7.0", "depcheck": "^1.4.7" @@ -4655,6 +4661,15 @@ "@types/react-router-dom": "^5.3.0" } }, + "node_modules/@types/react-slick": { + "version": "0.23.12", + "resolved": "https://registry.npmjs.org/@types/react-slick/-/react-slick-0.23.12.tgz", + "integrity": "sha512-WjY/wIjzgXCh6gXRZL75OC9n/Hn4MwKWI7ZJ4iA2OxavN9eKvkV5MPFjSgH5sofabq78Ucrl6u3okiBUNNIrDQ==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/react-transition-group": { "version": "4.4.8", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.8.tgz", @@ -7521,6 +7536,11 @@ "node": ">=10" } }, + "node_modules/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -7575,6 +7595,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/deep-freeze": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz", + "integrity": "sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg==" + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -8147,6 +8172,11 @@ "node": ">=10.13.0" } }, + "node_modules/enquire.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz", + "integrity": "sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw==" + }, "node_modules/entities": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", @@ -8164,6 +8194,14 @@ "node": ">=6" } }, + "node_modules/equals": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/equals/-/equals-1.0.5.tgz", + "integrity": "sha512-wI15a6ZoaaXPv+55+Vh2Kqn3+efKRv8QPtcGTjW5xmanMnQzESdAt566jevtMZyt3W/jwLDTzXpMph5ECDJ2zg==", + "dependencies": { + "jkroso-type": "1" + } + }, "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -12971,6 +13009,17 @@ "jiti": "bin/jiti.js" } }, + "node_modules/jkroso-type": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/jkroso-type/-/jkroso-type-1.1.1.tgz", + "integrity": "sha512-zZgay+fPG6PgMUrpyFADmQmvLo39+AZa7Gc5pZhev2RhDxwANEq2etwD8d0e6rTg5NkwOIlQmaEmns3draC6Ng==" + }, + "node_modules/jquery": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "peer": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -13069,6 +13118,14 @@ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" }, + "node_modules/json2mq": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz", + "integrity": "sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA==", + "dependencies": { + "string-convert": "^0.2.0" + } + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -14203,6 +14260,18 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/nuka-carousel": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/nuka-carousel/-/nuka-carousel-7.0.0.tgz", + "integrity": "sha512-KE0WV1MuE4Gq6ynL8P3qJH2rGq/DkJ0ej+ezo0IuZp4oklV8WNqu6P6O1utJqihHLGoEuFppq5wlHSHfhdCHXA==", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "react": ">=18.0.0", + "react-dom": ">=18.0.0" + } + }, "node_modules/nwsapi": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", @@ -16135,6 +16204,30 @@ "node": ">=6" } }, + "node_modules/pure-react-carousel": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/pure-react-carousel/-/pure-react-carousel-1.30.1.tgz", + "integrity": "sha512-B1qi62hZk0OFqRR4cTjtgIeOn/Ls5wo+HsLtrXT4jVf5et8ldBHSt+6LsYRJN86Or8dm+XbnJNEHy6WDJ0/DQw==", + "dependencies": { + "@babel/runtime": "^7.5.5", + "deep-freeze": "0.0.1", + "deepmerge": "^2.2.1", + "equals": "^1.0.5", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": "15.x || 16.x || 17.x || 18.x", + "react-dom": "15.x || 16.x || 17.x || 18.x" + } + }, + "node_modules/pure-react-carousel/node_modules/deepmerge": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", + "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -16206,6 +16299,14 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/range": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/range/-/range-0.0.3.tgz", + "integrity": "sha512-OxK2nY2bmeEB4NxoBraQIBOOeOIxoBvm6yt8MA1kLappgkG3SyLf173iOtT5woWycrtESDD2g0Nl2yt8YPoUnw==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -16308,6 +16409,18 @@ } } }, + "node_modules/react-carousel": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/react-carousel/-/react-carousel-4.3.0.tgz", + "integrity": "sha512-t8MfCK877KuOaQFAsO6NwzkWdhcJG8hxSN5zYR7/cSfTNI6DnM/HswvgvdfajtiETuoLZRMXXLZv6QRLGETKjw==", + "dependencies": { + "debounce": "^1.1.0", + "range": "0.0.3" + }, + "engines": { + "node": ">4" + } + }, "node_modules/react-country-flag": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/react-country-flag/-/react-country-flag-3.1.0.tgz", @@ -16617,6 +16730,22 @@ "@babel/core": "^7.0.0" } }, + "node_modules/react-slick": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/react-slick/-/react-slick-0.29.0.tgz", + "integrity": "sha512-TGdOKE+ZkJHHeC4aaoH85m8RnFyWqdqRfAGkhd6dirmATXMZWAxOpTLmw2Ll/jPTQ3eEG7ercFr/sbzdeYCJXA==", + "dependencies": { + "classnames": "^2.2.5", + "enquire.js": "^2.1.6", + "json2mq": "^0.2.0", + "lodash.debounce": "^4.0.8", + "resize-observer-polyfill": "^1.5.0" + }, + "peerDependencies": { + "react": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-switch": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/react-switch/-/react-switch-7.0.0.tgz", @@ -16850,6 +16979,11 @@ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, + "node_modules/resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -17544,6 +17678,14 @@ "node": ">=8" } }, + "node_modules/slick-carousel": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz", + "integrity": "sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA==", + "peerDependencies": { + "jquery": ">=1.8.0" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -17984,6 +18126,11 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-convert": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", + "integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==" + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", diff --git a/cryptide_project/package.json b/cryptide_project/package.json index 3e51147..b746181 100644 --- a/cryptide_project/package.json +++ b/cryptide_project/package.json @@ -21,8 +21,11 @@ "jspdf": "^2.5.1", "jszip": "^3.10.1", "lodash": "^4.17.21", + "nuka-carousel": "^7.0.0", + "pure-react-carousel": "^1.30.1", "react": "^18.2.0", "react-bootstrap": "^2.9.1", + "react-carousel": "^4.3.0", "react-country-flag": "^3.1.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0", @@ -30,7 +33,9 @@ "react-router-dom": "^6.18.0", "react-router-hash-link": "^2.4.3", "react-scripts": "5.0.1", + "react-slick": "^0.29.0", "react-switch": "^7.0.0", + "slick-carousel": "^1.8.1", "socket.io": "^4.7.2", "socket.io-client": "^4.7.2", "sqlite3": "^5.1.6", @@ -65,6 +70,7 @@ "devDependencies": { "@types/file-saver": "^2.0.7", "@types/react-router-hash-link": "^2.4.9", + "@types/react-slick": "^0.23.12", "@types/uuid": "^9.0.7", "babel-jest": "^29.7.0", "depcheck": "^1.4.7" diff --git a/cryptide_project/server/api/controllers/SessionController.js b/cryptide_project/server/api/controllers/SessionController.js index dc23ea0..1fc1fc4 100644 --- a/cryptide_project/server/api/controllers/SessionController.js +++ b/cryptide_project/server/api/controllers/SessionController.js @@ -88,8 +88,6 @@ class SessionController { nbWins: nbWinsOL, ratio: ratioOL}; - - console.log("[" + hour + ":" + minutes + "] " + req.session.user.pseudo + " have a session."); res.status(200).json({ user: req.session.user }); } catch(error){ diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx index 5b0753f..7f8f95c 100644 --- a/cryptide_project/src/Components/NavBar.tsx +++ b/cryptide_project/src/Components/NavBar.tsx @@ -28,17 +28,19 @@ import { useNavigate } from 'react-router-dom'; // @ts-ignore function AppNavbar({changeLocale}) { const theme = useTheme(); - const {user, isLoggedIn, logout} = useAuth(); - const navigate = useNavigate(); + const {user, isLoggedIn, logout} = useAuth(); + function navigateToHome(){ + navigate("/") + } function navigateToProfile(){ navigate("/profile") } - function navigateToHome(){ - navigate("/") + function navigateToLogin(){ + navigate("/login") } return ( @@ -62,40 +64,27 @@ function AppNavbar({changeLocale}) {
diff --git a/cryptide_project/src/Components/ScoreBoard.css b/cryptide_project/src/Components/ScoreBoard.css new file mode 100644 index 0000000..2272e63 --- /dev/null +++ b/cryptide_project/src/Components/ScoreBoard.css @@ -0,0 +1,15 @@ +/* Ajoutez ces styles dans votre fichier CSS ou utilisez un préprocesseur comme SCSS */ +.tabsStats { + padding: 20px; + } + + .stats { + background-color: #f0f0f0; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + text-align: center; + } + + /* Personnalisez davantage selon vos préférences */ + \ No newline at end of file diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 7d3e617..418b40f 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -1,13 +1,13 @@ -import React, {useEffect, useState} from 'react'; +import React, {useState, useEffect} from 'react'; +import Carousel from 'nuka-carousel'; /* Style */ import '../Pages/Play.css'; import '../Style/Global.css' +import './ScoreBoard.css'; import { useTheme } from '../Style/ThemeContext'; /* Ressources */ -import Person from '../res/img/Person.png' -import leave from '../res/img/bot.png' import trophy from '../res/icon/trophy.png' import share from '../res/icon/share.png'; @@ -19,16 +19,21 @@ import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; /* Component */ -import ButtonImgNav from './ButtonImgNav'; import User from '../model/User'; /* Services */ import ScoreboardService from '../services/ScoreboardService'; +import { BiLineChart, BiLineChartDown } from 'react-icons/bi'; +import { CarouselCaption } from 'react-bootstrap'; +import { BsLine } from 'react-icons/bs'; //@ts-ignore const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { const theme=useTheme(); + const [carouselKey, setCarouselKey] = useState(0); + const [activeTab, setActiveTab] = useState("perso"); + // DAILY STATS const [dailyMastermindStats, setDailyMastermindStats] = useState(null); const [dailyEasyEnigmaStats, setDailyEasyEnigmaStats] = useState(null); @@ -82,228 +87,274 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { }, []); return ( - //
-
- - - - Stats en MasterMind : - - Partie Jouées : - {Player !== null ? Player.mastermindStats.nbGames : "0"} - - - Best-Score : - {Player !== null ? Player.mastermindStats.bestScore : "0"} - - - Moyenne d'essai : - {Player !== null ? Player.mastermindStats.avgNbTry : "0"} - -
- Stats en Enigme facile : - - Partie jouée : - {Player !== null ? Player.easyEnigmaStats.nbGames : "0"} - - - Nombre de victoire : - {Player !== null ? Player.easyEnigmaStats.nbWins : "0"} - - - Ratio V/D : - {Player !== null ? Player.easyEnigmaStats.ratio.toFixed(2) + "%" : "00.0%"} - - - Meilleur temps : - {Player !== null ? Player.easyEnigmaStats.bestTime : "0"} - - - Moyenne de temps : - {Player !== null ? Player.easyEnigmaStats.avgTime.toFixed(2) : "0"} - -
- Stats en Enigme moyenne : - - Partie jouée : - {Player !== null ? Player.mediumEnigmaStats.nbGames : "0"} - - - Best-Score : - {Player !== null ? Player.mediumEnigmaStats.bestScore : "0"} - - - Moyenne d'essai : - {Player !== null ? Player.mediumEnigmaStats.avgNbTry.toFixed(2) : "0"} - -
- Stats en Enigme difficile : - - Partie jouée : - {Player !== null ? Player.hardEnigmaStats.nbGames : "0"} - - - Nombre de victoire : - {Player !== null ? Player.hardEnigmaStats.nbWins : "0"} - - - Ratio V/D : - {Player !== null ? Player.hardEnigmaStats.ratio.toFixed(2) + "%" : "00.0%"} - - - Meilleur temps : - {Player !== null ? Player.hardEnigmaStats.bestTime : "0"} - - - Moyenne de temps : - {Player !== null ? Player.hardEnigmaStats.avgTime.toFixed(2) : "0"} - -
- Stats en ligne : - - Partie jouée : - {Player !== null ? Player.onlineStats.nbGames : "0"} - - - Nombre de victoire : - {Player !== null ? Player.onlineStats.nbWins : "0"} - - - Ratio V/D : - {Player !== null ? Player.onlineStats.ratio.toFixed(2) + "%" : "0"} - -
-
- - Person2 - - MasterMind : - {dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.score} - - )) : ( - - No data - - )) : ( - - No data - - )} - -
- - Multijoueur : - {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.wins} - - )) : ( - - No data - - )) : ( - - No data - - )} - -
- - Enigme facile : - {dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.time} - - )) : ( - - No data - - )) : ( - - No data - - )} - -
- -
-
- - Person2 - - MasterMind : - {weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.score} - - )) : ( - - No data - - )) : ( - - No data - - )} -
- Multijoueur : - {weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.wins} - - )) : ( - - No data - - )) : ( - - No data - - )} - -
- - Enigme facile : - {weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => ( - - {index+1}.{stats.pseudo} - {stats.time} - - )) : ( - - No data - - )) : ( - - No data - - )} - -
-
-
-
- - -
- //
+ { + setActiveTab(key); + // Forcer une mise à jour du carousel + setCarouselKey((prevKey) => prevKey + 1); + }} + id="ScoreBoard" + className="tabsStats justify-content-around" + > + + + +
+
Mastermind
+
+

Parties Jouées: {Player.mastermindStats.nbGames}

+

Best-Score: {Player.mastermindStats.bestScore}

+

Moyenne d'essai: {Player.mastermindStats.avgNbTry}

+
+
+
Enigme facile
+
+

Parties Jouées: {Player.easyEnigmaStats.nbGames}

+

Nombre de victoires: {Player.easyEnigmaStats.nbWins}

+

Ratio V/D: {Player.easyEnigmaStats.ratio}

+

Meilleur temps: {Player.easyEnigmaStats.bestTime}

+

Moyenne de temps: {Player.easyEnigmaStats.avgTime}

+
+
+
Enigme moyenne
+
+

Parties Jouées: {Player.mediumEnigmaStats.nbGames}

+

Best-Score: {Player.mediumEnigmaStats.bestScore}

+

Moyenne d'essai: {Player.mediumEnigmaStats.avgNbTry}

+
+
+
Enigme difficile
+
+

Parties Jouées: {Player.hardEnigmaStats.nbGames}

+

Nombre de victoires: {Player.hardEnigmaStats.nbWins}

+

Ratio V/D: {Player.hardEnigmaStats.ratio}

+

Meilleur temps: {Player.hardEnigmaStats.bestTime}

+

Moyenne de temps: {Player.hardEnigmaStats.avgTime}

+
+
+
En ligne
+
+

Parties Jouées: {Player.onlineStats.nbGames}

+

Nombre de victoires: {Player.onlineStats.nbWins}

+

Ratio V/D: {Player.onlineStats.ratio}

+
+
+
+
+ + + +
+
Mastermind
+
+ {dailyMastermindStats !== null ? (dailyMastermindStats.tab.length !== 0 ? dailyMastermindStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.score}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme facile
+
+ {dailyEasyEnigmaStats !== null ? (dailyEasyEnigmaStats.tab.length !== 0 ? dailyEasyEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme moyenne
+
+ {dailyMediumEnigmaStats !== null ? (dailyMediumEnigmaStats.tab.length !== 0 ? dailyMediumEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme difficile
+
+ {dailyHardEnigmaStats !== null ? (dailyHardEnigmaStats.tab.length !== 0 ? dailyHardEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
En ligne
+
+ {dailyOnlineStats !== null ? (dailyOnlineStats.tab.length !== 0 ? dailyOnlineStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.wins}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
+
+ + + +
+
Mastermind
+
+ {weeklyMastermindStats !== null ? (weeklyMastermindStats.tab.length !== 0 ? weeklyMastermindStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.score}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme facile
+
+ {weeklyEasyEnigmaStats !== null ? (weeklyEasyEnigmaStats.tab.length !== 0 ? weeklyEasyEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme moyenne
+
+ {weeklyMediumEnigmaStats !== null ? (weeklyMediumEnigmaStats.tab.length !== 0 ? weeklyMediumEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
Enigme difficile
+
+ {weeklyHardEnigmaStats !== null ? (weeklyHardEnigmaStats.tab.length !== 0 ? weeklyHardEnigmaStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.time}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
En ligne
+
+ {weeklyOnlineStats !== null ? (weeklyOnlineStats.tab.length !== 0 ? weeklyOnlineStats.tab.map((stats: any, index: number) => ( + <> + + +

{index+1}.{stats.pseudo}

+ + +

{stats.wins}

+ +
+ + )) : ( +

Nothing for the moment

+ )) : ( +

Nothing for the moment

+ )} +
+
+
+
+
); } diff --git a/cryptide_project/src/Pages/LoginForm.tsx b/cryptide_project/src/Pages/LoginForm.tsx index 0f650a3..adcd097 100644 --- a/cryptide_project/src/Pages/LoginForm.tsx +++ b/cryptide_project/src/Pages/LoginForm.tsx @@ -4,14 +4,14 @@ import { useNavigate } from 'react-router-dom'; import { useAuth } from '../Contexts/AuthContext'; import AuthService from '../services/AuthService'; import '../Style/Global.css'; +import { Link } from 'react-router-dom'; const SignIn = () => { const navigate = useNavigate(); - const { login } = useAuth(); - const [error, setError] = useState(null); + const {login} = useAuth(); const [showConfirmation, setShowConfirmation] = useState(false); - + const handleSubmit = async (event: React.FormEvent) => { event.preventDefault(); @@ -78,7 +78,7 @@ const SignIn = () => {

- Mot de passe oublié ? + Pas encore inscrit ?

diff --git a/cryptide_project/src/Pages/NewPlay.tsx b/cryptide_project/src/Pages/NewPlay.tsx index 6af04e3..98f0743 100644 --- a/cryptide_project/src/Pages/NewPlay.tsx +++ b/cryptide_project/src/Pages/NewPlay.tsx @@ -189,20 +189,15 @@ function NewPlay() { // const returnVisibility: Visibility = goBackRoom !== -1 ? "visible" : "hidden"; - const returnVisibility: any= goBackRoom !== -1 ? "visible" : "hidden" ; - + const returnVisibility = goBackRoom !== -1 ? "block" : "none" ; return (
-
- - {/* Menu de boutons */} - +
+ {/* Boutons pour jouer */}
- - {({ placement, arrowProps, show: _show, popper, ...props }) => ( @@ -224,31 +219,18 @@ function NewPlay() { - - {/* {goBackRoom != -1 && } */} - - +
{/* Lobbies */}
- -
-
-
-

- {user && user.pseudo} -

- Person -
- {user && ()}
+ +
+ {user && } +
); } diff --git a/cryptide_project/src/Pages/Play.css b/cryptide_project/src/Pages/Play.css index f0a843e..f650357 100644 --- a/cryptide_project/src/Pages/Play.css +++ b/cryptide_project/src/Pages/Play.css @@ -1,17 +1,16 @@ - -.MainContainer{ - flex: 1 1 0; +.MainContainer { display: flex; flex-direction: row; - justify-content:space-around + justify-content: center; + align-items: center; + height: 100%; } -.MidContainer{ +.MidContainer { display: flex; - /* justify-content:center; */ - align-items:center; + justify-content: center; + align-items: center; flex-direction: column; - margin-top: 15px; width: 30%; } @@ -21,20 +20,24 @@ justify-content: center; } -.leftContainer{ - width: 30%; +.leftContainer { + height: 100%; + margin: 20px 30px; + width: 70%; } -.rightContainer{ +.rightContainer { + height: 100%; + margin: 20px 30px; width: 30%; } -.NewleftContainer{ +.NewleftContainer { margin: 20px 30px; width: 70%; } -.NewrightContainer{ +.NewrightContainer { display: flex; flex-direction: column; justify-content: center; @@ -42,81 +45,55 @@ width: 30%; } -/* .textBoard div{ - display: flex; - flex-direction:column-reverse; - justify-content:space-between -} */ - -/* .textBoard div:nth-child(2){ +.buttonGroupVertical { display: flex; - justify-content: end; -} */ - -/**Button**/ -.buttonGroupVertical{ - display: flex; - justify-content:center; - align-items:center; + justify-content: center; + align-items: center; flex-direction: column; } -.NewbuttonGroupVertical{ +.NewbuttonGroupVertical { display: flex; - justify-content:space-around; - align-items:start; + flex-direction: row; + justify-content: space-evenly; } - -.ButtonNav{ +.ButtonNav { margin: 15px 10px; - width:200px; + width: 200px; height: 8vh; - - /* background-color: #85C9C2; - color: #2A4541; */ color: white; - - border: solid; + border: 2px solid #0056b3; border-radius: 15px; - border-width: 2px; - - font-size:larger; + font-size: larger; } - -.ButtonNavRejoin{ +.ButtonNavRejoin { margin: 15px 10px; - width:200px; + width: 200px; height: 8vh; - color: white; background-color: aquamarine; - - border: solid 2px rgb(40, 225, 163); + border: 2px solid #0056b3; border-radius: 15px; - - font-size:larger; + font-size: larger; } -.returnDiv{ + +.returnDiv { display: flex; flex-direction: column; justify-content: center; align-items: center; - - margin:40px 15px; - - border: solid 2px whitesmoke; + margin: 40px 15px; + border: 2px solid whitesmoke; border-radius: 15px; - background-color: white; } .returnDiv p { margin: 15px; padding: 10px; - border: solid 1px whitesmoke; + border: 1px solid whitesmoke; border-radius: 10px; - - font-weight:500; -} \ No newline at end of file + font-weight: 500; +} diff --git a/cryptide_project/src/Pages/Profile.css b/cryptide_project/src/Pages/Profile.css index 3f183ed..2959742 100644 --- a/cryptide_project/src/Pages/Profile.css +++ b/cryptide_project/src/Pages/Profile.css @@ -1,6 +1,5 @@ .mainContainer{ display: flex; - /* flex-direction: column; */ justify-content: center; align-items: center; margin: 50px; diff --git a/cryptide_project/src/Pages/Profile.tsx b/cryptide_project/src/Pages/Profile.tsx index 5b0a634..f01640c 100644 --- a/cryptide_project/src/Pages/Profile.tsx +++ b/cryptide_project/src/Pages/Profile.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import ProfilePDP from '../Components/ProfilePDP'; import SessionService from '../services/SessionService'; @@ -27,15 +27,30 @@ import ProgressBar from 'react-bootstrap/ProgressBar'; //@ts-ignore const Profile = () => { - const navigate = useNavigate(); - //let player; - const {user, logout} = useAuth() - const [editingUsername, setEditingUsername] = useState(false); + const {isLoggedIn, login, logout, user, setUserData, manager } = useAuth(); const [newUsername, setNewUsername] = useState(user?.pseudo); - //@ts-ignore + useEffect(() => { + if (user == null){ + manager.userService.fetchUserInformation().then(([user, loggedIn]) =>{ + if (user!=null){ + if (loggedIn){ + login() + setUserData(user) + } + } + }) + } + }, [isLoggedIn]); + + const handleLogout = () => { + logout(); + navigate('/'); + }; + + // @ts-ignore const onUsernameChange = (newUsername) => { if(user?.pseudo != null){ SessionService.UpdatePseudo(user.pseudo, newUsername) @@ -349,7 +364,10 @@ const Profile = () => {
- +
+ {/* Bouton de déconnexion */} +
+
diff --git a/cryptide_project/src/Pages/SignUpForm.tsx b/cryptide_project/src/Pages/SignUpForm.tsx index e7b6025..862197b 100644 --- a/cryptide_project/src/Pages/SignUpForm.tsx +++ b/cryptide_project/src/Pages/SignUpForm.tsx @@ -6,7 +6,6 @@ import '../Style/Global.css'; const SignUp = () => { const navigate = useNavigate(); - const [error, setError] = useState(null); const [showConfirmation, setShowConfirmation] = useState(false); diff --git a/cryptide_project/yarn.lock b/cryptide_project/yarn.lock index e14f7e0..2e5620d 100644 --- a/cryptide_project/yarn.lock +++ b/cryptide_project/yarn.lock @@ -2470,6 +2470,13 @@ "@types/history" "^4.7.11" "@types/react" "*" +"@types/react-slick@^0.23.12": + version "0.23.12" + resolved "https://registry.npmjs.org/@types/react-slick/-/react-slick-0.23.12.tgz" + integrity sha512-WjY/wIjzgXCh6gXRZL75OC9n/Hn4MwKWI7ZJ4iA2OxavN9eKvkV5MPFjSgH5sofabq78Ucrl6u3okiBUNNIrDQ== + dependencies: + "@types/react" "*" + "@types/react-transition-group@^4.4.6": version "4.4.8" resolved "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.8.tgz" @@ -3858,7 +3865,7 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz" integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== -classnames@^2.3.2: +classnames@^2.2.5, classnames@^2.3.2: version "2.3.2" resolved "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz" integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== @@ -4376,6 +4383,11 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" +debounce@^1.1.0: + version "1.2.1" + resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz" + integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== + debug@^2.6.0: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" @@ -4438,11 +4450,21 @@ deep-equal@^2.0.5: which-collection "^1.0.1" which-typed-array "^1.1.9" +deep-freeze@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz" + integrity sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg== + deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +deepmerge@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz" + integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA== + deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz" @@ -4821,6 +4843,11 @@ enhanced-resolve@^5.15.0: graceful-fs "^4.2.4" tapable "^2.2.0" +enquire.js@^2.1.6: + version "2.1.6" + resolved "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz" + integrity sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw== + entities@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" @@ -4831,6 +4858,13 @@ env-paths@^2.2.0: resolved "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== +equals@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/equals/-/equals-1.0.5.tgz" + integrity sha512-wI15a6ZoaaXPv+55+Vh2Kqn3+efKRv8QPtcGTjW5xmanMnQzESdAt566jevtMZyt3W/jwLDTzXpMph5ECDJ2zg== + dependencies: + jkroso-type "1" + err-code@^2.0.2: version "2.0.3" resolved "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz" @@ -7198,6 +7232,16 @@ jiti@^1.19.1: resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz" integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== +jkroso-type@1: + version "1.1.1" + resolved "https://registry.npmjs.org/jkroso-type/-/jkroso-type-1.1.1.tgz" + integrity sha512-zZgay+fPG6PgMUrpyFADmQmvLo39+AZa7Gc5pZhev2RhDxwANEq2etwD8d0e6rTg5NkwOIlQmaEmns3draC6Ng== + +jquery@>=1.8.0: + version "3.7.1" + resolved "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz" + integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -7291,6 +7335,13 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json2mq@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz" + integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== + dependencies: + string-convert "^0.2.0" + json5@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz" @@ -8011,6 +8062,11 @@ nth-check@^2.0.1: dependencies: boolbase "^1.0.0" +nuka-carousel@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/nuka-carousel/-/nuka-carousel-7.0.0.tgz" + integrity sha512-KE0WV1MuE4Gq6ynL8P3qJH2rGq/DkJ0ej+ezo0IuZp4oklV8WNqu6P6O1utJqihHLGoEuFppq5wlHSHfhdCHXA== + nwsapi@^2.2.0: version "2.2.7" resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz" @@ -9055,6 +9111,17 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== +pure-react-carousel@^1.30.1: + version "1.30.1" + resolved "https://registry.npmjs.org/pure-react-carousel/-/pure-react-carousel-1.30.1.tgz" + integrity sha512-B1qi62hZk0OFqRR4cTjtgIeOn/Ls5wo+HsLtrXT4jVf5et8ldBHSt+6LsYRJN86Or8dm+XbnJNEHy6WDJ0/DQw== + dependencies: + "@babel/runtime" "^7.5.5" + deep-freeze "0.0.1" + deepmerge "^2.2.1" + equals "^1.0.5" + prop-types "^15.6.2" + q@^1.1.2: version "1.5.1" resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz" @@ -9101,6 +9168,11 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== +range@0.0.3: + version "0.0.3" + resolved "https://registry.npmjs.org/range/-/range-0.0.3.tgz" + integrity sha512-OxK2nY2bmeEB4NxoBraQIBOOeOIxoBvm6yt8MA1kLappgkG3SyLf173iOtT5woWycrtESDD2g0Nl2yt8YPoUnw== + raw-body@2.5.1: version "2.5.1" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz" @@ -9151,6 +9223,14 @@ react-bootstrap@^2.9.1: uncontrollable "^7.2.1" warning "^4.0.3" +react-carousel@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/react-carousel/-/react-carousel-4.3.0.tgz" + integrity sha512-t8MfCK877KuOaQFAsO6NwzkWdhcJG8hxSN5zYR7/cSfTNI6DnM/HswvgvdfajtiETuoLZRMXXLZv6QRLGETKjw== + dependencies: + debounce "^1.1.0" + range "0.0.3" + react-country-flag@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/react-country-flag/-/react-country-flag-3.1.0.tgz" @@ -9186,7 +9266,7 @@ react-dev-utils@^12.0.1: strip-ansi "^6.0.1" text-table "^0.2.0" -"react-dom@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.14.0, react-dom@>=16.6.0, react-dom@>=16.8: +"react-dom@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.14.0, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=18.0.0, "react-dom@15.x || 16.x || 17.x || 18.x": version "18.2.0" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -9332,6 +9412,17 @@ react-scripts@5.0.1: optionalDependencies: fsevents "^2.3.2" +react-slick@^0.29.0: + version "0.29.0" + resolved "https://registry.npmjs.org/react-slick/-/react-slick-0.29.0.tgz" + integrity sha512-TGdOKE+ZkJHHeC4aaoH85m8RnFyWqdqRfAGkhd6dirmATXMZWAxOpTLmw2Ll/jPTQ3eEG7ercFr/sbzdeYCJXA== + dependencies: + classnames "^2.2.5" + enquire.js "^2.1.6" + json2mq "^0.2.0" + lodash.debounce "^4.0.8" + resize-observer-polyfill "^1.5.0" + react-switch@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/react-switch/-/react-switch-7.0.0.tgz" @@ -9349,7 +9440,7 @@ react-transition-group@^4.4.5: loose-envify "^1.4.0" prop-types "^15.6.2" -react@*, "react@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || 17 || 18", "react@^16.8.0 || ^17.0.0-rc.1 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", react@>=0.14.0, react@>=15, react@>=15.0.0, react@>=16, react@>=16.14.0, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0: +react@*, "react@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || 17 || 18", "react@^16.8.0 || ^17.0.0-rc.1 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", react@>=0.14.0, react@>=15, react@>=15.0.0, react@>=16, react@>=16.14.0, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=18.0.0, "react@15.x || 16.x || 17.x || 18.x": version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -9535,6 +9626,11 @@ requires-port@^1.0.0: resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== +resize-observer-polyfill@^1.5.0: + version "1.5.1" + resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" @@ -9934,6 +10030,11 @@ slash@^4.0.0: resolved "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== +slick-carousel@^1.8.1: + version "1.8.1" + resolved "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz" + integrity sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA== + smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" @@ -10173,6 +10274,11 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +string-convert@^0.2.0: + version "0.2.1" + resolved "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz" + integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" From c376013dfea0168ab3c5137c3edc16ab1b447ae9 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Thu, 7 Dec 2023 16:57:59 +0100 Subject: [PATCH 07/11] =?UTF-8?q?Suppression=20des=20d=C3=A9pendances=20in?= =?UTF-8?q?utiles=20des=20anciens=20test=20carousel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cryptide_project/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cryptide_project/package.json b/cryptide_project/package.json index b746181..4bf2b23 100644 --- a/cryptide_project/package.json +++ b/cryptide_project/package.json @@ -22,10 +22,8 @@ "jszip": "^3.10.1", "lodash": "^4.17.21", "nuka-carousel": "^7.0.0", - "pure-react-carousel": "^1.30.1", "react": "^18.2.0", "react-bootstrap": "^2.9.1", - "react-carousel": "^4.3.0", "react-country-flag": "^3.1.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0", @@ -33,9 +31,7 @@ "react-router-dom": "^6.18.0", "react-router-hash-link": "^2.4.3", "react-scripts": "5.0.1", - "react-slick": "^0.29.0", "react-switch": "^7.0.0", - "slick-carousel": "^1.8.1", "socket.io": "^4.7.2", "socket.io-client": "^4.7.2", "sqlite3": "^5.1.6", @@ -70,7 +66,6 @@ "devDependencies": { "@types/file-saver": "^2.0.7", "@types/react-router-hash-link": "^2.4.9", - "@types/react-slick": "^0.23.12", "@types/uuid": "^9.0.7", "babel-jest": "^29.7.0", "depcheck": "^1.4.7" From 8f7d61b4a5cf32ac796c5aa235edeb09c62d7c16 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Thu, 7 Dec 2023 18:22:00 +0100 Subject: [PATCH 08/11] =?UTF-8?q?Am=C3=A9lioration=20affichages=20stats=20?= =?UTF-8?q?+=20modif=20navbar=20(finito=20le=20dropdown=20menu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Components/ScoreBoard.tsx | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 418b40f..4a911a9 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -95,8 +95,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { setCarouselKey((prevKey) => prevKey + 1); }} id="ScoreBoard" - className="tabsStats justify-content-around" - > + className="tabsStats justify-content-around"> @@ -105,39 +104,39 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

Parties Jouées: {Player.mastermindStats.nbGames}

Best-Score: {Player.mastermindStats.bestScore}

-

Moyenne d'essai: {Player.mastermindStats.avgNbTry}

+

Moyenne d'essai: {Player.mastermindStats.avgNbTry.toFixed(2)}

Enigme facile

Parties Jouées: {Player.easyEnigmaStats.nbGames}

Nombre de victoires: {Player.easyEnigmaStats.nbWins}

-

Ratio V/D: {Player.easyEnigmaStats.ratio}

-

Meilleur temps: {Player.easyEnigmaStats.bestTime}

-

Moyenne de temps: {Player.easyEnigmaStats.avgTime}

+

Ratio V/D: {Player.easyEnigmaStats.ratio.toFixed(2) + "%"}

+

Meilleur temps: {Player.easyEnigmaStats.bestTime + "s"}

+

Moyenne de temps: {Player.easyEnigmaStats.avgTime.toFixed(2) + "s"}

Enigme moyenne

Parties Jouées: {Player.mediumEnigmaStats.nbGames}

Best-Score: {Player.mediumEnigmaStats.bestScore}

-

Moyenne d'essai: {Player.mediumEnigmaStats.avgNbTry}

+

Moyenne d'essai: {Player.mediumEnigmaStats.avgNbTry.toFixed(2)}

Enigme difficile

Parties Jouées: {Player.hardEnigmaStats.nbGames}

Nombre de victoires: {Player.hardEnigmaStats.nbWins}

-

Ratio V/D: {Player.hardEnigmaStats.ratio}

-

Meilleur temps: {Player.hardEnigmaStats.bestTime}

-

Moyenne de temps: {Player.hardEnigmaStats.avgTime}

+

Ratio V/D: {Player.hardEnigmaStats.ratio.toFixed(2) + "%"}

+

Meilleur temps: {Player.hardEnigmaStats.bestTime + "s"}

+

Moyenne de temps: {Player.hardEnigmaStats.avgTime.toFixed(2) + "s"}

En ligne

Parties Jouées: {Player.onlineStats.nbGames}

Nombre de victoires: {Player.onlineStats.nbWins}

-

Ratio V/D: {Player.onlineStats.ratio}

+

Ratio V/D: {Player.onlineStats.ratio.toFixed(2) + "s"}

@@ -155,7 +154,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.score}

+

{stats.score + " essai(s)"}

@@ -175,7 +174,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -195,7 +194,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -215,7 +214,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -235,7 +234,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.wins}

+

{stats.wins + " victoires"}

@@ -261,7 +260,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.score}

+

{stats.score + " essai(s)"}

@@ -281,7 +280,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -301,7 +300,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -321,7 +320,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.time}

+

{stats.time + "s"}

@@ -341,7 +340,7 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => {

{index+1}.{stats.pseudo}

-

{stats.wins}

+

{stats.wins + " victoires"}

From 9a8c49d18ab405cbbab384461f0d98ced9d1e35c Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Fri, 8 Dec 2023 08:41:25 +0100 Subject: [PATCH 09/11] Ajout de toutes les composantes pour avoir l'ensemble des stats daily et weekly --- .../api/controllers/ScoreboardController.js | 76 +++++++++++++++ .../server/api/routes/AuthRoutes.js | 4 + .../src/Components/ScoreBoard.tsx | 20 ++-- .../src/services/ScoreboardService.tsx | 92 +++++++++++++++++++ 4 files changed, 184 insertions(+), 8 deletions(-) diff --git a/cryptide_project/server/api/controllers/ScoreboardController.js b/cryptide_project/server/api/controllers/ScoreboardController.js index 4854986..9d58d27 100644 --- a/cryptide_project/server/api/controllers/ScoreboardController.js +++ b/cryptide_project/server/api/controllers/ScoreboardController.js @@ -48,6 +48,44 @@ class SessionController { } } + static async getDailyMediumEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const dailyMediumEnigmaStats = await db.getDailyEnigmaStats(ENIGME_MOYEN); + + res.status(200).json({ tab : dailyMediumEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyMediumEnigma.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getDailyHardEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const dailyHardEnigmaStats = await db.getDailyEnigmaStats(ENIGME_DIFFICILE); + + res.status(200).json({ tab : dailyHardEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats dailyHardEnigma.' }); + } + finally{ + await db.disconnect(); + } + } + static async getDailyOnline(req, res){ const db = new DatabaseService(); @@ -109,6 +147,44 @@ class SessionController { } } + static async getWeeklyMediumEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const weeklyMediumEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_MOYEN); + + res.status(200).json({ tab : weeklyMediumEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyMediumEnigma.' }); + } + finally{ + await db.disconnect(); + } + } + + static async getWeeklyHardEnigma(req, res){ + const db = new DatabaseService(); + + try{ + await db.connect(); + + const weeklyHardEnigmaStats = await db.getWeeklyEnigmaStats(ENIGME_DIFFICILE); + + res.status(200).json({ tab : weeklyHardEnigmaStats }); + } + catch(error){ + console.error(error); + res.status(500).json({ error: 'Erreur lors de la récupération des stats weeklyHardEnigma.' }); + } + finally{ + await db.disconnect(); + } + } + static async getWeeklyOnline(req, res){ const db = new DatabaseService(); diff --git a/cryptide_project/server/api/routes/AuthRoutes.js b/cryptide_project/server/api/routes/AuthRoutes.js index 5d0ad78..95b3c80 100644 --- a/cryptide_project/server/api/routes/AuthRoutes.js +++ b/cryptide_project/server/api/routes/AuthRoutes.js @@ -24,11 +24,15 @@ router.put('/session/updatePseudo', SessionController.UpdatePseudo); // Routes pour le daily scoreboard router.get('/scoreboard/getDailyMastermind', ScoreboardController.getDailyMastermind); router.get('/scoreboard/getDailyEasyEnigma', ScoreboardController.getDailyEasyEnigma); +router.get('/scoreboard/getDailyMediumEnigma', ScoreboardController.getDailyMediumEnigma); +router.get('/scoreboard/getDailyHardEnigma', ScoreboardController.getDailyHardEnigma); router.get('/scoreboard/getDailyOnline', ScoreboardController.getDailyOnline); // Routes pour le weekly scoreboard router.get('/scoreboard/getWeeklyMastermind', ScoreboardController.getWeeklyMastermind); router.get('/scoreboard/getWeeklyEasyEnigma', ScoreboardController.getWeeklyEasyEnigma); +router.get('/scoreboard/getWeeklyMediumEnigma', ScoreboardController.getWeeklyMediumEnigma); +router.get('/scoreboard/getWeeklyHardEnigma', ScoreboardController.getWeeklyHardEnigma); router.get('/scoreboard/getWeeklyOnline', ScoreboardController.getWeeklyOnline); diff --git a/cryptide_project/src/Components/ScoreBoard.tsx b/cryptide_project/src/Components/ScoreBoard.tsx index 4a911a9..2ceb2a0 100644 --- a/cryptide_project/src/Components/ScoreBoard.tsx +++ b/cryptide_project/src/Components/ScoreBoard.tsx @@ -53,14 +53,16 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { async function fetchDailyStats() { try { const resultMM = await ScoreboardService.getDailyMastermindStats(); - const resultOL = await ScoreboardService.getDailyOnlineStats(); const resultEF = await ScoreboardService.getDailyEasyEnigmaStats(); + const resultEM = await ScoreboardService.getDailyMediumEnigmaStats(); + const resultED = await ScoreboardService.getDailyHardEnigmaStats(); + const resultOL = await ScoreboardService.getDailyOnlineStats(); - console.log(resultEF); - setDailyMastermindStats(resultMM); - setDailyOnlineStats(resultOL); setDailyEasyEnigmaStats(resultEF); + setDailyMediumEnigmaStats(resultEM); + setDailyHardEnigmaStats(resultED); + setDailyOnlineStats(resultOL); } catch (error) { console.error(error); } @@ -69,14 +71,16 @@ const ScoreBoard: React.FC<{ Player: User }> = ({ Player }) => { async function fetchWeeklyStats() { try{ const resultMM = await ScoreboardService.getWeeklyMastermindStats(); - const resultOL = await ScoreboardService.getWeeklyOnlineStats(); const resultEF = await ScoreboardService.getWeeklyEasyEnigmaStats(); - - console.log(resultEF); + const resultEM = await ScoreboardService.getWeeklyMediumEnigmaStats(); + const resultED = await ScoreboardService.getWeeklyHardEnigmaStats(); + const resultOL = await ScoreboardService.getWeeklyOnlineStats(); setWeeklyMastermindStats(resultMM); - setWeeklyOnlineStats(resultOL); setWeeklyEasyEnigmaStats(resultEF); + setWeeklyMediumEnigmaStats(resultEM); + setWeeklyHardEnigmaStats(resultED); + setWeeklyOnlineStats(resultOL); } catch (error) { console.error(error); } diff --git a/cryptide_project/src/services/ScoreboardService.tsx b/cryptide_project/src/services/ScoreboardService.tsx index 3251182..c7e699e 100644 --- a/cryptide_project/src/services/ScoreboardService.tsx +++ b/cryptide_project/src/services/ScoreboardService.tsx @@ -52,6 +52,52 @@ class ScoreboardService { } } + static async getDailyMediumEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyMediumEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + + static async getDailyHardEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyHardEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + static async getDailyOnlineStats() { try { const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getDailyOnline', { @@ -125,6 +171,52 @@ class ScoreboardService { } } + static async getWeeklyMediumEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyMediumEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + + static async getWeeklyHardEnigmaStats() { + try { + const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyHardEnigma', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + }); + + if (response.ok) { + const result = await response.json(); + return result; + } else { + const errorResponse = await response.json(); + throw new Error(errorResponse.error); + } + } catch (error) { + console.error(error); + throw error; + } + } + static async getWeeklyOnlineStats() { try { const response = await fetch(ADRESSE_DBSERVER + '/scoreboard/getWeeklyOnline', { From 08b56ebe58c45341c8c0e10f13cb54d0b9e17f83 Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Fri, 8 Dec 2023 16:02:53 +0100 Subject: [PATCH 10/11] "Merge master + correctif session info" --- cryptide_project/package-lock.json | 134 ------------------ cryptide_project/server/api/server.js | 2 +- cryptide_project/src/AdressSetup.ts | 6 +- cryptide_project/src/Components/NavBar.tsx | 7 +- cryptide_project/src/Contexts/AuthContext.tsx | 2 - cryptide_project/src/Pages/InfoPage.tsx | 14 +- cryptide_project/src/Pages/LoginForm.tsx | 2 +- cryptide_project/src/Pages/Profile.tsx | 3 +- cryptide_project/yarn.lock | 107 +------------- 9 files changed, 23 insertions(+), 254 deletions(-) diff --git a/cryptide_project/package-lock.json b/cryptide_project/package-lock.json index 208c662..3e570f0 100644 --- a/cryptide_project/package-lock.json +++ b/cryptide_project/package-lock.json @@ -27,10 +27,8 @@ "jszip": "^3.10.1", "lodash": "^4.17.21", "nuka-carousel": "^7.0.0", - "pure-react-carousel": "^1.30.1", "react": "^18.2.0", "react-bootstrap": "^2.9.1", - "react-carousel": "^4.3.0", "react-country-flag": "^3.1.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0", @@ -38,9 +36,7 @@ "react-router-dom": "^6.18.0", "react-router-hash-link": "^2.4.3", "react-scripts": "5.0.1", - "react-slick": "^0.29.0", "react-switch": "^7.0.0", - "slick-carousel": "^1.8.1", "socket.io": "^4.7.2", "socket.io-client": "^4.7.2", "sqlite3": "^5.1.6", @@ -51,7 +47,6 @@ "devDependencies": { "@types/file-saver": "^2.0.7", "@types/react-router-hash-link": "^2.4.9", - "@types/react-slick": "^0.23.12", "@types/uuid": "^9.0.7", "babel-jest": "^29.7.0", "depcheck": "^1.4.7" @@ -4661,15 +4656,6 @@ "@types/react-router-dom": "^5.3.0" } }, - "node_modules/@types/react-slick": { - "version": "0.23.12", - "resolved": "https://registry.npmjs.org/@types/react-slick/-/react-slick-0.23.12.tgz", - "integrity": "sha512-WjY/wIjzgXCh6gXRZL75OC9n/Hn4MwKWI7ZJ4iA2OxavN9eKvkV5MPFjSgH5sofabq78Ucrl6u3okiBUNNIrDQ==", - "dev": true, - "dependencies": { - "@types/react": "*" - } - }, "node_modules/@types/react-transition-group": { "version": "4.4.8", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.8.tgz", @@ -7536,11 +7522,6 @@ "node": ">=10" } }, - "node_modules/debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -7595,11 +7576,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/deep-freeze": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz", - "integrity": "sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg==" - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -8172,11 +8148,6 @@ "node": ">=10.13.0" } }, - "node_modules/enquire.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz", - "integrity": "sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw==" - }, "node_modules/entities": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", @@ -8194,14 +8165,6 @@ "node": ">=6" } }, - "node_modules/equals": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/equals/-/equals-1.0.5.tgz", - "integrity": "sha512-wI15a6ZoaaXPv+55+Vh2Kqn3+efKRv8QPtcGTjW5xmanMnQzESdAt566jevtMZyt3W/jwLDTzXpMph5ECDJ2zg==", - "dependencies": { - "jkroso-type": "1" - } - }, "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -13009,17 +12972,6 @@ "jiti": "bin/jiti.js" } }, - "node_modules/jkroso-type": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/jkroso-type/-/jkroso-type-1.1.1.tgz", - "integrity": "sha512-zZgay+fPG6PgMUrpyFADmQmvLo39+AZa7Gc5pZhev2RhDxwANEq2etwD8d0e6rTg5NkwOIlQmaEmns3draC6Ng==" - }, - "node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", - "peer": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -13118,14 +13070,6 @@ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" }, - "node_modules/json2mq": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz", - "integrity": "sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA==", - "dependencies": { - "string-convert": "^0.2.0" - } - }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -16204,30 +16148,6 @@ "node": ">=6" } }, - "node_modules/pure-react-carousel": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/pure-react-carousel/-/pure-react-carousel-1.30.1.tgz", - "integrity": "sha512-B1qi62hZk0OFqRR4cTjtgIeOn/Ls5wo+HsLtrXT4jVf5et8ldBHSt+6LsYRJN86Or8dm+XbnJNEHy6WDJ0/DQw==", - "dependencies": { - "@babel/runtime": "^7.5.5", - "deep-freeze": "0.0.1", - "deepmerge": "^2.2.1", - "equals": "^1.0.5", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": "15.x || 16.x || 17.x || 18.x", - "react-dom": "15.x || 16.x || 17.x || 18.x" - } - }, - "node_modules/pure-react-carousel/node_modules/deepmerge": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", - "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -16299,14 +16219,6 @@ "safe-buffer": "^5.1.0" } }, - "node_modules/range": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/range/-/range-0.0.3.tgz", - "integrity": "sha512-OxK2nY2bmeEB4NxoBraQIBOOeOIxoBvm6yt8MA1kLappgkG3SyLf173iOtT5woWycrtESDD2g0Nl2yt8YPoUnw==", - "engines": { - "node": ">=0.8" - } - }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -16409,18 +16321,6 @@ } } }, - "node_modules/react-carousel": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/react-carousel/-/react-carousel-4.3.0.tgz", - "integrity": "sha512-t8MfCK877KuOaQFAsO6NwzkWdhcJG8hxSN5zYR7/cSfTNI6DnM/HswvgvdfajtiETuoLZRMXXLZv6QRLGETKjw==", - "dependencies": { - "debounce": "^1.1.0", - "range": "0.0.3" - }, - "engines": { - "node": ">4" - } - }, "node_modules/react-country-flag": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/react-country-flag/-/react-country-flag-3.1.0.tgz", @@ -16730,22 +16630,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/react-slick": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/react-slick/-/react-slick-0.29.0.tgz", - "integrity": "sha512-TGdOKE+ZkJHHeC4aaoH85m8RnFyWqdqRfAGkhd6dirmATXMZWAxOpTLmw2Ll/jPTQ3eEG7ercFr/sbzdeYCJXA==", - "dependencies": { - "classnames": "^2.2.5", - "enquire.js": "^2.1.6", - "json2mq": "^0.2.0", - "lodash.debounce": "^4.0.8", - "resize-observer-polyfill": "^1.5.0" - }, - "peerDependencies": { - "react": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/react-switch": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/react-switch/-/react-switch-7.0.0.tgz", @@ -16979,11 +16863,6 @@ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, - "node_modules/resize-observer-polyfill": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", - "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" - }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -17678,14 +17557,6 @@ "node": ">=8" } }, - "node_modules/slick-carousel": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz", - "integrity": "sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA==", - "peerDependencies": { - "jquery": ">=1.8.0" - } - }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -18126,11 +17997,6 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/string-convert": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", - "integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==" - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", diff --git a/cryptide_project/server/api/server.js b/cryptide_project/server/api/server.js index e035cff..a216eda 100644 --- a/cryptide_project/server/api/server.js +++ b/cryptide_project/server/api/server.js @@ -14,7 +14,7 @@ const port = 3003; // Middleware app.use(cors( { - origin: ["http://172.20.10.4:3000", "http://172.20.10.4:3000"], + origin: ["http://172.20.10.4:3000", "http://localhost:3000"], credentials: true } )); // Autoriser les requêtes cross-origin diff --git a/cryptide_project/src/AdressSetup.ts b/cryptide_project/src/AdressSetup.ts index cbfa6bc..a5b4f64 100644 --- a/cryptide_project/src/AdressSetup.ts +++ b/cryptide_project/src/AdressSetup.ts @@ -1,6 +1,8 @@ -const ADRESSE_WEBSERVER = "http://172.20.10.4:3002" +// const ADRESSE_WEBSERVER = "http://172.20.10.4:3002" +const ADRESSE_WEBSERVER = "http://localhost:3002" -const ADRESSE_DBSERVER = "http://172.20.10.4:3003" +// const ADRESSE_DBSERVER = "http://172.20.10.4:3003" +const ADRESSE_DBSERVER = "http://localhost:3003" const tmp = ADRESSE_DBSERVER const tmp2 = ADRESSE_WEBSERVER diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx index 7051c08..548f34a 100644 --- a/cryptide_project/src/Components/NavBar.tsx +++ b/cryptide_project/src/Components/NavBar.tsx @@ -12,6 +12,7 @@ import { BsFillPersonPlusFill } from 'react-icons/bs'; /* Images */ import logo from '../res/img/logo2_preview_rev_1.png'; +import defaultImg from '../res/img/Person.png'; /* Components */ import LanguageNavItem from './LangNavItem'; @@ -26,12 +27,14 @@ import { useAuth } from '../Contexts/AuthContext'; import { useNavigate } from 'react-router-dom'; import {basePath} from "../AdressSetup" +import Player from '../model/Player'; +import { set } from 'lodash'; // @ts-ignore function AppNavbar({changeLocale}) { const theme = useTheme(); const navigate = useNavigate(); - const {user, isLoggedIn, logout} = useAuth(); + const {isLoggedIn, login, user, setUserData, manager } = useAuth(); function navigateToProfile(){ navigate(`${basePath}/profile`) @@ -71,7 +74,7 @@ function AppNavbar({changeLocale}) { {/* Boutou qui lors du clique nous redirige vers le profile */} - profile + profile {user && user.pseudo} diff --git a/cryptide_project/src/Contexts/AuthContext.tsx b/cryptide_project/src/Contexts/AuthContext.tsx index e0f6f1a..ac1b880 100644 --- a/cryptide_project/src/Contexts/AuthContext.tsx +++ b/cryptide_project/src/Contexts/AuthContext.tsx @@ -24,8 +24,6 @@ const AuthProvider: React.FC<{ children: ReactNode }> = ({ children }) => { const login = async () => { setIsLoggedIn(true); - const [u, bool] = await manager.userService.fetchUserInformation() - setUser(u) }; const setUserData = (newPlayer: User) => { diff --git a/cryptide_project/src/Pages/InfoPage.tsx b/cryptide_project/src/Pages/InfoPage.tsx index d44b36f..046cef6 100644 --- a/cryptide_project/src/Pages/InfoPage.tsx +++ b/cryptide_project/src/Pages/InfoPage.tsx @@ -34,12 +34,17 @@ function InfoPage({locale, changeLocale}) { useEffect(() => { if (user == null){ + console.log(user) manager.userService.fetchUserInformation().then(([user, loggedIn]) =>{ + console.log(user); if (user!=null){ if (loggedIn){ login() setUserData(user) } + else{ + setUserData(user) + } } }) } @@ -76,10 +81,8 @@ function InfoPage({locale, changeLocale}) {

:

-

- -

-
+

+

  • : 🟪🟦🟩🟨🟥🟫
  • @@ -88,7 +91,6 @@ function InfoPage({locale, changeLocale}) {
  • : 🟣🔵🟢🟡🔴🟤
  • -

@@ -137,6 +139,7 @@ function InfoPage({locale, changeLocale}) {

+


@@ -285,7 +288,6 @@ function InfoPage({locale, changeLocale}) { -
diff --git a/cryptide_project/src/Pages/LoginForm.tsx b/cryptide_project/src/Pages/LoginForm.tsx index 643066f..c484498 100644 --- a/cryptide_project/src/Pages/LoginForm.tsx +++ b/cryptide_project/src/Pages/LoginForm.tsx @@ -80,7 +80,7 @@ const SignIn = () => {

- Pas encore inscrit ? + Pas encore inscrit ?

diff --git a/cryptide_project/src/Pages/Profile.tsx b/cryptide_project/src/Pages/Profile.tsx index 2b70b65..dda92be 100644 --- a/cryptide_project/src/Pages/Profile.tsx +++ b/cryptide_project/src/Pages/Profile.tsx @@ -24,7 +24,6 @@ import Modal from 'react-bootstrap/Modal'; import Form from 'react-bootstrap/Form'; import ProgressBar from 'react-bootstrap/ProgressBar'; - import {basePath} from "../AdressSetup" //@ts-ignore @@ -49,7 +48,7 @@ const Profile = () => { const handleLogout = () => { logout(); - navigate('/'); + navigate(`${basePath}/`); }; // @ts-ignore diff --git a/cryptide_project/yarn.lock b/cryptide_project/yarn.lock index 2e5620d..8bcad7e 100644 --- a/cryptide_project/yarn.lock +++ b/cryptide_project/yarn.lock @@ -2470,13 +2470,6 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react-slick@^0.23.12": - version "0.23.12" - resolved "https://registry.npmjs.org/@types/react-slick/-/react-slick-0.23.12.tgz" - integrity sha512-WjY/wIjzgXCh6gXRZL75OC9n/Hn4MwKWI7ZJ4iA2OxavN9eKvkV5MPFjSgH5sofabq78Ucrl6u3okiBUNNIrDQ== - dependencies: - "@types/react" "*" - "@types/react-transition-group@^4.4.6": version "4.4.8" resolved "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.8.tgz" @@ -3865,7 +3858,7 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz" integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== -classnames@^2.2.5, classnames@^2.3.2: +classnames@^2.3.2: version "2.3.2" resolved "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz" integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== @@ -4383,11 +4376,6 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -debounce@^1.1.0: - version "1.2.1" - resolved "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz" - integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== - debug@^2.6.0: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" @@ -4450,21 +4438,11 @@ deep-equal@^2.0.5: which-collection "^1.0.1" which-typed-array "^1.1.9" -deep-freeze@0.0.1: - version "0.0.1" - resolved "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz" - integrity sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg== - deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^2.2.1: - version "2.2.1" - resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz" - integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA== - deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz" @@ -4843,11 +4821,6 @@ enhanced-resolve@^5.15.0: graceful-fs "^4.2.4" tapable "^2.2.0" -enquire.js@^2.1.6: - version "2.1.6" - resolved "https://registry.npmjs.org/enquire.js/-/enquire.js-2.1.6.tgz" - integrity sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw== - entities@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" @@ -4858,13 +4831,6 @@ env-paths@^2.2.0: resolved "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== -equals@^1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/equals/-/equals-1.0.5.tgz" - integrity sha512-wI15a6ZoaaXPv+55+Vh2Kqn3+efKRv8QPtcGTjW5xmanMnQzESdAt566jevtMZyt3W/jwLDTzXpMph5ECDJ2zg== - dependencies: - jkroso-type "1" - err-code@^2.0.2: version "2.0.3" resolved "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz" @@ -7232,16 +7198,6 @@ jiti@^1.19.1: resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz" integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== -jkroso-type@1: - version "1.1.1" - resolved "https://registry.npmjs.org/jkroso-type/-/jkroso-type-1.1.1.tgz" - integrity sha512-zZgay+fPG6PgMUrpyFADmQmvLo39+AZa7Gc5pZhev2RhDxwANEq2etwD8d0e6rTg5NkwOIlQmaEmns3draC6Ng== - -jquery@>=1.8.0: - version "3.7.1" - resolved "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz" - integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -7335,13 +7291,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json2mq@^0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz" - integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== - dependencies: - string-convert "^0.2.0" - json5@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz" @@ -9111,17 +9060,6 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -pure-react-carousel@^1.30.1: - version "1.30.1" - resolved "https://registry.npmjs.org/pure-react-carousel/-/pure-react-carousel-1.30.1.tgz" - integrity sha512-B1qi62hZk0OFqRR4cTjtgIeOn/Ls5wo+HsLtrXT4jVf5et8ldBHSt+6LsYRJN86Or8dm+XbnJNEHy6WDJ0/DQw== - dependencies: - "@babel/runtime" "^7.5.5" - deep-freeze "0.0.1" - deepmerge "^2.2.1" - equals "^1.0.5" - prop-types "^15.6.2" - q@^1.1.2: version "1.5.1" resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz" @@ -9168,11 +9106,6 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -range@0.0.3: - version "0.0.3" - resolved "https://registry.npmjs.org/range/-/range-0.0.3.tgz" - integrity sha512-OxK2nY2bmeEB4NxoBraQIBOOeOIxoBvm6yt8MA1kLappgkG3SyLf173iOtT5woWycrtESDD2g0Nl2yt8YPoUnw== - raw-body@2.5.1: version "2.5.1" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz" @@ -9223,14 +9156,6 @@ react-bootstrap@^2.9.1: uncontrollable "^7.2.1" warning "^4.0.3" -react-carousel@^4.3.0: - version "4.3.0" - resolved "https://registry.npmjs.org/react-carousel/-/react-carousel-4.3.0.tgz" - integrity sha512-t8MfCK877KuOaQFAsO6NwzkWdhcJG8hxSN5zYR7/cSfTNI6DnM/HswvgvdfajtiETuoLZRMXXLZv6QRLGETKjw== - dependencies: - debounce "^1.1.0" - range "0.0.3" - react-country-flag@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/react-country-flag/-/react-country-flag-3.1.0.tgz" @@ -9266,7 +9191,7 @@ react-dev-utils@^12.0.1: strip-ansi "^6.0.1" text-table "^0.2.0" -"react-dom@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.14.0, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=18.0.0, "react-dom@15.x || 16.x || 17.x || 18.x": +"react-dom@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.14.0, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=18.0.0: version "18.2.0" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -9412,17 +9337,6 @@ react-scripts@5.0.1: optionalDependencies: fsevents "^2.3.2" -react-slick@^0.29.0: - version "0.29.0" - resolved "https://registry.npmjs.org/react-slick/-/react-slick-0.29.0.tgz" - integrity sha512-TGdOKE+ZkJHHeC4aaoH85m8RnFyWqdqRfAGkhd6dirmATXMZWAxOpTLmw2Ll/jPTQ3eEG7ercFr/sbzdeYCJXA== - dependencies: - classnames "^2.2.5" - enquire.js "^2.1.6" - json2mq "^0.2.0" - lodash.debounce "^4.0.8" - resize-observer-polyfill "^1.5.0" - react-switch@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/react-switch/-/react-switch-7.0.0.tgz" @@ -9440,7 +9354,7 @@ react-transition-group@^4.4.5: loose-envify "^1.4.0" prop-types "^15.6.2" -react@*, "react@^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || 17 || 18", "react@^16.8.0 || ^17.0.0-rc.1 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", react@>=0.14.0, react@>=15, react@>=15.0.0, react@>=16, react@>=16.14.0, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=18.0.0, "react@15.x || 16.x || 17.x || 18.x": +react@*, "react@^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || 17 || 18", "react@^16.8.0 || ^17.0.0-rc.1 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", react@>=0.14.0, react@>=15, react@>=15.0.0, react@>=16, react@>=16.14.0, react@>=16.3, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=18.0.0: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -9626,11 +9540,6 @@ requires-port@^1.0.0: resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== -resize-observer-polyfill@^1.5.0: - version "1.5.1" - resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz" - integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" @@ -10030,11 +9939,6 @@ slash@^4.0.0: resolved "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== -slick-carousel@^1.8.1: - version "1.8.1" - resolved "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz" - integrity sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA== - smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" @@ -10274,11 +10178,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -string-convert@^0.2.0: - version "0.2.1" - resolved "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz" - integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== - string-length@^4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" From 09c648a91492053903261ae4c73e5fd3a8365eeb Mon Sep 17 00:00:00 2001 From: Baptiste Marcel Date: Fri, 8 Dec 2023 17:01:48 +0100 Subject: [PATCH 11/11] "merge avec master" --- cryptide_project/DB/socialgraph.db | Bin 28672 -> 28672 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/cryptide_project/DB/socialgraph.db b/cryptide_project/DB/socialgraph.db index a2e895095d402eece0797772bc7b21f84ed399ab..7c467177d0c9b9afa75db2c2423db7c791b51773 100644 GIT binary patch delta 97 zcmZp8z}WDBae_4CoQX2djB_?7Ea7LClBQF8M)e=Y?8D3cjg delta 44 zcmV+{0Mq|~-~oW(0gxL3n~@wt0h_U4qz?la3*M6l5HYh6Af^km-WwM*0T{FPPYNJo C_YVL7