summaryrefslogtreecommitdiff
path: root/app/views/look
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/look')
-rw-r--r--app/views/look/_results.html.erb27
-rw-r--r--app/views/look/_timer.html.erb18
-rw-r--r--app/views/look/show.html.erb10
3 files changed, 55 insertions, 0 deletions
diff --git a/app/views/look/_results.html.erb b/app/views/look/_results.html.erb
new file mode 100644
index 0000000..36e8103
--- /dev/null
+++ b/app/views/look/_results.html.erb
@@ -0,0 +1,27 @@
+<div>
+ <% results.each do |result| %>
+ <% case result[:type] %>
+ <% when "item" %>
+ <p>You got <%= result[:quantity] %> <%= link_to result[:item].name, item_path(result[:item])%>
+ <% if result[:xp]&.any? %>
+ (<%= result[:xp].map { |award| "#{award[:amount] * result[:quantity]} xp #{award[:skill].name}" }.join(", ") %>)
+ <% end %>
+ </p>
+ <% when "hearth_amenity" %>
+ <p>You constructed <%= result[:hearth_amenity].name %>.</p>
+ <% when "activity" %>
+ <p>You realized how to <%= result[:activity].name %>!</p>
+ <% when "monster" %>
+ <p>You encountered a <%= result[:monster].name %>.</p>
+ <p class="text-xs italic"><%= result[:monster].description %></p>
+ <% when "xp" %>
+ <p class="text-xs">You gained <%= result[:xp] %> <%= result[:skill].name %> XP.</p>
+ <% when "title" %>
+ <p>You earned the title <%= render "application/components/text/title", title: result[:title] %>!</p>
+ <% when "message" %>
+ <p><%= result[:body] %></p>
+ <% when "error" %>
+ <p><%= result[:message] %></p>
+ <% end %>
+ <% end %>
+</div>
diff --git a/app/views/look/_timer.html.erb b/app/views/look/_timer.html.erb
new file mode 100644
index 0000000..908689b
--- /dev/null
+++ b/app/views/look/_timer.html.erb
@@ -0,0 +1,18 @@
+<% if current_char.activity %>
+ <div data-controller="timer"
+ data-timer-start-value="<%= current_char.activity_time_remaining.ceil %>"
+ data-timer-post-url-value="<%= finish_activity_url %>"
+ class="text-center">
+ <span data-timer-target="timer" class="text-3xl"></span>
+ </div>
+
+ <% most_recent_cs = current_char.character_skills.order(:updated_at).last %>
+ <div class="text-center text-sm">
+ <div class="text-xs"><%= most_recent_cs.skill.name %> level <%= most_recent_cs.level %></div>
+ <div><%= most_recent_cs.xp_to_next_level %> XP to next level</div>
+ </div>
+
+ <div class="text-center my-4">
+ <%= button_to "Stop", stop_activity_path %>
+ </div>
+<% end %>
diff --git a/app/views/look/show.html.erb b/app/views/look/show.html.erb
new file mode 100644
index 0000000..a0c1bd7
--- /dev/null
+++ b/app/views/look/show.html.erb
@@ -0,0 +1,10 @@
+<h1 class="text-2xl"><%= current_char.activity.name %></h1>
+<p><%= current_char.activity.description %></p>
+
+<div class="min-w-full my-2 px-1 overflow-auto text-sm border-2 border-gray-800 rounded"
+ style="height: 30rem;" id="result_output">
+</div>
+
+<div id="result_controls">
+ <%= render "timer" %>
+</div>