Added beginning support for (un)finished maps on player profiles...

This commit is contained in:
BurnyLlama 2021-11-22 18:52:09 +01:00
parent 98ad48e35b
commit 24d30240a7
2 changed files with 20 additions and 1 deletions

View File

@ -78,9 +78,11 @@ routes.get(
'/players/:player',
(req, res) => {
const player = wrapper.player(req.params.player)
const finishedMaps = wrapper.finishedMaps(req.params.player)
const unfinishedMaps = wrapper.unfinishedMaps(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" })
tx(req, res)('pages/playerProfile.njk', { player, finishedMaps, unfinishedMaps, error }, success, { currentSection: "players" })
}
)

View File

@ -1,5 +1,6 @@
{% extends "../templates/basic.njk" %}
{% import "../components/_utils.njk" as utils %}
{% import "../components/_map.njk" as map %}
{% set player = data.player %}
{% block head %}
@ -43,6 +44,22 @@
</tr>
</table>
</div>
<div>
<h2>Finished maps</h2>
<div class="flex-container">
{% for finishedMap in data.finishedMaps %}
{{ map.card(finishedMap) }}
{% endfor %}
</div>
</div>
<div>
<h2>Unfinished maps</h2>
<div class="flex-container">
{% for unfinishedMap in data.unfinishedMaps %}
{{ map.card(unfinishedMap) }}
{% endfor %}
</div>
</div>
</div>
</main>
{% endblock %}