summaryrefslogtreecommitdiff
path: root/lib/lsg_web/templates/alcoolog/index.html.eex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsg_web/templates/alcoolog/index.html.eex')
-rw-r--r--lib/lsg_web/templates/alcoolog/index.html.eex205
1 files changed, 0 insertions, 205 deletions
diff --git a/lib/lsg_web/templates/alcoolog/index.html.eex b/lib/lsg_web/templates/alcoolog/index.html.eex
deleted file mode 100644
index 5a5423a..0000000
--- a/lib/lsg_web/templates/alcoolog/index.html.eex
+++ /dev/null
@@ -1,205 +0,0 @@
-<style type="text/css">
-ol li {
- margin-bottom: 5px
-}
-</style>
-
-<%= if @stats == [] do %>
- <div class="rounded-md bg-red-50 p-4">
- <div class="flex">
- <div class="flex-shrink-0">
- <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
- </svg>
- </div>
- <div class="ml-3">
- <h3 class="text-sm leading-5 font-medium text-red-800">
- CATASTROPHE! Personne n'a bu!!!!
- </h3>
- </div>
- </div>
- </div>
-<% end %>
-
-<ul class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
- <%= for {nick, status} <- @stats do %>
- <li class="col-span-1 bg-white rounded-lg shadow">
- <div class="w-full flex items-center justify-between p-6 space-x-6">
- <div class="flex-1 truncate">
- <div class="flex items-center space-x-3">
- <h3 class="text-gray-900 text-base leading-5 font-semibold truncate"><%= link nick, to: alcoolog_path(@conn, :nick, @network, nick) %></h3>
- <% rising_class = if status.rising, do: "teal", else: "red" %>
- <span class="flex-shrink-0 inline-block px-2 py-0.5 text-<%= rising_class %>-800 text-sm leading-4 font-medium bg-<%= rising_class %>-100 rounded-full">
- <%= status.trend_symbol %> <%= Float.round(status.active, 4) %> g/l
- </span>
- </div>
- <p class="mt-1 text-gray-700 text-sm leading-5 truncate">
- <span class="text-base"><%= status.last_cl %>cl @ <%= status.last_deg %>°</span>
- <%= if status.last_descr && status.last_descr != "" do %>
- <br /><%= status.last_descr %>
- <% end %>
- <br/><small><%= NolaWeb.LayoutView.format_time(status.last_at) %></small>
- </p>
-
- <p class="mt-1 text-gray-500 text-sm leading-5 truncate">
- <br />
- &mdash; sobre dans: <%= status.sober_in_s %><br />
- <%= if status.since do %>
- &mdash; depuis: <%= status.since_s %><br />
- <% end %>
- <small>
- &mdash; 15m: <%= status.active15m %> g/l - 30m: <%= status.active30m %> g/l - 1h: <%= status.active1h %> g/l<br />
- &mdash; aujourd'hui: <%= status.daily_volumes %> points, <%= status.daily_gl %> g/l
- </small>
- </p>
-
-
- </div>
- </div>
- </li>
- <% end %>
-</ul>
-
-<%= if @stats == %{} do %>
- <div class="rounded-md bg-red-50 p-4">
- <div class="flex">
- <div class="flex-shrink-0">
- <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
- </svg>
- </div>
- <div class="ml-3">
- <h3 class="text-sm leading-5 font-medium text-red-800">
- ENCORE PIRE! Aucune boisson enregistrée!
- </h3>
- </div>
- </div>
- </div>
-<% else %>
-
-<canvas id="myChart" class="w-full" height="200"></canvas>
-
- <h2 class="leading-8 m-4 font-semibold text-2xl">Classement <span class="font-medium text-gray-600 text-lg">15 jours</span></h2>
-
-<ul class="grid grid-cols-1 gap-6 sm:grid-cols-5 lg:grid-cols-5">
- <%= for {{nick, count}, rank} <- Enum.with_index(@top) do %>
- <% rank = rank + 1 %>
- <% trophy = rank <= 3 %>
- <% {colour, text} = case rank do
-1 -> {"yellow-500", "font-semibold text-base"}
-2 -> {"gray-500", "font-medium text-base"}
-3 -> {"orange-300", "font-medium text-base"}
-_ -> {"gray-300", ""}
- end %>
- <li class="col-span-1 bg-white rounded-lg shadow text-center <%= text %>">
- <%= if trophy do %>
- <span class="text-<%= colour %>">
- <svg style="width: 1.125em; height: 1.5em; display: inline-block;" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="trophy" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" data-fa-i2svg=""><path fill="currentColor" d="M552 64H448V24c0-13.3-10.7-24-24-24H152c-13.3 0-24 10.7-24 24v40H24C10.7 64 0 74.7 0 88v56c0 35.7 22.5 72.4 61.9 100.7 31.5 22.7 69.8 37.1 110 41.7C203.3 338.5 240 360 240 360v72h-48c-35.3 0-64 20.7-64 56v12c0 6.6 5.4 12 12 12h296c6.6 0 12-5.4 12-12v-12c0-35.3-28.7-56-64-56h-48v-72s36.7-21.5 68.1-73.6c40.3-4.6 78.6-19 110-41.7 39.3-28.3 61.9-65 61.9-100.7V88c0-13.3-10.7-24-24-24zM99.3 192.8C74.9 175.2 64 155.6 64 144v-16h64.2c1 32.6 5.8 61.2 12.8 86.2-15.1-5.2-29.2-12.4-41.7-21.4zM512 144c0 16.1-17.7 36.1-35.3 48.8-12.5 9-26.7 16.2-41.8 21.4 7-25 11.8-53.6 12.8-86.2H512v16z"></path></svg>
- </span>
- <% end %>
- #<%= rank %>: <%= link nick, to: alcoolog_path(@conn, :nick, @network, nick) %>
- <br />
- <span class="text-xs"><%= Float.round(count, 4) %></span>
- </li>
- <% end %>
-</ul>
-
- <h2 class="leading-8 m-4 font-semibold text-2xl">Historique</h2>
-<div class="flex flex-col">
- <div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
- <div class="align-middle inline-block min-w-full shadow overflow-hidden sm:rounded-lg border-b border-gray-200">
- <table class="min-w-full divide-y divide-gray-200">
- <thead>
- <tr>
- <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
- date
- </th>
- <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
- nick
- </th>
- <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
- &nbsp;
- </th>
- <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
- &nbsp;
- </th>
- </tr>
- </thead>
- <tbody>
- <%= for {{{{account, date}, points, _active, cl, deg, nom, comment, _meta}, nick}, index} <- Enum.with_index(@drinks) do %>
- <% class = if(Integer.is_even(index), do: "bg-gray-50", else: "bg-white") %>
- <% date = DateTime.from_unix!(date, :millisecond) %>
- <tr class="<%= class %>">
- <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 font-medium text-gray-900">
- <%= NolaWeb.LayoutView.format_time(date, false) %>
- </td>
- <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 font-medium text-gray-900">
- <%= link nick, to: alcoolog_path(@conn, :nick, @network, nick) %>
- </td>
- <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500"><%= cl %>cl <%= deg %>°</td>
- <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500"><%= comment||"" %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
- </div>
-</div>
-<% end %>
-
-<%= if @conn.assigns.account && (@network || @channel) do %>
- <%= link("alcoolog global", to: alcoolog_path(@conn, :index)) %>
-<% end %>
-
-<link href='/css/metricsgraphics.css' rel='stylesheet' type='text/css'>
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.css" integrity="sha512-SUJFImtiT87gVCOXl3aGC00zfDl6ggYAw5+oheJvRJ8KBXZrr/TMISSdVJ5bBarbQDRC2pR5Kto3xTR0kpZInA==" crossorigin="anonymous" />
-<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js" integrity="sha512-vBmx0N/uQOXznm/Nbkp7h0P1RfLSj0HQrFSzV8m7rOGyj30fYAOKHYvCNez+yM8IrfnW0TCodDEjRqf6fodf/Q==" crossorigin="anonymous"></script>
-<script src="/js/jquery3.1.0.min.js"></script>
-<script src="/js/d3.v4.min.js"></script>
-<script src="/js/metricsgraphics.min.js"></script>
- <script type="text/javascript">
- (function() {
- // oui s trè moch :( :( :(
-var ctx = document.getElementById('myChart').getContext('2d');
- d3.json('<%= alcoolog_path(@conn, :index_gls_json, @network, NolaWeb.format_chan(@channel)) %>', function(data) {
-
- var dynamicColors = function() {
- var r = Math.floor(Math.random() * 255);
- var g = Math.floor(Math.random() * 255);
- var b = Math.floor(Math.random() * 255);
- return "rgb(" + r + "," + g + "," + b + ")";
- };
-
- labels = data.labels;
- datasets = $.map($.makeArray(data.data), function(set) {
- return {label: set.name, data: set.history, fill: false, borderColor: dynamicColors()}
- });
-
-
-var myChart = new Chart(ctx, {
- type: 'line',
- data: {
- labels: labels,
- datasets: datasets
- },
- options: {
- scales: {
- xAxes: [{
- type: 'time',
- time: {
- unit: 'day'
- }
- }],
- yAxes: [{
- ticks: {
- beginAtZero: true
- }
- }]
- }
- }
-});
-});
-
-
-})();
-</script>