summaryrefslogtreecommitdiff
path: root/app/views/leaderboard/index.html.erb
blob: 1537cf0d984dc339915bc070bdd707399957722c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<h1 class="text-2xl">Leaderboard</h1>
<p>These rankings are not meant to declare the best characters, only those
with the most XP. XP is far from the only indicator of achievement in Esoterra.</p>

<% if current_char %>
  <div class="my-2">
    <%= link_to "View rankings for #{current_char.name}", character_rankings_path(current_char) %>
  </div>
<% end %>

<div class="my-2">
  <%= link_to "Refresh", leaderboard_path %>
</div>

<div class="grid grid-cols-2 gap-2">
  <div class="col-span-2 lg:col-span-1">
    <div>
      <h2 class="text-xl">Total Level</h2>
      <table class="table-auto">
        <thead>
        <tr>
          <th class="table-header-padded">Rank</th>
          <th class="table-header-padded">Character</th>
          <th class="table-header-padded">Total Level</th>
        </tr>
        </thead>
        <tbody>
        <% @top_total_level.each_with_index do |c, index| %>
          <tr>
            <td class="table-cell-padded"><%= index + 1 %></td>
            <td class="table-cell-padded"><%= link_to c.name, character_rankings_path(c) %></td>
            <td class="table-cell-padded"><%= c.total_level %></td>
          </tr>
        <% end %>
        </tbody>
      </table>
    </div>
  </div>
  <div class="col-span-2 lg:col-span-1">
    <div>
      <h2 class="text-xl">Total XP</h2>
      <table class="table-auto">
        <thead>
        <tr>
          <th class="table-header-padded">Rank</th>
          <th class="table-header-padded">Character</th>
          <th class="table-header-padded">Total XP</th>
        </tr>
        </thead>
        <tbody>
        <% @top_total_xp.each_with_index do |c, index| %>
          <tr>
            <td class="table-cell-padded"><%= index + 1 %></td>
            <td class="table-cell-padded"><%= link_to c.name, character_rankings_path(c) %></td>
            <td class="table-cell-padded"><%= c.total_xp %></td>
          </tr>
        <% end %>
        </tbody>
      </table>
    </div>


  </div>
</div>

<div class="mt-4">
  <h2 class="text-xl">Skill XP Totals</h2>
  <div class="grid grid-cols-2 gap-2">
    <% @top_per_skill.each do |skill_name, skill_trainings| %>
      <div class="col-span-2 lg:col-span-1">
        <h3 class="text-lg my-1"><%= skill_name %></h3>
        <table class="table-auto">
          <thead>
          <tr>
            <th class="table-header-padded">Rank</th>
            <th class="table-header-padded">Character</th>
            <th class="table-header-padded">Level</th>
            <th class="table-header-padded">XP</th>
          </tr>
          </thead>
          <tbody>
          <% skill_trainings.each_with_index do |st, index| %>
            <tr>
              <td class="table-cell-padded"><%= index + 1 %></td>
              <td class="table-cell-padded"><%= link_to st.character.name, character_rankings_path(st.character) %></td>
              <td class="table-cell-padded"><%= st.level %></td>
              <td class="table-cell-padded"><%= st.xp %></td>
            </tr>
          <% end %>
          </tbody>
        </table>
      </div>
    <% end %>
  </div>
</div>