@ -0,0 +1,52 @@
|
||||
import React, { useState } from 'react';
|
||||
import '../Pages/Profile.css'
|
||||
import dl from '../res/icon/download.png'
|
||||
import defaultImg from '../res/img/Person.png'
|
||||
import { useAuth } from '../Contexts/AuthContext';
|
||||
|
||||
//@ts-ignore
|
||||
const ProfilePDP = () => {
|
||||
const [selectedFile, setSelectedFile] = useState(null);
|
||||
|
||||
|
||||
const {user} = useAuth()
|
||||
// @ts-ignores
|
||||
const handleFileChange = (event) => {
|
||||
let file = event.target.files[0];
|
||||
|
||||
setSelectedFile(file);
|
||||
if (file) {
|
||||
const pdpUrl = URL.createObjectURL(file);
|
||||
if (user!=null){
|
||||
user.profilePicture = pdpUrl
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='mainPDPContainer'>
|
||||
{selectedFile ? (
|
||||
<div >
|
||||
{/* @ts-ignore */}
|
||||
{/* <p>Selected File: {selectedFile.name}</p> */}
|
||||
<img src={URL.createObjectURL(selectedFile)} alt="Preview" className='imgContainer' width='100px' height='100px' />
|
||||
</div>
|
||||
) : (
|
||||
<div >
|
||||
<img src={user?.profilePicture} alt="Preview" className='imgContainer' width='100px' height='100px' />
|
||||
</div>
|
||||
)}
|
||||
<div className="parent">
|
||||
<div className="file-upload">
|
||||
<img src={dl} alt="upload" width='25px' height='25px'/>
|
||||
{/* <h6>Cliquer ici pour ajouter une image</h6> */}
|
||||
<p>Taille recommandée : 100px</p>
|
||||
<input type="file" accept="image/*" onChange={handleFileChange}/>
|
||||
</div>
|
||||
</div>
|
||||
{/* <input type="file" accept="image/*" onChange={handleFileChange} /> */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProfilePDP;
|
@ -0,0 +1,65 @@
|
||||
.mainContainer{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 50px;
|
||||
}
|
||||
|
||||
.mainPDPContainer{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 2px solid whitesmoke;
|
||||
border-radius: 15px;
|
||||
|
||||
background-color: white;
|
||||
|
||||
margin: 10px;
|
||||
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.imgContainer{
|
||||
border: 5px solid black;
|
||||
border-radius: 50px;
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*File upload*/
|
||||
.parent {
|
||||
/* width: 250px; */
|
||||
/* margin: auto; */
|
||||
margin: 2rem;
|
||||
background: #ffffff;
|
||||
border-radius: 25px;
|
||||
/* box-shadow: 7px 20px 20px rgb(210, 227, 244); */
|
||||
}
|
||||
.file-upload {
|
||||
text-align: center;
|
||||
border: 3px dashed rgb(210, 227, 244);
|
||||
/* padding: 1.5rem; */
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
max-width: 100px;
|
||||
max-height: 50px;
|
||||
}
|
||||
.file-upload p {
|
||||
font-size: 0.5rem;
|
||||
/* margin-top: 10px; */
|
||||
color: #bbcada;
|
||||
}
|
||||
.file-upload input {
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import ProfilePDP from '../Components/ProfilePDP';
|
||||
|
||||
import './Profile.css'
|
||||
|
||||
|
||||
import SessionService from '../services/SessionService';
|
||||
import { PlayerProps } from '../types/Player';
|
||||
import { update } from 'lodash';
|
||||
import User from '../model/User';
|
||||
import { socket } from '../SocketConfig';
|
||||
import { useAuth } from '../Contexts/AuthContext';
|
||||
|
||||
|
||||
//@ts-ignore
|
||||
const Profile = () => {
|
||||
|
||||
//let player;
|
||||
const {user} = useAuth()
|
||||
|
||||
//! useeffect pour l'instant, il faudra voir pour changer la facons de prendre une session
|
||||
|
||||
return (
|
||||
<div className='mainContainer'>
|
||||
<ProfilePDP/>
|
||||
<h1> {user?.pseudo} </h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Profile;
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,49 @@
|
||||
import SessionService from "../../services/SessionService";
|
||||
import { socket } from "../../SocketConfig";
|
||||
import User from "../User";
|
||||
import IUserService from "./IUserService";
|
||||
|
||||
class DbUserService implements IUserService{
|
||||
async fetchUserInformation(): Promise<[User | null, boolean]> {
|
||||
try {
|
||||
const sessionData = await SessionService.getSession();
|
||||
|
||||
// Vérifie si il y a une session
|
||||
if (sessionData.user) {
|
||||
// Il y a une session on récupère les infos du joueur
|
||||
const updatedPlayer: User = new User(socket.id, sessionData.user.pseudo, sessionData.user.profilePicture, {
|
||||
nbGames: sessionData.user.soloStats.nbGames,
|
||||
bestScore: sessionData.user.soloStats.bestScore,
|
||||
avgNbTry: sessionData.user.soloStats.avgNbTry,
|
||||
},
|
||||
{
|
||||
nbGames: sessionData.user.onlineStats.nbGames,
|
||||
nbWins: sessionData.user.onlineStats.nbWins,
|
||||
ratio: sessionData.user.onlineStats.ratio,
|
||||
})
|
||||
return [updatedPlayer, true]
|
||||
} else {
|
||||
// Pas de session on génère un guest random
|
||||
const guestPlayer: User = new User(socket.id, 'Guest_' + Math.floor(Math.random() * 1000000), '',
|
||||
{
|
||||
nbGames: 0,
|
||||
bestScore: 0,
|
||||
avgNbTry: 0,
|
||||
},
|
||||
{
|
||||
nbGames: 0,
|
||||
nbWins: 0,
|
||||
ratio: 0,
|
||||
})
|
||||
return [guestPlayer, false]
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return [null, false]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default DbUserService
|
@ -0,0 +1,9 @@
|
||||
import User from "../User";
|
||||
|
||||
interface IUserService{
|
||||
|
||||
fetchUserInformation(): Promise<[User | null, boolean]>
|
||||
}
|
||||
|
||||
|
||||
export default IUserService
|
@ -0,0 +1,12 @@
|
||||
import IUserService from "./IUserService";
|
||||
|
||||
class Manager{
|
||||
|
||||
public userService: IUserService
|
||||
|
||||
constructor(userService: IUserService){
|
||||
this.userService = userService
|
||||
}
|
||||
}
|
||||
|
||||
export default Manager
|
@ -1,3 +0,0 @@
|
||||
\relax
|
||||
\@writefile{toc}{\contentsline {paragraph}{Première énigme}{2}{}\protected@file@percent }
|
||||
\gdef \@abspage@last{2}
|
@ -1,132 +0,0 @@
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage{fullpage}
|
||||
\usepackage{times}
|
||||
\usepackage{tikz}
|
||||
\usepackage{paralist}
|
||||
\usetikzlibrary {shapes.multipart}
|
||||
\newcommand{\Basketball}{\includegraphics[width=.5cm]{ballon-de-basket.png}}
|
||||
\newcommand{\Football}{\includegraphics[width=.4cm]{ballon-de-foot.png}}
|
||||
\newcommand{\Bowling}{\includegraphics[width=.5cm]{bowling.png}}
|
||||
\newcommand{\Baseball}{\includegraphics[width=.5cm]{baseball.png}}
|
||||
\newcommand{\Tennis}{\includegraphics[width=.5cm]{tennis.png}}
|
||||
\begin{document}
|
||||
\thispagestyle{empty}
|
||||
Voici le graphe de SocialGraphe
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale=.9]
|
||||
\node[draw, circle split] (0) at (0,0) { Alexander \nodepart{lower} \Football{} \Bowling{}};
|
||||
\node[draw, circle split] (1) at (4,0) { Wyatt \nodepart{lower} \Baseball{} \Tennis{}};
|
||||
\node[draw, circle split] (2) at (8,0) { Mia \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (3) at (12,0) { William \nodepart{lower} \Baseball{} \Football{}};
|
||||
\node[draw, circle split] (4) at (16,0) { Zoey \nodepart{lower} \Basketball{} \Bowling{} \Tennis{}};
|
||||
\node[draw, circle split] (5) at (0,4) { Isabella \nodepart{lower} \Tennis{}};
|
||||
\node[draw, circle split] (6) at (4,4) { Abigail \nodepart{lower} \Baseball{}};
|
||||
\node[draw, circle split] (7) at (8,4) { Savannah \nodepart{lower} \Bowling{} \Basketball{} \Football{}};
|
||||
\node[draw, circle split] (8) at (12,4) { Peyton \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (9) at (16,4) { Alice \nodepart{lower} \Tennis{} \Baseball{}};
|
||||
\node[draw, circle split] (10) at (0,8) { Sophia \nodepart{lower} \Bowling{} \Basketball{} \Bowling{}};
|
||||
\node[draw, circle split] (11) at (4,8) { Layla \nodepart{lower} \Tennis{} \Baseball{} \Football{}};
|
||||
\node[draw, circle split] (12) at (8,8) { Ava \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (13) at (12,8) { Harper \nodepart{lower} \Bowling{}};
|
||||
\node[draw, circle split] (14) at (16,8) { Sebastian \nodepart{lower} \Tennis{} \Basketball{} \Baseball{}};
|
||||
\node[draw, circle split] (15) at (0,12) { Michael \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (16) at (4,12) { Natalie \nodepart{lower} \Bowling{} \Football{} \Baseball{}};
|
||||
\node[draw, circle split] (17) at (8,12) { Penelope \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (18) at (12,12) { Lily \nodepart{lower} \Tennis{} \Tennis{}};
|
||||
\node[draw, circle split] (19) at (16,12) { Eleanor \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (20) at (0,16) { Henry \nodepart{lower} \Bowling{} \Basketball{}};
|
||||
\node[draw, circle split] (21) at (4,16) { Claire \nodepart{lower} \Baseball{} \Basketball{}};
|
||||
\node[draw, circle split] (22) at (8,16) { Caleb \nodepart{lower} \Baseball{}};
|
||||
\node[draw, circle split] (23) at (12,16) { Charlotte \nodepart{lower} \Bowling{} \Football{} \Tennis{}};
|
||||
\node[draw, circle split] (24) at (16,16) { Luke \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (25) at (0,20) { Connor \nodepart{lower} \Baseball{} \Tennis{}};
|
||||
\node[draw, circle split] (26) at (4,20) { Aiden \nodepart{lower} \Basketball{} \Bowling{} \Tennis{}};
|
||||
\node[draw, circle split] (27) at (8,20) { Aurora \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (28) at (12,20) { Nathan \nodepart{lower} \Bowling{} \Baseball{}};
|
||||
\node[draw, circle split] (29) at (16,20) { Aurora \nodepart{lower} \Basketball{}};
|
||||
\draw (0) -- (11);
|
||||
\draw (0) -- (13);
|
||||
\draw (0) -- (18);
|
||||
\draw (1) -- (13);
|
||||
\draw (1) -- (24);
|
||||
\draw (2) -- (22);
|
||||
\draw (2) -- (16);
|
||||
\draw (2) -- (9);
|
||||
\draw (2) -- (6);
|
||||
\draw (3) -- (4);
|
||||
\draw (3) -- (20);
|
||||
\draw (4) -- (28);
|
||||
\draw (4) -- (3);
|
||||
\draw (5) -- (17);
|
||||
\draw (5) -- (15);
|
||||
\draw (5) -- (24);
|
||||
\draw (6) -- (2);
|
||||
\draw (7) -- (17);
|
||||
\draw (7) -- (24);
|
||||
\draw (7) -- (22);
|
||||
\draw (7) -- (11);
|
||||
\draw (8) -- (25);
|
||||
\draw (8) -- (21);
|
||||
\draw (8) -- (24);
|
||||
\draw (8) -- (11);
|
||||
\draw (9) -- (2);
|
||||
\draw (10) -- (25);
|
||||
\draw (10) -- (26);
|
||||
\draw (10) -- (27);
|
||||
\draw (11) -- (0);
|
||||
\draw (11) -- (7);
|
||||
\draw (11) -- (8);
|
||||
\draw (12) -- (20);
|
||||
\draw (12) -- (27);
|
||||
\draw (13) -- (0);
|
||||
\draw (13) -- (1);
|
||||
\draw (14) -- (15);
|
||||
\draw (15) -- (5);
|
||||
\draw (15) -- (14);
|
||||
\draw (15) -- (20);
|
||||
\draw (15) -- (17);
|
||||
\draw (16) -- (2);
|
||||
\draw (16) -- (26);
|
||||
\draw (17) -- (5);
|
||||
\draw (17) -- (7);
|
||||
\draw (17) -- (15);
|
||||
\draw (17) -- (20);
|
||||
\draw (18) -- (0);
|
||||
\draw (19) -- (23);
|
||||
\draw (20) -- (3);
|
||||
\draw (20) -- (12);
|
||||
\draw (20) -- (15);
|
||||
\draw (20) -- (17);
|
||||
\draw (21) -- (8);
|
||||
\draw (22) -- (2);
|
||||
\draw (22) -- (7);
|
||||
\draw (22) -- (23);
|
||||
\draw (23) -- (19);
|
||||
\draw (23) -- (22);
|
||||
\draw (24) -- (1);
|
||||
\draw (24) -- (5);
|
||||
\draw (24) -- (7);
|
||||
\draw (24) -- (8);
|
||||
\draw (25) -- (8);
|
||||
\draw (25) -- (10);
|
||||
\draw (26) -- (10);
|
||||
\draw (26) -- (16);
|
||||
\draw (26) -- (29);
|
||||
\draw (27) -- (10);
|
||||
\draw (27) -- (12);
|
||||
\draw (28) -- (4);
|
||||
\draw (29) -- (26);
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
|
||||
\paragraph{Première énigme}
|
||||
Trouver qui est le coupable avec les indices suivants.
|
||||
\begin{compactitem}
|
||||
\item Indice 1 : Le suspect pratique au moins du Baseball et/ou du Basketball .
|
||||
\item Indice 2 : Le suspect pratique 2 ou 1 sport(s).
|
||||
\item Indice 3 : Le suspect a les cheveux Roux ou Blond .
|
||||
\item Indice 4 : Le suspect a au moins un ami avec les cheveux Roux .
|
||||
\end{compactitem}
|
||||
% Solution : Nathan
|
||||
\end{document}
|