Added rudamentory playerprofiles...

This commit is contained in:
BurnyLlama 2021-11-22 18:45:34 +01:00
parent 1e5c920c9d
commit 98ad48e35b
2 changed files with 58 additions and 0 deletions

View File

@ -74,6 +74,16 @@ routes.get(
} }
) )
routes.get(
'/players/:player',
(req, res) => {
const player = wrapper.player(req.params.player)
const [success, error] = player ? [true, null] : [false, `Player ${req.params.player} does not exist!`]
tx(req, res)('pages/playerProfile.njk', { player, error }, success, { currentSection: "players" })
}
)
routes.get( routes.get(
'/status', '/status',
(req, res) => { (req, res) => {

View File

@ -0,0 +1,48 @@
{% extends "../templates/basic.njk" %}
{% import "../components/_utils.njk" as utils %}
{% set player = data.player %}
{% block head %}
<title>DDStats - {{ player.player }}!</title>
<link rel="stylesheet" type="text/css" href="/assets/css/maps.css">
{% endblock %}
{% block body %}
<main class="flex-container">
<div class="player player-detailed">
<h1>{{ player.player }}</h1>
<div>
<h2>First finish</h2>
<p>
{{ player.player }}'s first finish was on <a href="/maps/{{ player.firstFinish.map | urlencode }}">{{ player.firstFinish.map }}</a>
with a time of {{ utils.fancyTime(player.firstFinish.time) }}.
</p>
</div>
<div>
<h2>Points</h2>
<table>
<tr>
<td>Points</td>
<td>{{ player.points.points }} pts with the rank {{ player.rank.points }}</td>
</tr>
<tr>
<td>Rank points</td>
<td>{{ player.points.pointsRank }} pts with the rank {{ player.rank.pointsRank }}</td>
</tr>
<tr>
<td>Team points</td>
<td>{{ player.points.pointsTeam }} pts with the rank {{ player.rank.pointsTeam }}</td>
</tr>
<tr>
<td>Points this week</td>
<td>{{ player.points.pointsThisWeek }} pts with the rank {{ player.rank.pointsThisWeek }}</td>
</tr>
<tr>
<td>Points this month</td>
<td>{{ player.points.pointsThisMonth }} pts with the rank {{ player.rank.pointsThisMonth }}</td>
</tr>
</table>
</div>
</div>
</main>
{% endblock %}