1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/views/leaderboard.tpl.html

98 lines
4.7 KiB
HTML
Raw Normal View History

2022-10-03 11:53:27 +03:00
<!DOCTYPE html>
<html lang="en">
{{ template "head.tpl.html" . }}
<script>
const defaultTab = 'total'
</script>
<body class="relative bg-gray-900 text-gray-700 p-4 pt-10 flex flex-col min-h-screen {{ if .User }} max-w-screen-xl {{ else }} max-w-screen-lg {{end}} mx-auto justify-center">
{{ template "alerts.tpl.html" . }}
{{ if .User }}
{{ template "menu-main.tpl.html" . }}
{{ else }}
{{ template "header.tpl.html" . }}
{{ template "login-btn.tpl.html" . }}
{{ end }}
<main class="mt-10 grow flex justify-center w-full" id="leaderboard-page">
<div class="flex flex-col grow mt-10 max-available">
<h1 class="h1" style="margin-bottom: 0.5rem">Leaderboard</h1>
2022-10-03 11:53:27 +03:00
2022-10-06 16:17:37 +03:00
<p class="block text-sm text-gray-300 w-full lg:w-3/4 mb-8">
Wakapi's leaderboard shows a ranking of the most active users on this server, given they opted in to get listed on the public leaderboard. Statistics are updated at least every 12 hours and are based on the users' total coding time in the past seven days.
2022-10-06 16:17:37 +03:00
To participate, log in, go to <a class="link" href="settings#permissions">Settings 🠒 Permissions</a> and enable leaderboards.
</p>
<ul class="flex space-x-4 mb-4 text-gray-600">
<li class="font-semibold text-xl {{ if eq .By "" }} text-gray-300 {{ else }} hover:text-gray-500 {{ end }}">
<a href="leaderboard">Total</a>
2022-10-03 11:53:27 +03:00
</li>
<li class="font-semibold text-xl {{ if eq .By "language" }} text-gray-300 {{ else }} hover:text-gray-500 {{ end }}">
<a href="leaderboard?by=language">By Language</a>
2022-10-03 11:53:27 +03:00
</li>
</ul>
{{ if ne .By "" }}
2022-10-06 21:42:05 +03:00
<div class="flex flex-wrap space-x-2 mb-4">
{{ range $i, $key := (strslice .TopKeys 0 10) }}
<div class="inline-block mb-4">
<a href="leaderboard?by={{ $.By }}&key={{ lower $key }}" class="{{ if eq (lower $.Key) (lower $key) }} btn-primary {{ else }} btn-default {{ end }} btn-small cursor-pointer whitespace-nowrap">
{{ if and (eq (lower $.By) "language") ($.LangIcon $key) }}
<span class="align-middle leading-none"><span class="iconify inline text-white text-base" data-icon="{{ ($.LangIcon $key) | urlSafe }}"></span>&nbsp;</span>
{{ end }}
<span>{{ $key }}</span>
</a>
</div>
{{ end }}
</div>
{{ end }}
2022-10-06 21:42:05 +03:00
<div class="flex flex-col space-y-4 mt-4 text-gray-300 w-full lg:w-3/4">
2022-10-06 16:17:37 +03:00
{{ if len .Items }}
2022-10-03 11:53:27 +03:00
<ol>
{{ range $i, $item := .Items }}
<li class="px-4 py-2 my-2 rounded-md border-2 leaderboard-{{ ($.ColorModifier $item $.User) }} flex justify-between">
2023-01-08 01:59:21 +03:00
<div class="w-12"><strong># {{ $item.Rank }}</strong></div>
<div class="flex flex-grow w-16 mx-1 justify-start items-center space-x-4 align-middle">
{{ if avatarUrlTemplate }}
<img src="{{ $item.User.AvatarURL avatarUrlTemplate }}" width="24px" class="rounded-full border-green-700" alt="User Profile Avatar"/>
{{ else }}
<span class="iconify inline cursor-pointer text-gray-500 rounded-full border-green-700" style="width: 24px; height: 24px" data-icon="ic:round-person"></span>
{{ end }}
<strong class="text-ellipsis truncate">@{{ $item.UserID }}</strong>
</div>
2023-01-08 01:59:21 +03:00
<div class="flex-1 mx-1 hidden sm:inline-block truncate leading-6 align-middle">
{{ range $i, $lang := (index $.UserLanguages $item.UserID) }}
{{ if $.LangIcon $lang }}
<span class="align-middle leading-none"><span class="iconify inline text-white text-base" data-icon="{{ ($.LangIcon $lang) | urlSafe }}"></span></span>
{{ end }}
<span class="text-sm leading-6">{{ $lang }}{{ if lt $i (add (len (index $.UserLanguages $item.UserID)) -1) }},&nbsp;{{ end }}</span>
{{ end }}
2022-10-06 21:42:05 +03:00
</div>
2023-01-08 01:59:21 +03:00
<div class="flex-1 ml-1 text-right"><span>{{ $item.Total | duration }}</span></div>
</li>
2022-10-03 11:53:27 +03:00
{{ end }}
</ol>
2022-10-06 16:30:18 +03:00
<p class="text-sm pt-8">Last Updated: {{ .LastUpdate | datetime }}</p>
2022-10-06 16:17:37 +03:00
{{ else }}
<p>
<span class="iconify inline text-white text-base" data-icon="twemoji:frowning-face"></span>&nbsp;
The leaderboard is currently empty ...
</p>
{{ end }}
2022-10-03 11:53:27 +03:00
</div>
</div>
</main>
{{ template "footer.tpl.html" . }}
{{ template "foot.tpl.html" . }}
</body>
</html>