diff --git a/routes/routes.js b/routes/routes.js index d412109..440aa5a 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -52,18 +52,35 @@ routes.get( routes.get( '/leaderboards', (req, res) => { + const region = "Global" const leaderboards = { - points: wrapper.leaderboardPoints("points", "Global", 1, 10), - pointsRank: wrapper.leaderboardPoints("pointsRank", "Global", 1, 10), - pointsTeam: wrapper.leaderboardPoints("pointsTeam", "Global", 1, 10), - pointsThisWeek: wrapper.leaderboardPoints("pointsThisWeek", "Global", 1, 10), - pointsThisMonth: wrapper.leaderboardPoints("pointsThisMonth", "Global", 1, 10) + points: wrapper.leaderboardPoints("points", region, 1, 10), + pointsRank: wrapper.leaderboardPoints("pointsRank", region, 1, 10), + pointsTeam: wrapper.leaderboardPoints("pointsTeam", region, 1, 10), + pointsThisWeek: wrapper.leaderboardPoints("pointsThisWeek", region, 1, 10), + pointsThisMonth: wrapper.leaderboardPoints("pointsThisMonth", region, 1, 10) } tx(req, res)('pages/leaderboards.njk', { leaderboards }, true, { currentSection: "leaderboards" }) } ) +routes.get( + '/leaderboards/:region', + (req, res) => { + const region = req.params.region.match(/^(Global|Europe|Asia|SA|NA|Africa|ME|OLD|Other)$/) ? req.params.region : "Global" + const leaderboards = { + points: wrapper.leaderboardPoints("points", region, 1, 10), + pointsRank: wrapper.leaderboardPoints("pointsRank", region, 1, 10), + pointsTeam: wrapper.leaderboardPoints("pointsTeam", region, 1, 10), + pointsThisWeek: wrapper.leaderboardPoints("pointsThisWeek", region, 1, 10), + pointsThisMonth: wrapper.leaderboardPoints("pointsThisMonth", region, 1, 10) + } + + tx(req, res)('pages/leaderboards.njk', { leaderboards, region }, true, { currentSection: "leaderboards" }) + } +) + routes.get( '/status', (req, res) => { diff --git a/src/sass/leaderboards.scss b/src/sass/leaderboards.scss index 5cb6652..0feaf24 100644 --- a/src/sass/leaderboards.scss +++ b/src/sass/leaderboards.scss @@ -3,6 +3,39 @@ @use "partials/shadows.scss"; +.regions { + width: 100vw; + justify-content: center; +} + +.region { + margin: 1rem; + padding: .5rem 1.25rem; + + border: .1rem solid palette.$accent; + border-radius: settings.$border_radius_m; + + color: palette.$accent; + + text-decoration: none transparent; + transition: color .3s, background-color .3s; + + &:hover { + color: palette.$surface; + background-color: palette.$accent; + } + + &.current-region { + border-color: palette.$primary; + color: palette.$primary; + + &:hover { + color: palette.$surface; + background-color: palette.$primary; + } + } +} + .leaderboard { display: flex; flex-direction: column; diff --git a/src/sass/theme.scss b/src/sass/theme.scss index df93d17..50dce87 100644 --- a/src/sass/theme.scss +++ b/src/sass/theme.scss @@ -66,7 +66,7 @@ nav { } } -main.flex-container { +.flex-container { display: flex; flex-wrap: wrap; align-items: center; diff --git a/static/css/leaderboards.css b/static/css/leaderboards.css index 5571650..8a29f7b 100644 --- a/static/css/leaderboards.css +++ b/static/css/leaderboards.css @@ -1 +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} +.regions{width:100vw;justify-content:center}.region{margin:1rem;padding:.5rem 1.25rem;border:.1rem solid #fba7c6;border-radius:1rem;color:#fba7c6;text-decoration:none transparent;transition:color .3s,background-color .3s}.region:hover{color:#10102f;background-color:#fba7c6}.region.current-region{border-color:#ee588f;color:#ee588f}.region.current-region:hover{color:#10102f;background-color:#ee588f}.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/static/css/theme.css b/static/css/theme.css index 11d86ab..5c8ae8e 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -1 +1 @@ -*,*::before,*::after{margin:0;padding:0;border:0 none transparent;box-sizing:border-box;scroll-behavior:smooth;font-family:"Manrope Regular",sans-serif;font-size:1rem;line-height:1.5}html,body{color:#e0e0ff;background-color:#10102f;height:100%}nav{display:flex;align-items:center;background-color:#20203f;border-radius:0 0 2rem 2rem;box-shadow:.5rem 0 4rem #00001f;margin:0 0 2rem 0;padding:1rem 2rem}nav .logo{width:3rem;height:3rem;margin-right:2rem;border-radius:100%;background-color:#ee588f}nav a{color:#fba7c6;border-bottom:.1rem solid transparent;margin:.25rem 1rem .5rem 1rem;padding:.15rem .5rem .25rem .5rem;font-size:1.25rem;text-decoration:none transparent;transition:border .3s}nav a:hover{border-bottom:.1rem solid #fba7c6}nav a.current{color:#ee588f}nav a.current:hover{border-bottom:.1rem solid #ee588f}main.flex-container{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-around;margin:0 10vw}header,h1,h2,h3,h4,h5,h6{color:#fba7c6}header{font-size:4rem}h1{font-size:1.5rem;font-weight:normal}h2{font-size:1.35rem;font-weight:normal}h3{font-size:1.2rem;font-weight:normal}h4{font-size:1.05rem;font-weight:normal}h5{font-size:.9rem;font-weight:normal}a{color:#a3cefa}form{display:flex;flex-direction:column;justify-content:center;align-items:center}input{color:#e0e0ff;background-color:#20203f;margin:1em 0;padding:.75em 1.25em;outline:0 none transparent;border:.2rem solid transparent;border-radius:.5rem;box-shadow:.25rem 0 2rem #00001f;transition:border .3s,background-color .5s,border-radius .5s}input:hover{background-color:#30304f;border-radius:1rem}input:active,input:focus{border:.2rem solid #ee588f}button[type=submit]{margin:.75rem auto 1.25rem auto;padding:.15rem .5rem;border:.1rem solid #fba7c6;border-radius:.5rem;color:#fba7c6;background-color:transparent;cursor:pointer;text-decoration:none transparent;transition:color .3s,background-color .3s}button[type=submit]:hover{color:#10102f;background-color:#fba7c6}label{cursor:pointer;margin:.25rem 0}label>input[type=radio]{-webkit-appearance:none;appearance:none;cursor:pointer;margin:0 .5rem -0.25rem 1rem;padding:0;width:1.25rem;height:1.25rem;background-color:#e0e0ff;border:.25rem solid #e0e0ff;border-radius:100%}label>input[type=radio]:checked{border-color:#ee588f}label:hover>input[type=radio]{background-color:#fba7c6}#search{display:grid;grid-template-columns:2fr 1fr;grid-template-columns:repeat(auto, 4);grid-template-areas:"header header" "map map" "category category" "stars sort" "submit submit";width:min(90ch,80vw);margin:2rem 10vw}#search>*{width:100%}#search h1{grid-area:header}#search #map{grid-area:map}#search #categories{grid-area:category}#search #stars{grid-area:stars}#search .sorting{grid-area:sort;display:flex;flex-direction:column}#search button[type=submit]{grid-area:submit;width:max-content;margin:auto}tr{width:max-content}tr td{padding:.25rem 0;vertical-align:middle;width:max-content}tr td:first-child{padding:.25rem 1.5rem .25rem 0}footer{display:flex;flex-direction:column;align-items:center;margin:5vh 2rem}footer a{color:#74b6fb;font-size:.8rem} +*,*::before,*::after{margin:0;padding:0;border:0 none transparent;box-sizing:border-box;scroll-behavior:smooth;font-family:"Manrope Regular",sans-serif;font-size:1rem;line-height:1.5}html,body{color:#e0e0ff;background-color:#10102f;height:100%}nav{display:flex;align-items:center;background-color:#20203f;border-radius:0 0 2rem 2rem;box-shadow:.5rem 0 4rem #00001f;margin:0 0 2rem 0;padding:1rem 2rem}nav .logo{width:3rem;height:3rem;margin-right:2rem;border-radius:100%;background-color:#ee588f}nav a{color:#fba7c6;border-bottom:.1rem solid transparent;margin:.25rem 1rem .5rem 1rem;padding:.15rem .5rem .25rem .5rem;font-size:1.25rem;text-decoration:none transparent;transition:border .3s}nav a:hover{border-bottom:.1rem solid #fba7c6}nav a.current{color:#ee588f}nav a.current:hover{border-bottom:.1rem solid #ee588f}.flex-container{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-around;margin:0 10vw}header,h1,h2,h3,h4,h5,h6{color:#fba7c6}header{font-size:4rem}h1{font-size:1.5rem;font-weight:normal}h2{font-size:1.35rem;font-weight:normal}h3{font-size:1.2rem;font-weight:normal}h4{font-size:1.05rem;font-weight:normal}h5{font-size:.9rem;font-weight:normal}a{color:#a3cefa}form{display:flex;flex-direction:column;justify-content:center;align-items:center}input{color:#e0e0ff;background-color:#20203f;margin:1em 0;padding:.75em 1.25em;outline:0 none transparent;border:.2rem solid transparent;border-radius:.5rem;box-shadow:.25rem 0 2rem #00001f;transition:border .3s,background-color .5s,border-radius .5s}input:hover{background-color:#30304f;border-radius:1rem}input:active,input:focus{border:.2rem solid #ee588f}button[type=submit]{margin:.75rem auto 1.25rem auto;padding:.15rem .5rem;border:.1rem solid #fba7c6;border-radius:.5rem;color:#fba7c6;background-color:transparent;cursor:pointer;text-decoration:none transparent;transition:color .3s,background-color .3s}button[type=submit]:hover{color:#10102f;background-color:#fba7c6}label{cursor:pointer;margin:.25rem 0}label>input[type=radio]{-webkit-appearance:none;appearance:none;cursor:pointer;margin:0 .5rem -0.25rem 1rem;padding:0;width:1.25rem;height:1.25rem;background-color:#e0e0ff;border:.25rem solid #e0e0ff;border-radius:100%}label>input[type=radio]:checked{border-color:#ee588f}label:hover>input[type=radio]{background-color:#fba7c6}#search{display:grid;grid-template-columns:2fr 1fr;grid-template-columns:repeat(auto, 4);grid-template-areas:"header header" "map map" "category category" "stars sort" "submit submit";width:min(90ch,80vw);margin:2rem 10vw}#search>*{width:100%}#search h1{grid-area:header}#search #map{grid-area:map}#search #categories{grid-area:category}#search #stars{grid-area:stars}#search .sorting{grid-area:sort;display:flex;flex-direction:column}#search button[type=submit]{grid-area:submit;width:max-content;margin:auto}tr{width:max-content}tr td{padding:.25rem 0;vertical-align:middle;width:max-content}tr td:first-child{padding:.25rem 1.5rem .25rem 0}footer{display:flex;flex-direction:column;align-items:center;margin:5vh 2rem}footer a{color:#74b6fb;font-size:.8rem} diff --git a/views/pages/leaderboards.njk b/views/pages/leaderboards.njk index a3516e5..89682c3 100644 --- a/views/pages/leaderboards.njk +++ b/views/pages/leaderboards.njk @@ -17,6 +17,11 @@ {% block body %}
+
+ {% for region in ["Global", "Europe", "Asia", "SA", "NA", "Africa", "ME", "OLD", "Other"] %} + {{ region }} + {% endfor %} +
{% for leaderboardType, leaderboard in leaderboards %}

{{ leaderboardHeadings[leaderboardType] }}