Add LndHub db/models, and quick stats for admin views
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
<%= render HeaderComponent.new(title: "Admin Panel") %>
|
||||
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<p class="text-center">
|
||||
With great power comes great responsibility.
|
||||
</p>
|
||||
<div class="text-center">
|
||||
<p class="my-12 inline-flex align-center items-center">
|
||||
<%= image_tag("/img/illustrations/undraw_vault_re_s4my.svg", class: 'h-48') %>
|
||||
</p>
|
||||
<p class="text-gray-500">
|
||||
With great power comes great responsibility.
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,26 @@
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<%= render QuickstatsContainerComponent.new do %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Overall',
|
||||
value: @stats[:overall_sats],
|
||||
unit: 'sats'
|
||||
) %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Donors',
|
||||
value: @stats[:donor_count],
|
||||
meta: "/ #{User.count} users"
|
||||
) %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<% if @donations.any? %>
|
||||
<h3>Recent Donations</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -11,7 +30,7 @@
|
||||
<th class="text-right">in USD</th>
|
||||
<th class="pl-2">Public name</th>
|
||||
<th>Date</th>
|
||||
<th colspan="3"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -23,11 +42,13 @@
|
||||
<td class="text-right"><% if donation.amount_eur.present? %><%= number_to_currency donation.amount_eur / 100, unit: "" %><% end %></td>
|
||||
<td class="text-right"><% if donation.amount_usd.present? %><%= number_to_currency donation.amount_usd / 100, unit: "" %><% end %></td>
|
||||
<td class="pl-2"><%= donation.public_name %></td>
|
||||
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d") : "" %></td>
|
||||
<td><%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||
<td><%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||
<td><%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red',
|
||||
data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %></td>
|
||||
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") : "" %></td>
|
||||
<td class="text-right">
|
||||
<%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
|
||||
<%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
|
||||
<%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red',
|
||||
data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -37,6 +58,7 @@
|
||||
No donations yet.
|
||||
</p>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<p class="mt-12">
|
||||
<%= link_to 'Record an out-of-system donation', new_admin_donation_path, class: 'btn-md btn-gray' %>
|
||||
|
||||
@@ -2,16 +2,28 @@
|
||||
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<p>
|
||||
There are currently <strong><%= @invitations_unused_count %>
|
||||
unused invitations</strong> available to existing users.
|
||||
<strong><%= @users_with_referrals_count %> users</strong> have successfully
|
||||
invited new users.
|
||||
</p>
|
||||
<%= render QuickstatsContainerComponent.new do %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Available',
|
||||
value: @stats[:available],
|
||||
) %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Accepted',
|
||||
value: @stats[:accepted],
|
||||
) %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Users with referrals',
|
||||
value: @stats[:users_with_referrals],
|
||||
meta: "/ #{User.count}"
|
||||
) %>
|
||||
<% end %>
|
||||
</section>
|
||||
<% if @invitations_used.any? %>
|
||||
<section>
|
||||
<h3>Accepted (<%= @invitations_used.length %>)</h3>
|
||||
<h3>Recently Accepted</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
48
app/views/admin/lightning/index.html.erb
Normal file
48
app/views/admin/lightning/index.html.erb
Normal file
@@ -0,0 +1,48 @@
|
||||
<%= render HeaderComponent.new(title: "Lightning Network") %>
|
||||
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<%= render QuickstatsContainerComponent.new do %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Current user balance',
|
||||
value: @ln[:current_balance],
|
||||
unit: 'sats'
|
||||
) %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Users with sats',
|
||||
value: @ln[:users_with_sats],
|
||||
meta: "/ #{User.count}"
|
||||
) %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Accounts</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>LN Account</th>
|
||||
<th>User</th>
|
||||
<th>Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @accounts.each do |account| %>
|
||||
<tr>
|
||||
<td class="font-mono">
|
||||
<%= account.login[0, 8] %>...<%= account.login[12, 19] %>
|
||||
</td>
|
||||
<td>
|
||||
<% if user = @users.find{ |u| u[2] == account.login } %>
|
||||
<%= "#{user[0]}@#{user[1]}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= number_with_delimiter account.balance.to_i.to_s %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user