Current section
Files
Jump to
Current section
Files
lib/rube_web/live/chainlink_live.html.leex
<h2 class="text-3xl">Chainlink Feeds (<%= length(@feeds) %>)</h2>
<div class="flex items-center mt-4">
<form phx-change="search" phx-submit="search">
<input type="text" name="query" value="<%= @query %>" placeholder="Search" autocomplete="off"/>
</form>
</div>
<table class="w-full mt-8">
<thead class="bg-gray-200 border-t-2 border-gray-400">
<tr>
<th scope="col" class="w-2/12 px-4 py-3 text-left">Blockchain ID</th>
<th scope="col" class="w-2/12 px-4 py-3 text-left">Name</th>
<th scope="col" class="w-3/12 px-4 py-3 text-left">Address</th>
<th scope="col" class="w-2/12 px-4 py-3 text-left">Type</th>
<th scope="col" class="w-1/12 px-4 py-3 text-left">Enabled</th>
<th scope="col" class="w-1/12 px-4 py-3 text-left">Latest Answer</th>
<th scope="col" class="w-1/12 px-4 py-3 text-left">Latest Round</th>
</tr>
</thead>
<tbody>
<%= if Enum.any?(@feeds) do %>
<%= for f <- @feeds do %>
<tr class="<%= if @latest && f.address == @latest.address, do: "animate-pulse bg-blue-50" %> hover:bg-gray-50 border-t border-b group">
<td scope="row" class="px-4 py-3"><%= f.blockchain_id %></td>
<td class="px-4 py-3"><%= f.name %></td>
<td class="px-4 py-3">
<div class="flex active:opacity-25">
<%= ellipsis(f.address, 24) %>
<%= copy_button target_text: f.address, class: "ml-2" %>
<%= explorer_address_link(f.blockchain_id, f.address, class: "ml-2") %>
</div>
</td>
<td class="px-4 py-3"><%= f.type %></td>
<td class="px-4 py-3"><%= f.enabled %></td>
<td class="px-4 py-3"><%= f |> Rube.Chainlink.Feed.humanize_latest_answer() |> Decimal.to_string(:normal) %></td>
<td class="px-4 py-3"><%= f.latest_round %></td>
</tr>
<% end %>
<% else %>
<tr class="hover:bg-gray-50 border-t border-b group">
<td colspan="7" class="px-4 py-3">
<%= if @query == nil do %>
no chainlink feeds have been received yet
<% else %>
no search results
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>