From f55af4fb6bac573f67f078d4ea96e63b98aa267a Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sun, 7 Nov 2021 12:18:13 +0100 Subject: [PATCH] Started working on leaderobard UI/API... --- routes/routes.js | 15 +++++++++++++++ views/pages/leaderboards.njk | 17 +++++++++++++++++ views/pages/mapSingle.njk | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 views/pages/leaderboards.njk diff --git a/routes/routes.js b/routes/routes.js index a56c95d..e72e3a0 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -49,6 +49,21 @@ routes.get( } ) +routes.get( + '/leaderboards', + (req, res) => { + const leaderboards = { + points: wrapper.leaderboardPoints("points", 1, 10), + pointsRank: wrapper.leaderboardPoints("pointsRank", 1, 10), + pointsTeam: wrapper.leaderboardPoints("pointsTeam", 1, 10), + pointsThisWeek: wrapper.leaderboardPoints("pointsThisWeek", 1, 10), + pointsThisMonth: wrapper.leaderboardPoints("pointsThisMonth", 1, 10) + } + + tx(req, res)('pages/maps.njk', { leaderboards }, true, { currentSection: "maps" }) + } +) + routes.get( '/status', (req, res) => { diff --git a/views/pages/leaderboards.njk b/views/pages/leaderboards.njk new file mode 100644 index 0000000..9facc60 --- /dev/null +++ b/views/pages/leaderboards.njk @@ -0,0 +1,17 @@ +{% extends "../templates/base.njk" %} +{% set leaderboards = data.leaderboards %} + + +{% block head %} + DDStats - Leaderboards</ttile> +{% endblock %} + +{% block body %} + <main class="flex-container"> + <div class="leaderboard"> + {% for rank in sequence %} + {{ rank }} + {% endfor %} + </div> + </main> +{% endblock %} \ No newline at end of file diff --git a/views/pages/mapSingle.njk b/views/pages/mapSingle.njk index 11f5698..2ce9d50 100644 --- a/views/pages/mapSingle.njk +++ b/views/pages/mapSingle.njk @@ -5,8 +5,9 @@ {% set raceLeaderboard = data.raceLeaderboard %} {% set teamLeaderboard = data.teamLeaderboard %} {% set graphMap = data.graphMap %} + {% block head %} - <title>DDStats - Maps! + DDStats - {{ map.map }}