generated from WildCodeSchool/create-js-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from WildCodeSchool-2023-09/pageProfil
Page profil
- Loading branch information
Showing
9 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
function InfoProfil({ time, timePlayed, numberPlayed, numberWon }) { | ||
return ( | ||
<div className="infoGamerContainer"> | ||
<div className="menberSince"> | ||
<h2>Menbre depuis : {time}</h2> | ||
</div> | ||
<div className="bottomContainer"> | ||
<div className="leftinfo"> | ||
<p>Temps du jeu :</p> | ||
<br /> | ||
<p>{timePlayed}</p> | ||
</div> | ||
<div className="rightinfos"> | ||
<p> | ||
Partie :<span>{numberPlayed}</span> | ||
</p> | ||
<br /> | ||
<p> | ||
Gagné :<span>{numberWon}</span> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
InfoProfil.propTypes = { | ||
time: PropTypes.string.isRequired, | ||
timePlayed: PropTypes.string.isRequired, | ||
numberPlayed: PropTypes.number.isRequired, | ||
numberWon: PropTypes.number.isRequired, | ||
}; | ||
|
||
export default InfoProfil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
function ProfilBio({ img, username, bio }) { | ||
return ( | ||
<div className="profilbioContainer"> | ||
<h2>Profil</h2> | ||
<div className="toprofilbioContainer"> | ||
<img src={img} alt="profil img" /> | ||
<h2>{username}</h2> | ||
</div> | ||
<div className="bottomprofilbioContainer"> | ||
<textarea>{bio}</textarea> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
ProfilBio.propTypes = { | ||
img: PropTypes.string.isRequired, | ||
username: PropTypes.string.isRequired, | ||
bio: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default ProfilBio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import trophy from "../../assets/trophy.svg"; | ||
|
||
function Rancking({ rang, color }) { | ||
return ( | ||
<div className="ranckingContainer"> | ||
<div> | ||
<h2> | ||
Division <span>{rang}</span> | ||
</h2> | ||
</div> | ||
<hr /> | ||
<div> | ||
<img | ||
src={trophy} | ||
width={105} | ||
alt="trophée" | ||
style={{ backgroundColor: color }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
Rancking.propTypes = { | ||
rang: PropTypes.string.isRequired, | ||
color: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default Rancking; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Link } from "react-router-dom"; | ||
import logo from "../../assets/icons8-user-32.png"; | ||
|
||
function InputProfil() { | ||
return ( | ||
<Link to="/profil"> | ||
<button type="button"> | ||
<span> | ||
<img src={logo} alt="profilimage" /> | ||
</span> | ||
</button> | ||
</Link> | ||
); | ||
} | ||
|
||
export default InputProfil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useContext } from "react"; | ||
import Rancking from "../components/ProfilPage/Rancking"; | ||
import { AuthContext } from "../../context/AuthContext"; | ||
import division from "../services/divisions"; | ||
import cupColors from "../services/cupColors"; | ||
|
||
function ProfilPage() { | ||
const { profil, connected } = useContext(AuthContext); | ||
|
||
if (connected && connected.login && connected.login.username && profil) { | ||
return ( | ||
<div className="profilPageContainer"> | ||
<div className="ranckingContainerPage"> | ||
<Rancking | ||
rang={division(connected.wonGames.won_count)} | ||
color={cupColors(connected.wonGames.won_count)} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ProfilPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const cupColors = (num) => { | ||
if (num === 0) { | ||
return "#FFFFFF"; | ||
} | ||
if (num <= 3) { | ||
return "#614E1A"; | ||
} | ||
if (num <= 5) { | ||
return "#C0C0C0"; | ||
} | ||
if (num <= 7) { | ||
return "#FFD700"; | ||
} | ||
return "#A0B2C6"; | ||
}; | ||
|
||
export default cupColors; |