summaryrefslogtreecommitdiff
path: root/app/views/runs/show.html.erb
blob: 9db4f53e8bbcd3d79da42c14884197f10ee424b8 (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
<div class="space-y-4">
  <div class="space-y-2">
    <h1 class="text-2xl"><%= @run.title %></h1>
    <p class="subtitle"><%= @run.game.title %></p>
    <p>Started by <%= link_to @run.user.name || "???", user_path(@run.user) %>
      <%= time_ago_in_words(@run.created_at) %> ago.</p>
  </div>

  <div class="font-bold">
    This run is currently
    <% if @run.checked_in? %>
      checked in! You can <%= link_to "checkout this run", new_run_checkpoint_path(@run) %>
      to play it yourself, then check it back in when you're done to save your progress.
    <% else %>
      checked out by <%= link_to @run.checked_out_user.name || "???", user_path(@run.checked_out_user) %>.
      <% if @run.last_save_file.attached? %>
        You can
        <%= link_to "download the last save file", rails_blob_path(@run.last_save_file, disposition: "attachment") %>
        to check it out, but you won't be able to check in any progress.
      <% end %>
    <% end %>
  </div>

  <div class="grid grid-cols-1 md:grid-cols-2">
    <div>
      <h2 class="text-xl">Checkpoints</h2>
      <div><%= link_to "New checkpoint", new_run_checkpoint_path(@run) %></div>

      <% @run.checkpoints.order(:created_at).reverse.each do |checkpoint| %>
        <%= render partial: "checkpoints/checkpoint", locals: {checkpoint:} %>
      <% end %>
    </div>
    <div>
      <% if @run.checked_out_user == current_user %>
        <h2 class="text-xl">Pokédex Entries</h2>
        <%= turbo_frame_tag "pokedex_entries", src: run_pokedex_entries_url(@run) %>
      <% end %>
    </div>
  </div>
</div>