From 97fbeba1cf0b36c75bcbf010af0dd9e60708cbed Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sun, 7 Nov 2021 12:43:05 +0100 Subject: [PATCH] Leaderboards now working... --- routes/routes.js | 2 +- src/sass/leaderboards.scss | 43 ++++++++++++++++++++++++++++++++++++ static/css/leaderboards.css | 1 + views/pages/leaderboards.njk | 33 ++++++++++++++++++++------- 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 src/sass/leaderboards.scss create mode 100644 static/css/leaderboards.css diff --git a/routes/routes.js b/routes/routes.js index e72e3a0..99b97f7 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -60,7 +60,7 @@ routes.get( pointsThisMonth: wrapper.leaderboardPoints("pointsThisMonth", 1, 10) } - tx(req, res)('pages/maps.njk', { leaderboards }, true, { currentSection: "maps" }) + tx(req, res)('pages/leaderboards.njk', { leaderboards }, true, { currentSection: "leaderboards" }) } ) diff --git a/src/sass/leaderboards.scss b/src/sass/leaderboards.scss new file mode 100644 index 0000000..5cb6652 --- /dev/null +++ b/src/sass/leaderboards.scss @@ -0,0 +1,43 @@ +@use "partials/palette.scss"; +@use "partials/settings.scss"; +@use "partials/shadows.scss"; + + +.leaderboard { + display: flex; + flex-direction: column; + + width: max-content; + margin: 2rem; + padding: 1.5rem 2rem; + + background-color: palette.$grey3; + border-radius: settings.$border_radius_m; + box-shadow: shadows.$small; +} + +.rank { + display: flex; + margin: 1.5rem 0; + + .country-image { + height: 1.5rem; + margin: auto .5rem auto 0; + } + + .rank-position { + color: palette.$primary; + margin: auto .5rem auto 0; + font-weight: bold; + } + + .rank-player { + margin: auto 2rem auto 0; + } + + .rank-points { + color: palette.$grey10; + font-family: 'Manrope Light'; + margin: auto 0 auto auto; + } +} \ No newline at end of file diff --git a/static/css/leaderboards.css b/static/css/leaderboards.css new file mode 100644 index 0000000..5571650 --- /dev/null +++ b/static/css/leaderboards.css @@ -0,0 +1 @@ +.leaderboard{display:flex;flex-direction:column;width:max-content;margin:2rem;padding:1.5rem 2rem;background-color:#20203f;border-radius:1rem;box-shadow:.25rem 0 2rem #00001f}.rank{display:flex;margin:1.5rem 0}.rank .country-image{height:1.5rem;margin:auto .5rem auto 0}.rank .rank-position{color:#ee588f;margin:auto .5rem auto 0;font-weight:bold}.rank .rank-player{margin:auto 2rem auto 0}.rank .rank-points{color:#9090af;font-family:"Manrope Light";margin:auto 0 auto auto} diff --git a/views/pages/leaderboards.njk b/views/pages/leaderboards.njk index 9facc60..f20ec6b 100644 --- a/views/pages/leaderboards.njk +++ b/views/pages/leaderboards.njk @@ -1,17 +1,34 @@ -{% extends "../templates/base.njk" %} +{% extends "../templates/basic.njk" %} {% set leaderboards = data.leaderboards %} - +{% + set leaderboardHeadings = { + points: "Points", + pointsRank: "Rank points", + pointsTeam: "Team points", + pointsThisWeek: "Points gathered this week", + pointsThisMonth: "Points gathered this month" + } +%} {% block head %} - DDStats - Leaderboards</ttile> + <link rel="stylesheet" type="text/css" href="/assets/css/leaderboards.css"> + <title> DDStats - Leaderboards {% endblock %} {% block body %}
-
- {% for rank in sequence %} - {{ rank }} - {% endfor %} -
+ {% for leaderboardType, leaderboard in leaderboards %} +
+

{{ leaderboardHeadings[leaderboardType] }}

+ {% for rank in leaderboard %} +
+ +

{{ rank.rank }}

+

{{ rank.player }}

+

{{ rank.points }} pts

+
+ {% endfor %} +
+ {% endfor %}
{% endblock %} \ No newline at end of file