From 98ad48e35b9f85ffac58b60cc9169f7ea844ac27 Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Mon, 22 Nov 2021 18:45:34 +0100 Subject: [PATCH] Added rudamentory playerprofiles... --- routes/routes.js | 10 ++++++++ views/pages/playerProfile.njk | 48 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 views/pages/playerProfile.njk diff --git a/routes/routes.js b/routes/routes.js index 5e89005..ea77660 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -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( '/status', (req, res) => { diff --git a/views/pages/playerProfile.njk b/views/pages/playerProfile.njk new file mode 100644 index 0000000..d745e35 --- /dev/null +++ b/views/pages/playerProfile.njk @@ -0,0 +1,48 @@ +{% extends "../templates/basic.njk" %} +{% import "../components/_utils.njk" as utils %} +{% set player = data.player %} + +{% block head %} + DDStats - {{ player.player }}! + +{% endblock %} + +{% block body %} +
+
+

{{ player.player }}

+
+

First finish

+

+ {{ player.player }}'s first finish was on {{ player.firstFinish.map }} + with a time of {{ utils.fancyTime(player.firstFinish.time) }}. +

+
+
+

Points

+ + + + + + + + + + + + + + + + + + + + + +
Points{{ player.points.points }} pts with the rank {{ player.rank.points }}
Rank points{{ player.points.pointsRank }} pts with the rank {{ player.rank.pointsRank }}
Team points{{ player.points.pointsTeam }} pts with the rank {{ player.rank.pointsTeam }}
Points this week{{ player.points.pointsThisWeek }} pts with the rank {{ player.rank.pointsThisWeek }}
Points this month{{ player.points.pointsThisMonth }} pts with the rank {{ player.rank.pointsThisMonth }}
+
+
+
+{% endblock %} \ No newline at end of file